Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r78308 - trunk/boost
From: antoshkka_at_[hidden]
Date: 2012-05-02 15:00:38


Author: apolukhin
Date: 2012-05-02 15:00:37 EDT (Wed, 02 May 2012)
New Revision: 78308
URL: http://svn.boost.org/trac/boost/changeset/78308

Log:
Fixes #6852 (ISO C++ does not support the ‘%lg’ gnu_printf format fixed)
Text files modified:
   trunk/boost/lexical_cast.hpp | 5 +++--
   1 files changed, 3 insertions(+), 2 deletions(-)

Modified: trunk/boost/lexical_cast.hpp
==============================================================================
--- trunk/boost/lexical_cast.hpp (original)
+++ trunk/boost/lexical_cast.hpp 2012-05-02 15:00:37 EDT (Wed, 02 May 2012)
@@ -1322,7 +1322,8 @@
             { using namespace std;
                 if (put_inf_nan(begin, end, val)) return true;
                 end = begin;
- end += sprintf(begin,"%.*g", static_cast<int>(boost::detail::lcast_get_precision<float>()), val);
+ const double val_as_double = val;
+ end += sprintf(begin,"%.*g", static_cast<int>(boost::detail::lcast_get_precision<float>()), val_as_double);
                 return end > begin;
             }
 
@@ -1330,7 +1331,7 @@
             { using namespace std;
                 if (put_inf_nan(begin, end, val)) return true;
                 end = begin;
- end += sprintf(begin,"%.*lg", static_cast<int>(boost::detail::lcast_get_precision<double>()), val);
+ end += sprintf(begin,"%.*g", static_cast<int>(boost::detail::lcast_get_precision<double>()), val);
                 return end > begin;
             }
 


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