D float types operations vs C++ ones
Ola Fosheim Gr via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Fri Dec 18 00:19:40 PST 2015
On Friday, 18 December 2015 at 07:30:52 UTC, drug wrote:
>> What I mean about order of operations is that if you go
>> a = b*a+c*c + e;
>> the compiler is free to rewrite that as
>> float __tmp0 = a*b;
>> float __tmp1 = c*c;
>> and then do either of
>> float __tmp2 = __tmp0+__tmp1;
>> a = __tmp2 + e;
>> OR
>> float __tmp2 = __tmp0+e;
>> a = __tmp2+__tmp1;
>
> I see, thanks to all!
I don't think this can be right, unless you use some kind of
fast-math optimizer.
But:
Modern C++ compilers try to support ieee754-2008, which is needed
to get reproducible results. D is based on the older 1985
version, and there is no announced effort to make it modern.
More information about the Digitalmars-d-learn
mailing list