You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The text was updated successfully, but these errors were encountered:
amoshydra
changed the title
What is the behaviour of constructor when a decimal exceeding 34 decimal places is provided
What is the behavior of the constructor when a decimal exceeding 34 decimal places is provided
Jan 8, 2025
The thinking is that the value gets rounded, using half-even. The work happens in step 9.c, below the ParseText call. If you look into that spec function you can see that it involves the RoundToDecimal128Domain abstract operation, which does respect the limit of 34 significant digits, using the 35th if necessary.
Question
What is the expected behavior for the following inputs?
The decimal inputs above has 35 decimals and 35 significant decimals
From my reading, currently specification only mention
ParseText
, butParseText
does not provide detail on how such input should be handled.Ref: https://tc39.es/proposal-decimal/#sec-the-decimal128-constructor-value
Side note
the npm package decimal128 @ 22:
"0.00000_0000000000_9999999999_9999999999_9999999999_99915"
"0.00000_0000000001"
"0.00000_0000000000_9999999999_9999999999_9999999999_9992"
^ expectation assuming round halfEven
The text was updated successfully, but these errors were encountered: