Boost logo

Boost :

From: Guillaume Melquiond (guillaume.melquiond_at_[hidden])
Date: 2006-05-15 13:03:28

Le lundi 15 mai 2006 à 16:22 +0100, Paul A Bristow a écrit :

> Does this mean that the
> // C99 macros defined as C++ templates
> template<class T> bool signbit(T x);
> is undefined for a NaN?

No, it is perfectly defined as the value of the highest bit of the
binary representation. But whether or not it is actually carrying any
useful information is a whole other matter. NaN have sign bits but no
sign. :)

> I note that
> ISO/IEC 9899:1999 (E)
> "A double argument representing an infinity is converted in one of the
> styles
> [-]inf or [-]infinity - which style is implementation-defined. A
> double argument representing a NaN is converted in one of the styles
> [-]nan or [-]nan(n-char-sequence)
> Explicitly allows a preceeding - sign.
> Seems like it is hard to justify prohibiting the - sign - but clearly its
> meaning is 'implementation defined'?

Right. My point was mainly about your sentence: "This allows for
positive and negative infinities, and for both positive and negative
quiet_NaN." I would simply avoid speaking of the sign for a NaN.

> Similarly interpretation of the suffix (n-char-sequence) is too - but how is
> the stream expected to know when it has ended?

I may be wrong, but it seems to me the parentheses are present in the
output, so the sequence trivially ends when the right parenthesis is

Best regards,


Boost list run by bdawes at, gregod at, cpdaniel at, john at