Always false float comparisons

Ethan Watson via Digitalmars-d digitalmars-d at puremagic.com
Wed May 18 04:30:18 PDT 2016


On Wednesday, 18 May 2016 at 11:17:14 UTC, Walter Bright wrote:
> Again, even if the precision matches, the rounding will NOT 
> match, and you will get different results randomly dependent on 
> the exact operand values.

We've already been burned by middlewares/APIS toggling MMX flags 
on and off and not cleaning up after themselves, and as such we 
strictly control those flags going in to and out of such areas. 
We even have a little class with implementations for x87 
(thoroughly deprecated) and SSE that is used in a RAII manner, 
copying the MMX flag on construction and restoring it on 
destruction.

I appreciate that it sounds like I'm starting to stretch to hold 
to my point, but I imagine we'd also be able to control such 
things with the compiler - or at least know what flags it uses so 
that we can ensure consistent behaviour between compilation and 
runtime.


More information about the Digitalmars-d mailing list