Don't emit trailing zeros by default

This commit is contained in:
Victor Zverovich 2020-11-27 07:45:54 -08:00
parent d0110b7e35
commit 22a68d1613
2 changed files with 1 additions and 1 deletions

View File

@ -1396,7 +1396,6 @@ FMT_CONSTEXPR float_specs parse_float_type_spec(
switch (specs.type) { switch (specs.type) {
case 0: case 0:
result.format = float_format::general; result.format = float_format::general;
result.showpoint |= specs.precision > 0;
break; break;
case 'G': case 'G':
result.upper = true; result.upper = true;

View File

@ -978,6 +978,7 @@ TEST(FormatterTest, Precision) {
EXPECT_EQ("1.2", format("{0:.2}", 1.2345)); EXPECT_EQ("1.2", format("{0:.2}", 1.2345));
EXPECT_EQ("1.2", format("{0:.2}", 1.2345l)); EXPECT_EQ("1.2", format("{0:.2}", 1.2345l));
EXPECT_EQ("1.2e+56", format("{:.2}", 1.234e56)); 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("1e+00", format("{:.0e}", 1.0L));
EXPECT_EQ(" 0.0e+00", format("{:9.1e}", 0.0)); EXPECT_EQ(" 0.0e+00", format("{:9.1e}", 0.0));
EXPECT_EQ( EXPECT_EQ(