diff --git a/include/fmt/format.h b/include/fmt/format.h index f47f6427..a91578a8 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -1396,7 +1396,6 @@ FMT_CONSTEXPR float_specs parse_float_type_spec( switch (specs.type) { case 0: result.format = float_format::general; - result.showpoint |= specs.precision > 0; break; case 'G': result.upper = true; diff --git a/test/format-test.cc b/test/format-test.cc index 49886eaf..205997ec 100644 --- a/test/format-test.cc +++ b/test/format-test.cc @@ -978,6 +978,7 @@ TEST(FormatterTest, Precision) { EXPECT_EQ("1.2", format("{0:.2}", 1.2345)); EXPECT_EQ("1.2", format("{0:.2}", 1.2345l)); EXPECT_EQ("1.2e+56", format("{:.2}", 1.234e56)); + EXPECT_EQ("1.1", format("{0:.3}", 1.1)); EXPECT_EQ("1e+00", format("{:.0e}", 1.0L)); EXPECT_EQ(" 0.0e+00", format("{:9.1e}", 0.0)); EXPECT_EQ(