mirror of
https://github.com/fmtlib/fmt.git
synced 2024-11-26 12:10:06 +00:00
%.f should have zero precision, not default precision
This commit is contained in:
parent
a09f748894
commit
5060568f72
@ -454,6 +454,8 @@ void basic_printf_context<OutputIt, Char, AF>::format() {
|
||||
++it;
|
||||
spec.precision_ =
|
||||
visit(internal::PrintfPrecisionHandler(), get_arg(it));
|
||||
} else {
|
||||
spec.precision_ = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -397,6 +397,9 @@ TEST(PrintfTest, long_long) {
|
||||
|
||||
TEST(PrintfTest, Float) {
|
||||
EXPECT_PRINTF("392.650000", "%f", 392.65);
|
||||
EXPECT_PRINTF("392.65", "%.2f", 392.65);
|
||||
EXPECT_PRINTF("392.6", "%.1f", 392.65);
|
||||
EXPECT_PRINTF("393", "%.f", 392.65);
|
||||
EXPECT_PRINTF("392.650000", "%F", 392.65);
|
||||
char buffer[BUFFER_SIZE];
|
||||
safe_sprintf(buffer, "%e", 392.65);
|
||||
|
Loading…
Reference in New Issue
Block a user