From 86477f7ecc1606e15abae1ff784e6b0c55d99619 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Tue, 22 Feb 2022 17:18:33 -0800 Subject: [PATCH] Fix size computation --- include/fmt/format.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/fmt/format.h b/include/fmt/format.h index 22c0d1b4..d7171549 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -2101,8 +2101,9 @@ FMT_CONSTEXPR20 auto do_write_float(OutputIt out, const DecimalFP& fp, throw std::runtime_error("fuzz mode - avoiding excessive cpu use"); #endif if (fspecs.showpoint) { + ++size; if (num_zeros <= 0 && fspecs.format != float_format::fixed) num_zeros = 1; - if (num_zeros > 0) size += to_unsigned(num_zeros) + 1; + if (num_zeros > 0) size += to_unsigned(num_zeros); } auto grouping = Grouping(loc, fspecs.locale); size += to_unsigned(grouping.count_separators(significand_size));