Fixes #6852 (ISO C++ does not support the ‘%lg’ gnu_printf format fixed)

[SVN r78308]
This commit is contained in:
Antony Polukhin
2012-05-02 19:00:37 +00:00
parent 15ab0d6385
commit d30dd9e3c8

View File

@@ -1322,7 +1322,8 @@ namespace boost {
{ using namespace std; { using namespace std;
if (put_inf_nan(begin, end, val)) return true; if (put_inf_nan(begin, end, val)) return true;
end = begin; 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; return end > begin;
} }
@@ -1330,7 +1331,7 @@ namespace boost {
{ using namespace std; { using namespace std;
if (put_inf_nan(begin, end, val)) return true; if (put_inf_nan(begin, end, val)) return true;
end = begin; 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; return end > begin;
} }