mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 22:07:35 +00:00
LibJS: Use more accurate number-to-string method in Intl.NumberFormat
Intl.NumberFormat only ever wants literal number-to-digits here, without extra exponential formatting.
This commit is contained in:
parent
9620a092de
commit
d56205f991
3 changed files with 14 additions and 6 deletions
|
@ -1032,11 +1032,6 @@ RawFormatResult to_raw_precision(MathematicalValue const& number, int min_precis
|
|||
}
|
||||
// 3. Else,
|
||||
else {
|
||||
// FIXME: The result of these steps isn't entirely accurate for large values of 'p' (which
|
||||
// defaults to 21, resulting in numbers on the order of 10^21). Either AK::format or
|
||||
// our Number::toString AO (double_to_string in Value.cpp) will need to be improved
|
||||
// to produce more accurate results.
|
||||
|
||||
// a. Let n1 and e1 each be an integer and r1 a mathematical value, with r1 = ToRawPrecisionFn(n1, e1, p), such that r1 ≤ x and r1 is maximized.
|
||||
auto [number1, exponent1, rounded1] = to_raw_precision_function(number, precision, PreferredResult::LessThanNumber);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue