Mail Archives: djgpp-workers/2000/03/27/04:35:29
Another person's opinion. But note that he's only indirectly talking
about C99 and really seems to be talking about IEEE 754.
nmm1 AT cus DOT cam DOT ac DOT uk (Nick Maclaren) writes:
>The intention of C99 appears to be that you should print a misleading
>minus sign. As I have posted before, this treatment of NaNs as
>signable values is in clear breach of the stated intent of IEEE 754.
I went through and read your old postings and I'm not sure I agree.
Yes, the normative part of IEEE 754 clearly states "This standard does
not interpret the sign of a NaN." But the non-normative appendix just
as clearly states that "-x is x copied with its sign reversed, not 0-x;
the distinction is germane when x is +-0 or NaN." There is similar
language for copysign. I don't know of any implementation that does
not follow this part of the appendix.
My guess (without having been there) is that a perhaps-majority opinion
held that NaN sign bits should be treated consistently with the sign
bits of numbers, that this opinion did not rise to the consensus needed
to be formalized in the standard, and that the opinion is expressed
indirectly in the appendix.
Since IEEE 754 proper leaves the treatment of a NaN's sign bit
undefined, other standards can impose further requirements here.
Hence the C standard can require that a NaN with a nonzero sign bit be
printed with a leading minus sign. This would be consistent with the
"perhaps-majority opinion" that I hypothesize for IEEE 754.
(My phrase "perhaps-majority opinion" is a euphemism for W. Kahan's
opinion. Have you ever argued with Kahan about floating point?
I have. It's a delightful experience. :-)
- Raw text -