Boost logo

Boost :

From: Paul A. Bristow (boost_at_[hidden])
Date: 2003-07-16 16:13:04


| -----Original Message-----
| From: boost-bounces_at_[hidden]
| [mailto:boost-bounces_at_[hidden]]On Behalf Of Gabriel Dos Reis
| Sent: Sunday, July 13, 2003 9:22 AM
| To: Boost mailing list
| Subject: Re: [boost] Re: Re: is_nan
|
| | And can anyone help with allowing one to easily customise the
| display of NaNs?(and infs, max, min...?)
| | I believe that a new (derived) num_put facet is the way
| | to do this.

| Does anyone have an actual implementation of this to contribute too?
|
| I'm willing to volunteer but I'm not sure I really understand the
| question. Can you elaborate a little bit?
|
| -- Gaby

If you 'show' a qNaN (or indeed an sNaN) with MSVC, you get

   cout << "The quiet NaN for type float is: "
        << numeric_limits<float>::quiet_NaN( )
        << endl;

Output:

The quiet NaN for type float is: 1.#QNAN

But suppose you want to display another message instead, perhaps to output data
for input by some other system that recognizes all qNaNs as, say, "NaN", so the
output would be

The quiet NaN for type float is: NaN

AND would be portable for all platforms, of course.

Similarly for infs, max, min - if you get floating point inf, max or min as a
result of a calculation, it should be shown as special to the reader?

Paul

PS IMHO This is more important than it may appear because it, with the lack of a
Standard isnan test, is preventing real-life use of NaNs.

Paul A Bristow, Prizet Farmhouse, Kendal, Cumbria, LA8 8AB UK
+44 1539 561830 Mobile +44 7714 33 02 04
Mobile mailto:pabristow_at_[hidden]
mailto:pbristow_at_[hidden]


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