|
Boost : |
From: Paul A Bristow (pbristow_at_[hidden])
Date: 2006-04-20 06:04:45
| -----Original Message-----
| From: boost-bounces_at_[hidden]
| [mailto:boost-bounces_at_[hidden]] On Behalf Of Jeff Garland
| Sent: 20 April 2006 04:01
| To: boost_at_[hidden]
| Subject: Re: [boost] Report from Berlin C++ Standards
| Committee meeting
|
| On Wed, 19 Apr 2006 18:31:14 +0100, Paul A Bristow wrote
|
| > So a) is in principle fixed IMO.
| >
| > As to b), I had understood that we had agreed that all NaNs
| could reasonably
| > be treated as identical and one would get a NaN (unspecified) back.
| > Similarly infinities.
| >
| >
| http://article.gmane.org/gmane.comp.lib.boost.devel/134569/mat
| ch=serializati
| > on+nan
| >
| > But simple
| >
| > stream << output_value; // write out.
| > double read_value;
| > stream >> read_value; // read back.
| >
| > doesn't work for
| >
| > double output_value = numeric_limits<double>::quiet_NaN();
| // output_value
| > 1.#QNAN != read_value 1
| > double output_value = numeric_limits<double>::infinity();
| // output_value
| > 1.#INF != read_value 1
| >
| > So some special flag would be needed to hold the Nan or Inf nature.
| >
| > If only there was a Standard representation of Nan and Infs. VERY
| > shortsighted, making NaNs and infs hardly useable.
|
| Agreed. The types in date_time have the ability to serialize
| and deserilize
| NADT (not a date time), -infinity and +infinity. Why
| couldn't there be a
| simple extension to the numpunct<charT> facet to define an
| appropriate output
| string? Basically something like:
|
| //see Langer and Kreft p 414...
| template<class charT>
| class numpunct : public locale::facet {
|
| //new functions for nan and infinity
| string_type not_a_number_name() const;
| string_type infinity_name() const;
|
| And you'd have to fix num_get as well.
Looks a good idea - but these facets look complicated to my inexpert eye.
Should we ALSO press to get a 'proper' C++0x Standard solution to this?
Paul
-- Paul A Bristow Prizet Farmhouse, Kendal, Cumbria UK LA8 8AB Phone and SMS text +44 1539 561830, Mobile and SMS text +44 7714 330204 mailto: pbristow_at_[hidden] http://www.hetp.u-net.com/index.html http://www.hetp.u-net.com/Paul%20A%20Bristow%20info.html
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk