On Sun, 08 Feb 2015 09:19:06 +0000, Kenny wrote: > I asked more about this case: > float f = 16777216.0f; > if (f == f + 1.0f) > writeln("Works"); > > Although all operands are 32bit FP the result is not guaranteed to be > equal to the result for FP32 computations as specified by IEEE-754.
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.
signature.asc
Description: PGP signature