Mail Archives: djgpp-workers/2000/03/16/17:19:01
Hans-Bernhard Broeker wrote:
> Well, if Intel decided that the 'standard' NaN was to be negative, then so be
> it.
For "real indefinite", the sign bit is set. However, I'd rather not call it
"negative", since, for NaNs, the sign bit doesn't really signify anything about
the numerical value (indeed, NaN *has* no numerical value), and since the sign bit
of NaN does not obey the usual arithmetic laws when it is used in floating-point
arithmetic.
The NaN without the sign bit set is a "signaling NaN". According to Intel:
QNaNs are allowed to propagate through most arithmetic operations
without signaling an exception. SNaNs generally signal an
invalid-operation exception whenever they appear as operands in
arithmetic operations.
If we call "real indefinite" -NaN, then we have
-NaN * SNaN => SNaN
SNaN * SNaN => SNaN
-NaN * -NaN => -NaN
> They probably only chose it because of the 'nice' binary form: a
> series of 1 bits, then a series of 0 bits. I see no reason not to print it
> as negative, except for the a bit of irritation to some readers of the
> output.
I would vote for suppressing the sign of NaN except when it is explicitly
specified in a format specifier (as is currently done) since, as I argue above,
"real indefinite" is not really negative.
-Eric Rudd
rudd AT cyberoptics DOT com
- Raw text -