Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions spec/numberformat.html
Original file line number Diff line number Diff line change
Expand Up @@ -1659,11 +1659,18 @@ <h1>
1. If _literal_ is a List of errors, return ~not-a-number~.
1. Let _intlMV_ be the StringIntlMV of _literal_.
1. If _intlMV_ is a mathematical value, then
1. Let _rounded_ be RoundMVResult(abs(_intlMV_)).
1. If _rounded_ is *+∞*<sub>𝔽</sub> and _intlMV_ &lt; 0, return ~negative-infinity~.
1. If _rounded_ is *+∞*<sub>𝔽</sub>, return ~positive-infinity~.
1. If _rounded_ is *+0*<sub>𝔽</sub> and _intlMV_ &lt; 0, return ~negative-zero~.
1. If _rounded_ is *+0*<sub>𝔽</sub>, return 0.
1. Let _e_ be the integer such that 10<sup>_e_</sup> ≤ abs(_intlMV_) &lt; 10<sup>_e_ + 1</sup>.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choosing such an e is impossible if intlMV is zero. To fix it, handle the zero case separately.

1. If _e_ ≥ 10000, then
1. If _intlMV_ &lt; 0, return ~negative-infinity~.
1. Else, return ~positive-infinity~.
1. If _e_ &lt; -10000, then
1. If _intlMV_ &lt; 0, return ~negative-zero~.
1. Else, return 0.
1. Let _q_ be the largest integer such that _intlMV_ × 10<sup>-_q_</sup> is an integer.
1. If _q_ &lt; -10000, then
1. Let _truncated_ be the largest mathematical value such that _truncated_ × 10<sup>10000</sup> is an integer and _truncated_ &lt; abs(_intlMV_).
1. If _intlMV_ &lt; 0, return -_truncated_.
1. Else, return _truncated_.
1. Return _intlMV_.
</emu-alg>
</emu-clause>
Expand Down