:rotating_light: fix warning

Signed-off-by: Niels Lohmann <mail@nlohmann.me>
diff --git a/cmake/requirements/requirements-cppcheck.txt b/cmake/requirements/requirements-cppcheck.txt
index 9119ad7..aa15911 100644
--- a/cmake/requirements/requirements-cppcheck.txt
+++ b/cmake/requirements/requirements-cppcheck.txt
@@ -1 +1 @@
-cppcheck==1.5.0
+cppcheck==1.5.1
diff --git a/include/nlohmann/detail/output/serializer.hpp b/include/nlohmann/detail/output/serializer.hpp
index fc07853..d3d81bf 100644
--- a/include/nlohmann/detail/output/serializer.hpp
+++ b/include/nlohmann/detail/output/serializer.hpp
@@ -830,9 +830,11 @@
         // get number of digits for a float -> text -> float round-trip
         static constexpr auto d = std::numeric_limits<number_float_t>::max_digits10;
 
-        // the actual conversion
+        // the actual conversion (Note that is_ieee_single_or_double==false
+        // rules out that number_float_t is double or long double. Therefore,
+        // we need to cast the argument x to double to be able to use snprintf.)
         // 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(), "%.*g", d, static_cast<double>(x));
 
         // negative value indicates an error
         JSON_ASSERT(len > 0);
diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp
index 93e5983..391d54c 100644
--- a/single_include/nlohmann/json.hpp
+++ b/single_include/nlohmann/json.hpp
@@ -19565,9 +19565,11 @@
         // get number of digits for a float -> text -> float round-trip
         static constexpr auto d = std::numeric_limits<number_float_t>::max_digits10;
 
-        // the actual conversion
+        // the actual conversion (Note that is_ieee_single_or_double==false
+        // rules out that number_float_t is double or long double. Therefore,
+        // we need to cast the argument x to double to be able to use snprintf.)
         // 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(), "%.*g", d, static_cast<double>(x));
 
         // negative value indicates an error
         JSON_ASSERT(len > 0);