mirror of
https://github.com/fmtlib/fmt.git
synced 2025-01-27 06:35:37 +00:00
Don't generate insignificant digits
This commit is contained in:
parent
595902f8a0
commit
f233b56cdd
@ -1061,7 +1061,10 @@ void fallback_format(Double d, int num_digits, buffer<char>& buf, int& exp10) {
|
|||||||
if (upper != &lower) *upper *= 10;
|
if (upper != &lower) *upper *= 10;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Generate the given number of digits.
|
// Generate the given number of digits up to the maximum possible number of
|
||||||
|
// significant digits in a IEEE754 double.
|
||||||
|
const int max_double_digits = 767;
|
||||||
|
if (num_digits > max_double_digits) num_digits = max_double_digits;
|
||||||
exp10 -= num_digits - 1;
|
exp10 -= num_digits - 1;
|
||||||
if (num_digits == 0) {
|
if (num_digits == 0) {
|
||||||
buf.try_resize(1);
|
buf.try_resize(1);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user