diff --git a/develop/detail/serializer.hpp b/develop/detail/serializer.hpp index 59b9a606..76958435 100644 --- a/develop/detail/serializer.hpp +++ b/develop/detail/serializer.hpp @@ -665,8 +665,8 @@ class serializer void dump_float(number_float_t x, std::false_type /*is_ieee_single_or_double*/) { - // get number of digits for a text -> float -> text round-trip - static constexpr auto d = std::numeric_limits::digits10; + // get number of digits for a float -> text -> float round-trip + static constexpr auto d = std::numeric_limits::max_digits10; // the actual conversion std::ptrdiff_t len = snprintf(number_buffer.data(), number_buffer.size(), "%.*g", d, x); diff --git a/src/json.hpp b/src/json.hpp index e1d09f22..d01ec000 100644 --- a/src/json.hpp +++ b/src/json.hpp @@ -8136,8 +8136,8 @@ class serializer void dump_float(number_float_t x, std::false_type /*is_ieee_single_or_double*/) { - // get number of digits for a text -> float -> text round-trip - static constexpr auto d = std::numeric_limits::digits10; + // get number of digits for a float -> text -> float round-trip + static constexpr auto d = std::numeric_limits::max_digits10; // the actual conversion std::ptrdiff_t len = snprintf(number_buffer.data(), number_buffer.size(), "%.*g", d, x);