Very strange problem with comparing floating point numbers

jerro a at a.com
Sun Sep 30 14:42:53 PDT 2012


> Technically (AFAIK), IEEE754 does need require reproducibility, 
> ergo determinism.

It actually requires more than that:

"Algebraic operations covered by IEEE 754, namely + , - , * , / , 
square root ˆš and Binary <-> Decimal Conversion with rare 
exceptions, must be Correctly Rounded to the precision of the 
operation’s destination unless the programmer has specified 
a rounding other than the default. If it does not Overflow, a 
correctly rounded operation’s error cannot exceed half the 
gap between adjacent floating-point numbers astride the 
operation’s ideal ( unrounded ) result. Half-way cases are 
rounded to Nearest Even, which means that the neighbor with last 
digit 0 is chosen."

I don't know if implementation conform exactly to IEEE 754, but I 
doubt there is any commonly used implementation that isn't 
deterministic.


More information about the Digitalmars-d-learn mailing list