1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-28 05:25:09 +00:00
serenity/Userland/Libraries/LibJS/Tests/builtins/Intl/NumberFormat
Timothy Flynn 9e50f25ac4 LibJS: Prevent i64 overflow when computing large NumberFormat exponents
The largest exponents we compute are on the order of 10^21 (governed by
the maximumSignificantDigits option, which has a max value of 21). That
is too large to fit into the i64 we were using when multiplying this
exponent by the value to be formatted.

Instead, split up the logic to multiply that value by this exponent
based on the value's underlying type:

Number: Do not cast the result of pow() to an i64, and perform the
follow-up multiplication with doubles.

BigInt: Do not use pow(). Instead, compute the exponent as a BigInt
from the start, then perform the follow-up multiplication with that
BigInt.
2022-07-18 08:51:07 +01:00
..
NumberFormat.@@toStringTag.js LibJS: Implement a nearly empty Intl.NumberFormat object 2021-09-11 11:05:50 +01:00
NumberFormat.js LibJS+js: Parse new constructor options from Intl.NumberFormat V3 2022-07-13 19:22:26 +01:00
NumberFormat.prototype.format.js LibJS: Prevent i64 overflow when computing large NumberFormat exponents 2022-07-18 08:51:07 +01:00
NumberFormat.prototype.formatToParts.js LibJS: Implement Intl.NumberFormat V3's [[SignDisplay]] changes 2022-07-13 19:22:26 +01:00
NumberFormat.prototype.resolvedOptions.js LibJS: Allow specifying keyword values not directly defined for a locale 2022-07-15 12:31:43 +02:00
NumberFormat.supportedLocalesOf.js LibJS: Implement Intl.NumberFormat.supportedLocalesOf 2021-09-11 11:05:50 +01:00