Boost logo

Boost :

From: John Maddock (john_at_[hidden])
Date: 2005-12-01 14:22:44


> The sign is actually the one information of a NaN you don't want to
> get
> back. The IEEE-754 standard explicitly mandates that NaN do not have a
> sign (or more precisely, the sign of a NaN is not part of its
> payload).
>
> All the other bits of a NaN value are important however. They are its
> payload and are supposed to be stable through arithmetic operations
> (except when an operation involves two NaNs). As a matter of fact,
> NaNs
> were conceived to carry information (debug information mainly).
>
> At a time, there even were discussions on revising the IEEE-754
> standard
> to describe a syntax like NaN0x3ff800. This proposal was withdrawn
> because it was so high-level, but it should give an idea on what NaNs
> were about.

Understood. Thanks for the information. The basic problem here is that
there is no portably way to get at that information, frexp yields undefined
behaviour if pass it a NaN for example :-(

Likewise there is no portable way to create a NaN with a specific payload
(that I'm aware of), not even in C99.

John.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk