RESOLVED FIXED281501
[JSC] Fix rounding error for `Intl.DurationFormat`
https://bugs.webkit.org/show_bug.cgi?id=281501
Summary [JSC] Fix rounding error for `Intl.DurationFormat`
Sosuke Suzuki
Reported 2024-10-15 09:02:27 PDT
Our `Intl.DurationFormat` is affected by rounding errors because each unit is summed as a double. Additionally, very large values cannot fit within a double. This patch introduces the following changes: - Each unit is summed using `Int128`. - Since `Int128` values cannot be formatted with ICU’s `unumf_formatDouble`[1], so we build a decimal-formatted string from the `Int128` value and use `unumf_formatDecimal`[2] for formatting. [1]: https://unicode-org.github.io/icu-docs/apidoc/released/icu4c/unumberformatter_8h.html#a54193ed406316485803e3dac3a96615f [2]: https://unicode-org.github.io/icu-docs/apidoc/released/icu4c/unumberformatter_8h.html#a6183aa03b43b63b231341770035bace9
Attachments
Sosuke Suzuki
Comment 1 2024-10-15 09:04:41 PDT
EWS
Comment 2 2024-10-19 19:47:31 PDT
Committed 285482@main (48d36047a83e): <https://commits.webkit.org/285482@main> Reviewed commits have been landed. Closing PR #35219 and removing active labels.
Radar WebKit Bug Importer
Comment 3 2024-10-19 19:48:15 PDT
Note You need to log in before you can comment on or make changes to this bug.