From d30dd9e3c8e78c3d01c90ded5734381b1dfc17e8 Mon Sep 17 00:00:00 2001 From: Antony Polukhin Date: Wed, 2 May 2012 19:00:37 +0000 Subject: [PATCH] =?UTF-8?q?Fixes=20#6852=20(ISO=20C++=20does=20not=20suppo?= =?UTF-8?q?rt=20the=20=E2=80=98%lg=E2=80=99=20gnu=5Fprintf=20format=20fixe?= =?UTF-8?q?d)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [SVN r78308] --- include/boost/lexical_cast.hpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/include/boost/lexical_cast.hpp b/include/boost/lexical_cast.hpp index fb76d29..328700b 100644 --- a/include/boost/lexical_cast.hpp +++ b/include/boost/lexical_cast.hpp @@ -1322,7 +1322,8 @@ namespace boost { { using namespace std; if (put_inf_nan(begin, end, val)) return true; end = begin; - end += sprintf(begin,"%.*g", static_cast(boost::detail::lcast_get_precision()), val); + const double val_as_double = val; + end += sprintf(begin,"%.*g", static_cast(boost::detail::lcast_get_precision()), val_as_double); return end > begin; } @@ -1330,7 +1331,7 @@ namespace boost { { using namespace std; if (put_inf_nan(begin, end, val)) return true; end = begin; - end += sprintf(begin,"%.*lg", static_cast(boost::detail::lcast_get_precision()), val); + end += sprintf(begin,"%.*g", static_cast(boost::detail::lcast_get_precision()), val); return end > begin; }