Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r73187 - trunk/libs/math/doc/sf_and_dist
From: pbristow_at_[hidden]
Date: 2011-07-17 10:56:41


Author: pbristow
Date: 2011-07-17 10:56:40 EDT (Sun, 17 Jul 2011)
New Revision: 73187
URL: http://svn.boost.org/trac/boost/changeset/73187

Log:
Update on lexical cast improvements.
Text files modified:
   trunk/libs/math/doc/sf_and_dist/fp_facets.qbk | 14 +++++++++++---
   1 files changed, 11 insertions(+), 3 deletions(-)

Modified: trunk/libs/math/doc/sf_and_dist/fp_facets.qbk
==============================================================================
--- trunk/libs/math/doc/sf_and_dist/fp_facets.qbk (original)
+++ trunk/libs/math/doc/sf_and_dist/fp_facets.qbk 2011-07-17 10:56:40 EDT (Sun, 17 Jul 2011)
@@ -379,14 +379,18 @@
 
 [h5 Use with lexical_cast]
 
-Without using a new locale that contains the nonfinite facets, `lexical_cast` is not portable
-(and often fails) if nonfinite values are found.
+[note From Boost 1.48, lexical_cast no longer uses stringstreams internally,
+and is now able to handle infinities and NaNs natively on most platforms.]
+
+Without using a new locale that contains the nonfinite facets,
+previous versions of `lexical_cast` using stringstream were not portable
+(and often failed) if nonfinite values are found.
 
 [nonfinite_facets_sstream_1]
 
 Although other examples imbue individual streams with the new locale,
 for the streams constructed inside lexical_cast,
-it is necesary to assign to a global locale.
+it was necesary to assign to a global locale.
 
   locale::global(new_locale);
 
@@ -398,6 +402,10 @@
   string s = boost::lexical_cast<string>(numeric_limits<double>::infinity());
   assert(s == "inf");
 
+[warning If you use stringstream inside your functions,
+you may still need to use a global locale to handle nonfinites correctly.
+Or you need to imbue your stringstream with suitable get and put facets.]
+
 [warning You should be aware that the C++ specification does not explicitly require
 that input from decimal digits strings converts with rounding to the
 nearest representable floating-point binary value.


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk