-
Notifications
You must be signed in to change notification settings - Fork 3
Description
According to ECMA-402, the smallest positive string decimal that is able to be formatted is: the string decimal representing the smallest number that is closer to the smallest subnormal float than to zero.
The smallest subnormal float is 5e-324 or 4.94065645841246544177…e-324
This means that 2.47032822920623272089e-324 is the smallest decimal value supported in Intl.NumberFormat when rounded to 21 significant digits. However, the check is technically performed before rounding.
Likewise, the largest positive string decimal is the one representing the number closer to Number.MAX_VALUE than what would be the next tick above it (?).
The precision of the formatted output is bounded by 21 significant digits for small numbers and 100 fraction digits for large numbers. For magnitudes smaller than 1e-79, the max significant digits rule, and for magnitudes larger than 1e-79, the max fraction digits rule. In a String Amount, I would suggest applying these bounds upon construction.