Fun with floating point

Kenny via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Feb 8 01:44:11 PST 2015


> i think you are mixing two things here. IEEE doesn't specify 
> which
> internal representation compilers should use, it only specifies 
> the
> results for chosen representation. so if D specs states that 
> `float`
> calculations are always performing with `float` precision (and 
> specs
> aren't), your sample should work.
>
> but the specs says that compiler is free to promote such 
> expression to
> any type it wants, it just should not loose precision. so the 
> actual type
> of `f` in `f == f + 1.0f` can be freely promoted to `double`, 
> `real` or
> even to some GMP representation.

It's clear now, thanks!. Also thanks to everyone for the answers, 
it was very helpful.



More information about the Digitalmars-d-learn mailing list