mirror of
https://github.com/fmtlib/fmt.git
synced 2024-12-25 15:21:54 +00:00
Fix fallback float formatter at assymetric bounds (#1976)
This commit is contained in:
parent
bcab36da3f
commit
6b7bfed40c
@ -2332,7 +2332,7 @@ void fallback_format(Double d, int num_digits, bool binary32, buffer<char>& buf,
|
||||
upper = &upper_store;
|
||||
}
|
||||
denominator.assign_pow10(exp10);
|
||||
denominator <<= 1;
|
||||
denominator <<= shift;
|
||||
} else if (exp10 < 0) {
|
||||
numerator.assign_pow10(-exp10);
|
||||
lower.assign(numerator);
|
||||
|
@ -1317,6 +1317,8 @@ TEST(FormatterTest, FormatDouble) {
|
||||
EXPECT_EQ(buffer, format("{:a}", -42.0));
|
||||
safe_sprintf(buffer, "%A", -42.0);
|
||||
EXPECT_EQ(buffer, format("{:A}", -42.0));
|
||||
EXPECT_EQ("9223372036854775808.000000",
|
||||
format("{:f}", 9223372036854775807.0));
|
||||
}
|
||||
|
||||
TEST(FormatterTest, PrecisionRounding) {
|
||||
|
Loading…
Reference in New Issue
Block a user