Fix handling of zero precision

This commit is contained in:
Victor Zverovich
2019-04-19 14:48:42 -07:00
parent 6b20863918
commit 946498cfbc
2 changed files with 5 additions and 1 deletions

View File

@@ -610,7 +610,7 @@ struct fixed_handler {
uint64_t error, int, bool integral) {
FMT_ASSERT(remainder < divisor, "");
buf[size++] = digit;
if (size != precision) return digits::more;
if (size < precision) return digits::more;
if (!integral) {
// Check if error * 2 < divisor with overflow prevention.
// The check is not needed for the integral part because error = 1