For AI agents: the complete documentation index is available at /tc39-atlas/en/llms.txt, the full documentation bundle is available at /tc39-atlas/en/llms-full.txt, and this page is available as Markdown at /tc39-atlas/en/proposals/stage/0/intl-numberformat-round-option.md.
  • English
  • Intl.NumberFormat round option S0

    Proposal details
    Proposal overview

    This proposal introduces a round option to Intl.NumberFormat to allow specifying a rounding function other than the default "half-even", such as Math.ceil, Math.floor, or Math.trunc. The proposal cites the Unicode Technical Standard #35 as a reference.

    Note

    The README below comes from the upstream repository and may contain outdated stage or status metadata. Use the proposal details above as the current source of truth.

    NumberFormat round option

    Proposal for stage 0

    Allows to select a rounding function for NumberFormat different than round "half-even". For example: ceil, floor, or truncate.

    Such option is present on Unicode Technical Standard #35, part 3 Numbers, which says "An implementation may allow the specification of a rounding mode to determine how values are rounded".

    http://www.unicode.org/reports/tr35/tr35-numbers.html#Rounding

    Usage

    let formatUsingHalfEvenRounding = new Intl.NumberFormat("en").format(Math.PI);
    // "3.142"
    
    let formatUsingFloorRounding = new Intl.NumberFormat("en", {round: Math.floor}).format(Math.PI);
    // "3.141"
    
    let formatCurrencyUsingCeilRounding = new Intl.NumberFormat("en", {
      style: "currency",
      currency: "USD",
      currencyDisplay: "symbol",
      round: Math.ceil
    }).format(9.991);
    // "$10.00"