From 64bd2a0b0374698003b4e129210741dc26ecad85 Mon Sep 17 00:00:00 2001 From: Vladislav Shchapov Date: Sat, 19 Feb 2022 13:48:58 +0500 Subject: [PATCH] Fix clang -Wliteral-range warning --- test/format-test.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/format-test.cc b/test/format-test.cc index c7a468ad32b06..51942f01d2dd6 100644 --- a/test/format-test.cc +++ b/test/format-test.cc @@ -948,8 +948,10 @@ TEST(format_test, precision) { EXPECT_THAT(outputs, testing::Contains(fmt::format("{:.838A}", -2.14001164E+38))); - auto ld = 8.43821965335442234493E-4933L; - EXPECT_EQ(fmt::format("{:.0}", ld), ld != 0 ? "8e-4933" : "0"); + if (std::numeric_limits::digits == 64) { + auto ld = std::numeric_limits::min(); + EXPECT_EQ(fmt::format("{:.0}", ld), ld != 0 ? "8e-4933" : "0"); + } EXPECT_EQ("123.", fmt::format("{:#.0f}", 123.0)); EXPECT_EQ("1.23", fmt::format("{:.02f}", 1.234));