Prevent overflow with zero precision

This commit is contained in:
Victor Zverovich
2019-03-13 10:46:25 -07:00
parent 49bbf3c876
commit e28429ee73
2 changed files with 12 additions and 6 deletions

View File

@@ -1471,6 +1471,7 @@ TEST(FormatterTest, FormatDouble) {
}
TEST(FormatterTest, PrecisionRounding) {
EXPECT_EQ("0", format("{:.0f}", 0.1));
EXPECT_EQ("0.000", format("{:.3f}", 0.00049));
EXPECT_EQ("0.001", format("{:.3f}", 0.0005));
}