diff --git a/include/fmt/format.h b/include/fmt/format.h index ba3f1a78..63bac146 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -1591,7 +1591,7 @@ OutputIt write_nonfinite(OutputIt out, bool isinf, constexpr size_t str_size = 3; auto sign = fspecs.sign; auto size = str_size + (sign ? 1 : 0); - // replace '0'-padding with space for non-finite values + // Replace '0'-padding with space for non-finite values. const bool is_zero_fill = specs.fill.size() == 1 && *specs.fill.data() == static_cast('0'); if (is_zero_fill) specs.fill[0] = static_cast(' '); diff --git a/test/format-test.cc b/test/format-test.cc index 774e7bc1..38399788 100644 --- a/test/format-test.cc +++ b/test/format-test.cc @@ -1279,8 +1279,9 @@ TEST(format_test, format_nan) { if (std::signbit(-nan)) { EXPECT_EQ("-nan", fmt::format("{}", -nan)); EXPECT_EQ(" -nan", fmt::format("{:+06}", -nan)); - } else + } else { fmt::print("Warning: compiler doesn't handle negative NaN correctly"); + } EXPECT_EQ(" nan", fmt::format("{: }", nan)); EXPECT_EQ("NAN", fmt::format("{:F}", nan)); EXPECT_EQ("nan ", fmt::format("{:<7}", nan));