mirror of
https://github.com/fmtlib/fmt.git
synced 2026-05-04 19:44:09 +02:00
Don't emit trailing zeros in exponential notation (#1376)
This commit is contained in:
+2
-2
@@ -410,6 +410,7 @@ TEST(PrintfTest, Float) {
|
||||
EXPECT_PRINTF("392.65", "%G", 392.65);
|
||||
EXPECT_PRINTF("392", "%g", 392.0);
|
||||
EXPECT_PRINTF("392", "%G", 392.0);
|
||||
EXPECT_PRINTF("4.56e-07", "%g", 0.000000456);
|
||||
safe_sprintf(buffer, "%a", -392.65);
|
||||
EXPECT_EQ(buffer, format("{:a}", -392.65));
|
||||
safe_sprintf(buffer, "%A", -392.65);
|
||||
@@ -588,8 +589,7 @@ class custom_printf_arg_formatter : public formatter_t {
|
||||
if (round(value * pow(10, specs()->precision)) == 0.0) value = 0;
|
||||
return formatter_t::operator()(value);
|
||||
}
|
||||
}
|
||||
;
|
||||
};
|
||||
|
||||
typedef fmt::basic_format_args<context_t> format_args_t;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user