Accuracy of floating point calculations

H. S. Teoh hsteoh at quickfur.ath.cx
Tue Oct 29 17:43:47 UTC 2019


On Tue, Oct 29, 2019 at 04:54:23PM +0000, ixid via Digitalmars-d-learn wrote:
> On Tuesday, 29 October 2019 at 16:11:45 UTC, Daniel Kozak wrote:
> > On Tue, Oct 29, 2019 at 5:09 PM Daniel Kozak <kozzi11 at gmail.com> wrote:
> > > If you use gdc or ldc you will get same results as c++, or you can
> > > use C log directly:
> > > 
> > > import std.stdio;
> > > import std.math : pow;
> > > import core.stdc.math;
> > > 
> > > void main()
> > > {
> > >      writefln("%12.3F",log(1-0.9999)/log(1-(1-0.6)^^20));
> > > }
> > 
> > AFAIK dmd use real  for floating point operations instead of double
> 
> Given x87 is deprecated and has been recommended against since 2003 at
> the latest it's hard to understand why this could be seen as a good
> idea.

Walter talked about this recently as one of the "misses" in D (one of
the things he predicted wrongly when he designed it).


T

-- 
Philosophy: how to make a career out of daydreaming.


More information about the Digitalmars-d-learn mailing list