1- <!doctype html>
1+ <!DOCTYPE html>
22<meta charset="utf8">
33<link rel="stylesheet" href="./spec.css">
44<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.4/styles/github.min.css">
@@ -97,9 +97,14 @@ contributors: Eemeli Aro
9797 1. Else,
9898 1. If _x_ is not ~negative-zero~, then
9999 1. Assert: _x_ is a mathematical value.
100- 1. If _numberFormat_.[[Style]] is *"percent"*, set _x_ be 100 × _x_.
100+ 1. <ins>Let _magnitude_ be the base 10 logarithm of abs(_x_) rounded down to the nearest integer.</ins>
101+ 1. If _numberFormat_.[[Style]] is *"percent"*<del>, set _x_ be 100 × _x_.</del><ins>, then</ins>
102+ 1. <ins>Set _x_ to 100 × _x_.</ins>
103+ 1. <ins>If _magnitude_ < 0, set _stringDigitCount_ to _stringDigitCount_ + max(_magnitude_, -2).</ins>
104+ 1. <ins>Set _magnitude_ to _magnitude_ + 2.</ins>
101105 1. Set _exponent_ to ComputeExponent(_numberFormat_, _x_).
102106 1. Set _x_ to _x_ × 10<sup>-_exponent_</sup>.
107+ 1. <ins>If _magnitude_ < 0 and _exponent_ < 0, set _stringDigitCount_ to _stringDigitCount_ + max(_magnitude_, _exponent_).</ins>
103108 1. Let _formatNumberResult_ be FormatNumericToString(_numberFormat_, _x_<ins>, _stringDigitCount_</ins>).
104109 1. Let _n_ be _formatNumberResult_.[[FormattedString]].
105110 1. Set _x_ to _formatNumberResult_.[[RoundedNumber]].
@@ -162,7 +167,7 @@ contributors: Eemeli Aro
162167 <h1>
163168 PartitionNotationSubPattern (
164169 _numberFormat_: an Intl.NumberFormat,
165- _x_: <del>an Intl</del><ins>a</ins> mathematical value<del>,</del>< ins> or ~negative-zero~. </ins>
170+ _x_: <del>an Intl</del><ins>a</ins> mathematical value<ins> or ~negative-zero~</ins>,
166171 _n_: a String,
167172 _exponent_: an integer,
168173 ): a List of Records with fields [[Type]] (a String) and [[Value]] (a String)
@@ -405,6 +410,7 @@ contributors: Eemeli Aro
405410 </p>
406411 </ins>
407412 </emu-note>
413+ <emu-grammar type="definition"><ins>ZeroDigits ::: `0` ZeroDigits?</ins></emu-grammar>
408414 <emu-grammar>StringNumericLiteral ::: StrWhiteSpace?</emu-grammar>
409415 <emu-alg>
410416 1. Return <del>0</del><ins>« 0, 0 »</ins>.
@@ -432,10 +438,16 @@ contributors: Eemeli Aro
432438 <emu-alg>
433439 1. Return <del>~positive-infinity~</del><ins>« ~positive-infinity~, 0 »</ins>.
434440 </emu-alg>
435- <emu-grammar>StrUnsignedDecimalLiteral ::: DecimalDigits `.` DecimalDigits? ExponentPart?</emu-grammar>
441+ <emu-grammar>StrUnsignedDecimalLiteral ::: <del> DecimalDigits</del> <ins>ZeroDigits? NonZeroDigit DecimalDigits?</ins> `.` DecimalDigits? ExponentPart?</emu-grammar>
436442 <emu-alg>
437- 1. Let _a_ be MV of the first |DecimalDigits|.
438- 1. <ins>Let _m_ be the number of code points in the first |DecimalDigits|.</ins>
443+ 1. <del>Let _a_ be MV of the first |DecimalDigits|.</del>
444+ 1. <ins>If the first |DecimalDigits| is present, then</ins>
445+ 1. <ins>Let _m_ be the number of code points in the first |DecimalDigits|.</ins>
446+ 1. <ins>Let _a_ be the MV of |NonZeroDigit| × 10<sup>_m_</sup> plus the MV of the first |DecimalDigits|.</ins>
447+ 1. <ins>Set _m_ to 1 + _m_.</ins>
448+ 1. <ins>Else,</ins>
449+ 1. <ins>Let _m_ be 1.</ins>
450+ 1. <ins>Let _a_ be the MV of |NonZeroDigit|.</ins>
439451 1. If the second |DecimalDigits| is present, then
440452 1. Let _b_ be MV of the second |DecimalDigits|.
441453 1. Let _n_ be the number of code points in the second |DecimalDigits|.
@@ -445,20 +457,31 @@ contributors: Eemeli Aro
445457 1. If |ExponentPart| is present, let _e_ be MV of |ExponentPart|. Otherwise, let _e_ be 0.
446458 1. Return <ins>«</ins> (_a_ + (_b_ × 10<sup>-_n_</sup>)) × 10<sup>_e_</sup><ins>, _m_ + _n_ »</ins>.
447459 </emu-alg>
448- <emu-grammar>StrUnsignedDecimalLiteral ::: `.` DecimalDigits ExponentPart?</emu-grammar>
460+ <emu-grammar>StrUnsignedDecimalLiteral ::: <ins>ZeroDigits?</ins> `.` DecimalDigits ExponentPart?</emu-grammar>
449461 <emu-alg>
450462 1. Let _b_ be MV of |DecimalDigits|.
451463 1. If |ExponentPart| is present, let _e_ be MV of |ExponentPart|. Otherwise, let _e_ be 0.
452464 1. Let _n_ be the number of code points in |DecimalDigits|.
453- 1. Return <ins>«</ins> _b_ × 10<sup>_e_ - _n_</sup><ins>, _n_ ».</ins>
465+ 1. Return <ins>«</ins> _b_ × 10<sup>_e_ - _n_</sup><ins>, 1 + _n_ ».</ins>
454466 </emu-alg>
455- <emu-grammar>StrUnsignedDecimalLiteral ::: DecimalDigits ExponentPart?</emu-grammar>
467+ <emu-grammar>StrUnsignedDecimalLiteral ::: <del> DecimalDigits</del> <ins>ZeroDigits? NonZeroDigit DecimalDigits?</ins> ExponentPart?</emu-grammar>
456468 <emu-alg>
457- 1. Let _a_ be MV of |DecimalDigits|.
469+ 1. <del>Let _a_ be MV of |DecimalDigits|.</del>
470+ 1. <ins>If the |DecimalDigits| is present, then</ins>
471+ 1. <ins>Let _m_ be the number of code points in |DecimalDigits|.</ins>
472+ 1. <ins>Let _a_ be the MV of |NonZeroDigit| × 10<sup>_m_</sup> plus the MV of |DecimalDigits|.</ins>
473+ 1. <ins>Set _m_ to 1 + _m_.</ins>
474+ 1. <ins>Else,</ins>
475+ 1. <ins>Let _m_ be 1.</ins>
476+ 1. <ins>Let _a_ be the MV of the |NonZeroDigit|.</ins>
458477 1. <ins>Let _m_ be the number of code points in |DecimalDigits|.</ins>
459478 1. If |ExponentPart| is present, let _e_ be MV of |ExponentPart|. Otherwise, let _e_ be 0.
460479 1. Return <ins>«</ins> _a_ × 10<sup>_e_</sup><ins>, _m_ »</ins>.
461480 </emu-alg>
481+ <emu-grammar><ins>StrUnsignedDecimalLiteral ::: ZeroDigits ExponentPart?</ins></emu-grammar>
482+ <emu-alg>
483+ 1. <ins>Return « 0, 0 ».</ins>
484+ </emu-alg>
462485 </emu-clause>
463486
464487 <emu-clause id="sec-tointlmathematicalvalue" type="abstract operation">
0 commit comments