Casting double to ulong weirdness

Matthias Bentrup via Digitalmars-d digitalmars-d at puremagic.com
Tue Aug 25 14:21:57 PDT 2015


On Tuesday, 25 August 2015 at 15:19:41 UTC, Márcio Martins wrote:
>
> If you compile it with *GDC* it works fine. If you compile a 
> port with clang, gcc or msvc, it works right as well. I suspect 
> it will also work fine with LDC.

The same program "fails" in gcc too, if you use x87 math. Usually 
C compilers allow excess precision for intermediate results, 
because the extra precision seldom hurts and changing precision 
on x87 is very expensive (depends on the CPU, but it is more 
expensive than the trigonometric functions on some models).



More information about the Digitalmars-d mailing list