From 988c050e66c5ba4e9a357765c3534638b9f83aab Mon Sep 17 00:00:00 2001 From: rusloker Date: Thu, 26 Jan 2023 11:34:11 +0300 Subject: [PATCH] Applied amalgamate --- include/nlohmann/detail/output/serializer.hpp | 2 +- single_include/nlohmann/json.hpp | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/include/nlohmann/detail/output/serializer.hpp b/include/nlohmann/detail/output/serializer.hpp index e6dabac75..3aa4b2b86 100644 --- a/include/nlohmann/detail/output/serializer.hpp +++ b/include/nlohmann/detail/output/serializer.hpp @@ -832,7 +832,7 @@ class serializer // the actual conversion // NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg,hicpp-vararg) - std::ptrdiff_t len = (std::snprintf)(number_buffer.data(), number_buffer.size(), + std::ptrdiff_t len = (std::snprintf)(number_buffer.data(), number_buffer.size(), std::is_same::value ? "%.*Lg" : "%.*g", d, x); diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index 2448bf22d..81c3645e8 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -18754,7 +18754,9 @@ class serializer // the actual conversion // NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg,hicpp-vararg) - std::ptrdiff_t len = (std::snprintf)(number_buffer.data(), number_buffer.size(), "%.*g", d, x); + std::ptrdiff_t len = (std::snprintf)(number_buffer.data(), number_buffer.size(), + std::is_same::value ? "%.*Lg" : "%.*g", + d, x); // negative value indicates an error JSON_ASSERT(len > 0);