Fourth Draft "Unsafe fp optimizations" project description.

dewar@gnat.com dewar@gnat.com
Tue Aug 14 08:10:00 GMT 2001


<<It is true that -0.0 is numerically equal to 0.0, but it not (Lisp)
equivalent, in that 1.0/(0.0) is most definitely not (numerically equal ||
equivalent || or identical) to 1.0/(-0.0).  (I
would define Lisp equivalency as being able to substitute two values
in any expression and get the same answer; real Lispers can yell at me
now, and I'll fall back to Scheme ;-)  If this note refers to our previous
discussion of whether -A+B -> B-A is a valid transformation, I think
we were using "same" in the sense "equivalent".
>>

Note also that whether minus zero semantics have to be respected is
language dependent. In GNAT, we have Signed_Zeroes true, so we are
required to respect the expected negative zero semantics. As Brad
points out, this can be significant (basically the idea is that -0.0
in IEEE means, a negative number of very small magnitude, so small
that I can't record the magnitude, but I know it's negative). Of course
that can't be 100% consistent (just like infinity semantics cannot be
100% consistent, and indeed in the case of minus zeroes, we don't generate
Nan's for things like adding a positive zero and a negative zero (even
thoughy we have no idea about the sign of the result really).



More information about the Gcc mailing list