mirror of
https://github.com/fmtlib/fmt.git
synced 2024-12-24 12:14:26 +00:00
Refer to jeaiii project
This commit is contained in:
parent
e37151021e
commit
ccaae0c019
@ -797,6 +797,8 @@ class decimal_formatter {
|
|||||||
} else if (N == 1) {
|
} else if (N == 1) {
|
||||||
write_pair(0, u);
|
write_pair(0, u);
|
||||||
} else {
|
} else {
|
||||||
|
// The idea of using 4.32 fixed-point numbers is based on
|
||||||
|
// https://github.com/jeaiii/itoa
|
||||||
unsigned n = N - 1;
|
unsigned n = N - 1;
|
||||||
unsigned a = n / 5 * n * 53 / 16;
|
unsigned a = n / 5 * n * 53 / 16;
|
||||||
uint64_t t = ((1ULL << (32 + a)) / data::POWERS_OF_10_32[n] + 1 - n / 9);
|
uint64_t t = ((1ULL << (32 + a)) / data::POWERS_OF_10_32[n] + 1 - n / 9);
|
||||||
|
Loading…
Reference in New Issue
Block a user