Boost logo

Boost :

From: Gabriel Dos Reis (gdr_at_[hidden])
Date: 2003-07-16 16:45:46


"Paul A. Bristow" <boost_at_[hidden]> writes:

| | Signalling NaNs are used to indicate missing initialization values.
|
| This is OK for catching missing initialization by mistake - but not
| for OK for deliberately missing because there really is no value
| (measurement missing).

There is not just one qNaN (nor just one sNaN). There is a range for
NaNs. And most of the systems I worked with, the pattern bits in a
NaN is used to communicate the reason of being of the NaN. For
example, it may output sNaN("missing-value").

Note: C99 provides a pseudo-standard way to produce NaNs, through the
functions

    double nan(const char*);
    float nanf(const char*);
    long double nanl(const char*);

|
| In this case, for example calculating the mean, you want to test if the value is
| present/valid 'is_not_missing' before you add it to the sum and increment the
| count.
|
| Testing !is_nan is possible solution but I'm not sure it is ideal.

Indeed, it is no good.

| Suggestions?

I would first make a summary of the usage of the bit patterns for NaNs
and decide on one and document it.


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