Closed sffc closed 1 year ago
My proposal is to limit the strings as follows:
Semantics for overflow:
Infinity
-Infinity
0
or -0
depending on the signThis is intended to be consistent with Number semantics, but with larger limits.
Why would mathematical values have any limits? They're math values.
@sffc Could you offer the background of this issue? My understanding is that ICU4C can have very large amount of exponent as a decimal by using string. What is the reason of not doing it in ICU4X too?
CC @FrankYFTang
The V8 implementation requires an intermediate type to represent the intl mathematical value because it is used for certain operations such as <
~and ==
~ for the purposes of range formatting. There has been pushback to making it a string with unbounded length for both the mantissa and the exponent. There is a desire to use a more compact representation for one or both pieces.
The ICU4X intermediate representation, FixedDecimal
, allows for values with up to u16::MAX
significant digits and exponents ranging from i16::MIN
to i16::MAX
.
2022-05-19 discussion: https://github.com/tc39/ecma402/blob/master/meetings/notes-2022-05-19.md#limit-exponent-of-intl-mathematical-value-98
Conclusion: Proceed with adding a limit upon parsing the string. Internally we will still use a mathematical value; this is only on the string parsing step. The limit should be set in a way that is implementable to check.
@romulocintra Please see the meeting minutes. It looks like we agreed on +/- 10K.
@romulocintra Do you plan to write the spec for this? It would be nice to present it at this week's TC39 meeting so that we can have a clean Stage 4 in January.
In order to support implementations that limit the number of exponent digits or significant digits, we should put some limit on the intl mathematical values. Consider the ICU4X limits as a model.