mirror of
https://github.com/nlohmann/json.git
synced 2025-07-28 12:02:00 +03:00
@ -2284,11 +2284,7 @@ class basic_json
|
|||||||
{
|
{
|
||||||
// 15 digits of precision allows round-trip IEEE 754
|
// 15 digits of precision allows round-trip IEEE 754
|
||||||
// string->double->string
|
// string->double->string
|
||||||
using std::snprintf;
|
o << std::setprecision(15) << m_value.number_float;
|
||||||
const auto sz = static_cast<unsigned int>(snprintf(nullptr, 0, "%.15g", m_value.number_float));
|
|
||||||
std::vector<typename string_t::value_type> buf(sz + 1);
|
|
||||||
snprintf(&buf[0], buf.size(), "%.15g", m_value.number_float);
|
|
||||||
o << buf.data();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2284,11 +2284,7 @@ class basic_json
|
|||||||
{
|
{
|
||||||
// 15 digits of precision allows round-trip IEEE 754
|
// 15 digits of precision allows round-trip IEEE 754
|
||||||
// string->double->string
|
// string->double->string
|
||||||
using std::snprintf;
|
o << std::setprecision(15) << m_value.number_float;
|
||||||
const auto sz = static_cast<unsigned int>(snprintf(nullptr, 0, "%.15g", m_value.number_float));
|
|
||||||
std::vector<typename string_t::value_type> buf(sz + 1);
|
|
||||||
snprintf(&buf[0], buf.size(), "%.15g", m_value.number_float);
|
|
||||||
o << buf.data();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user