mirror of
https://github.com/fmtlib/fmt.git
synced 2024-11-26 04:00:05 +00:00
Don't emit trailing zeros by default
This commit is contained in:
parent
d0110b7e35
commit
22a68d1613
@ -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;
|
||||||
|
@ -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(
|
||||||
|
Loading…
Reference in New Issue
Block a user