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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug middle-end/51446] -fno-trapping-math generates NaN constant with different sign


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51446

--- Comment #8 from Dominique d'Humieres <dominiq at lps dot ens.fr> 2011-12-08 16:06:43 UTC ---
> Does IEEE say anything about the sign of the qnan?

>From "Draft 1.2.5 DRAFT Standard for Floating-Point Arithmetic P754 October 4,
2006" at
http://www.validlab.com/754R/drafts/archive/2006-10-04.pdf :

8.2.1 NaN encodings in binary formats
...
All binary NaN bitstrings have all the bits of the biased exponent field E set
to 1 (see 5.4). 
A quiet NaN bitstring should be encoded with the first bit (d1) of the trailing
significand field T being 1. 
A signaling NaN bitstring should be encoded with the first bit of the trailing
significand field being 0. If the first bit of the trailing significand is 0,
some other bit of the trailing significand field must be non-zero to
distinguish the NaN from infinity.

In the preferred encoding, a signaling NaN should be quieted by setting d1 to
1, leaving the remaining bits of T unchanged.
...
8.3 The sign bit 8.3.0

When either an input or result is NaN, this standard does not interpret the
sign of a NaN. Note however that operations on bitstrings â copy, negate, abs,
copySign â specify the sign bit of a NaN result, sometimes based upon the sign
bit of a NaN operand. The logical predicate totalOrder is also affected by the
sign bit of a NaN operand. For all other operations, this standard does not
specify the sign bit of a NaN result, even when there is only one input NaN, or
when the NaN is produced from an invalid operation.
...


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]