Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Normative: handle awkward rounding behavior #471

Merged
merged 8 commits into from
Jan 5, 2021
3 changes: 3 additions & 0 deletions spec/annexes.html
Original file line number Diff line number Diff line change
Expand Up @@ -170,5 +170,8 @@ <h1>Additions and Changes That Introduce Incompatibilities with Prior Editions</
<li>
<emu-xref href="#sec-Intl-toStringTag"></emu-xref> In ECMA-402, 7th Edition, the @@toStringTag property of `Intl` was not defined. In 8th Edition, @@toStringTag is set to *"Intl"*.
</li>
<li>
<emu-xref href="#sec-intl-numberformat-constructor"></emu-xref> In ECMA-402, 8th Edition, the NumberFormat constructor used to throw an error when style="currency" and maximumFractionDigits was set to a value lower than the default fractional digits for that currency. This behavior was corrected in the 9th edition, and it no longer throws an error.
</li>
</ul>
</emu-annex>
9 changes: 6 additions & 3 deletions spec/numberformat.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,12 @@ <h1>SetNumberFormatDigitOptions ( _intlObj_, _options_, _mnfdDefault_, _mxfdDefa
1. Set _intlObj_.[[MaximumSignificantDigits]] to _mxsd_.
1. Else if _mnfd_ is not *undefined* or _mxfd_ is not *undefined*, then
1. Set _intlObj_.[[RoundingType]] to ~fractionDigits~.
sffc marked this conversation as resolved.
Show resolved Hide resolved
1. Let _mnfd_ be ? DefaultNumberOption(_mnfd_, 0, 20, _mnfdDefault_).
1. Let _mxfdActualDefault_ be max( _mnfd_, _mxfdDefault_ ).
1. Let _mxfd_ be ? DefaultNumberOption(_mxfd_, _mnfd_, 20, _mxfdActualDefault_).
anba marked this conversation as resolved.
Show resolved Hide resolved
1. Let _specifiedMnfd_ be ? DefaultNumberOption(_mnfd_, 0, 20, *undefined*).
1. Let _specifiedMxfd_ be ? DefaultNumberOption(_mxfd_, 0, 20, *undefined*).
1. If _specifiedMxfd_ is not *undefined*, set _mnfdDefault_ to min(_mnfdDefault_, _specifiedMxfd_).
1. Set _mnfd_ to ! DefaultNumberOption(_specifiedMnfd_, 0, 20, _mnfdDefault_).
1. Set _mxfd_ to ! DefaultNumberOption(_specifiedMxfd_, 0, 20, max(_mxfdDefault_, _mnfd_)).
1. If _mnfd_ is greater than _mxfd_, throw a *RangeError* exception.
1. Set _intlObj_.[[MinimumFractionDigits]] to _mnfd_.
1. Set _intlObj_.[[MaximumFractionDigits]] to _mxfd_.
1. Else if _notation_ is *"compact"*, then
Expand Down