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; }