mirror of
https://github.com/fmtlib/fmt.git
synced 2024-11-14 23:11:05 +00:00
Fix fixed precision handling during rounding in long double
This commit is contained in:
parent
3c1b3337de
commit
d424862319
@ -3178,7 +3178,8 @@ FMT_CONSTEXPR20 inline void format_dragon(basic_fp<uint128_t> value,
|
||||
}
|
||||
if (buf[0] == overflow) {
|
||||
buf[0] = '1';
|
||||
++exp10;
|
||||
if ((flags & dragon::fixed) != 0) buf.push_back('0');
|
||||
else ++exp10;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -1472,6 +1472,7 @@ TEST(format_test, format_long_double) {
|
||||
EXPECT_EQ("0", fmt::format("{0:}", 0.0l));
|
||||
EXPECT_EQ("0.000000", fmt::format("{0:f}", 0.0l));
|
||||
EXPECT_EQ("0.0", fmt::format("{:.1f}", 0.000000001l));
|
||||
EXPECT_EQ("0.10", fmt::format("{:.2f}", 0.099l));
|
||||
EXPECT_EQ("392.65", fmt::format("{0:}", 392.65l));
|
||||
EXPECT_EQ("392.65", fmt::format("{0:g}", 392.65l));
|
||||
EXPECT_EQ("392.65", fmt::format("{0:G}", 392.65l));
|
||||
|
Loading…
Reference in New Issue
Block a user