I know that IEEE 754 defines NaNs to have the following bitwise representation:
- The sign bit can be either
0
or1
- The exponent field contains all
1
bits - Some bits of the mantissa are used to specify whether it's a quiet NaN or signalling NaN
- The mantissa cannot be all
0
bits because that bit pattern is reserved for representing infinity - The remaining bits of the mantissa form a payload
The payload is propagated (as is the NaN as a whole) to the result of a floating point calculation when the input of the calculation is NaN, though I have no knowledge of the details of this propagation or whether the standard specifies how this is done. Who sets the original payload? What happens if I add two NaNs with different payloads?
But most importantly: I've never seen NaN payloads used before. What uses does this payload field have?
0/0
,oo-oo
, function evaluated at pole, etc.) I have also heard unconfirmed rumours that at least one program uses the (51-bit) sNaN payload as a (48-bit) pointer for a "fallback" of sorts to arbitrary-precision arithmetic. – Recommend