tc39 / tc39/proposal-amount

Largest and smallest string decimals

Open
#27 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
HTML
Stars
58
Forks
12
Avg merge
2h 35m
Merged PRs (30d)
2

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.

CC @nicolo-ribaudo @eemeli

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the ECMA-402 rules for Intl.NumberFormat, then compare them with the issue's examples for the smallest subnormal value, Number.MAX_VALUE, and String Amount construction. Review how the proposal currently represents string decimals. Done means the supported bounds and when they are applied are agreed and documented for the proposal.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
internationalization
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.