This is the mail archive of the
`gcc@gcc.gnu.org`
mailing list for the GCC project.

# Re: Fourth Draft "Unsafe fp optimizations" project description.

*To*: ejr at cs dot berkeley dot edu, lucier at math dot purdue dot edu
*Subject*: Re: Fourth Draft "Unsafe fp optimizations" project description.
*From*: dewar at gnat dot com
*Date*: Tue, 14 Aug 2001 11:10:13 -0400 (EDT)
*Cc*: gcc at gcc dot gnu dot org

<<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).