On 11/17/2011 5:29 PM, bearophile wrote:
Walter:

On 11/17/2011 3:57 PM, bearophile wrote:
It's a NaN, but floating point designers have given a sign to NaNs for a
(small) purpose.

What is that purpose?

I didn't know the answer, so I've done a short research (finding texts like
this: http://grouper.ieee.org/groups/754/email/msg03893.html ), I have found
that languages usually ignore the sign of the NaNs (while the sign of zero
has some purposes). Producing the same bit patterns for 32 and 64 bit
compilers is useful for output binary consistency for comparisons, but
comparing floating point values bitwise is usually a not so wise thing to do.
So I think there is no need to put this in Bugzilla.

There is a NaN "payload" in the significand which it is polite to preserve, though no program has ever been observed to make use of it. The sign bit is not part of the payload. Requiring preservation of the sign bit means that one could not negate a floating point value without checking for NaN, which would be a significant performance penalty.

It's not a bug.

Reply via email to