1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 03:17:34 +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:
Timothy Flynn 2022-11-04 08:53:23 -04:00 committed by Linus Groh
parent 9620a092de
commit d56205f991
3 changed files with 14 additions and 6 deletions

View file

@ -296,7 +296,7 @@ bool MathematicalValue::is_zero() const
String MathematicalValue::to_string() const
{
return m_value.visit(
[](double value) { return Value(value).to_string_without_side_effects(); },
[](double value) { return number_to_string(value, NumberToStringMode::WithoutExponent); },
[](Crypto::SignedBigInteger const& value) { return value.to_base(10); },
[](auto) -> String { VERIFY_NOT_REACHED(); });
}