From ccaae0c0198be67391d240ea7593734050849b10 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Sun, 10 Dec 2017 16:09:35 -0800 Subject: [PATCH] Refer to jeaiii project --- include/fmt/format.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/fmt/format.h b/include/fmt/format.h index 4b65804b..0c861913 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -797,6 +797,8 @@ class decimal_formatter { } else if (N == 1) { write_pair(0, u); } else { + // The idea of using 4.32 fixed-point numbers is based on + // https://github.com/jeaiii/itoa unsigned n = N - 1; unsigned a = n / 5 * n * 53 / 16; uint64_t t = ((1ULL << (32 + a)) / data::POWERS_OF_10_32[n] + 1 - n / 9);