You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: spec.emu
+22-22Lines changed: 22 additions & 22 deletions
Original file line number
Diff line number
Diff line change
@@ -20,7 +20,7 @@ contributors: Eemeli Aro
20
20
FormatNumericToString (
21
21
_intlObject_: an Object,
22
22
_x_: a mathematical value or ~negative-zero~,
23
-
<ins>_stringDigits_: an integer,</ins>
23
+
<ins>_stringDigitCount_: an integer,</ins>
24
24
): a Record with fields [[RoundedNumber]] (a mathematical value or ~negative-zero~) and [[FormattedString]] (a String)
25
25
</h1>
26
26
<dl class="header">
@@ -39,12 +39,12 @@ contributors: Eemeli Aro
39
39
1. Set _x_ to -_x_.
40
40
1. Let _unsignedRoundingMode_ be GetUnsignedRoundingMode(_intlObject_.[[RoundingMode]], _sign_).
41
41
1. If _intlObject_.[[RoundingType]] is ~significant-digits~, then
42
-
1. Let _result_ be ToRawPrecision(_x_, <ins>_stringDigits_,</ins> _intlObject_.[[MinimumSignificantDigits]], _intlObject_.[[MaximumSignificantDigits]], _unsignedRoundingMode_).
42
+
1. Let _result_ be ToRawPrecision(_x_, <ins>_stringDigitCount_,</ins> _intlObject_.[[MinimumSignificantDigits]], _intlObject_.[[MaximumSignificantDigits]], _unsignedRoundingMode_).
43
43
1. Else if _intlObject_.[[RoundingType]] is ~fraction-digits~, then
44
-
1. Let _result_ be ToRawFixed(_x_, <ins>_stringDigits_,</ins> _intlObject_.[[MinimumFractionDigits]], _intlObject_.[[MaximumFractionDigits]], _intlObject_.[[RoundingIncrement]], _unsignedRoundingMode_).
44
+
1. Let _result_ be ToRawFixed(_x_, <ins>_stringDigitCount_,</ins> _intlObject_.[[MinimumFractionDigits]], _intlObject_.[[MaximumFractionDigits]], _intlObject_.[[RoundingIncrement]], _unsignedRoundingMode_).
45
45
1. Else,
46
-
1. Let _sResult_ be ToRawPrecision(_x_, <ins>_stringDigits_,</ins> _intlObject_.[[MinimumSignificantDigits]], _intlObject_.[[MaximumSignificantDigits]], _unsignedRoundingMode_).
47
-
1. Let _fResult_ be ToRawFixed(_x_, <ins>_stringDigits_,</ins> _intlObject_.[[MinimumFractionDigits]], _intlObject_.[[MaximumFractionDigits]], _intlObject_.[[RoundingIncrement]], _unsignedRoundingMode_).
46
+
1. Let _sResult_ be ToRawPrecision(_x_, <ins>_stringDigitCount_,</ins> _intlObject_.[[MinimumSignificantDigits]], _intlObject_.[[MaximumSignificantDigits]], _unsignedRoundingMode_).
47
+
1. Let _fResult_ be ToRawFixed(_x_, <ins>_stringDigitCount_,</ins> _intlObject_.[[MinimumFractionDigits]], _intlObject_.[[MaximumFractionDigits]], _intlObject_.[[RoundingIncrement]], _unsignedRoundingMode_).
48
48
1. If _fResult_.[[RoundingMagnitude]] < _sResult_.[[RoundingMagnitude]], let _fixedIsMorePrecise_ be *true*; else let _fixedIsMorePrecise_ be *false*.
49
49
1. If _intlObject_.[[RoundingType]] is ~more-precision~ and _fixedIsMorePrecise_ is *true*, then
50
50
1. Let _result_ be _fResult_.
@@ -82,11 +82,11 @@ contributors: Eemeli Aro
82
82
83
83
<emu-alg>
84
84
1. <ins>If _x_ is an Intl mathematical value, then</ins>
85
-
1. <ins>Let _stringDigits_ be _x_.[[StringDigits]].</ins>
85
+
1. <ins>Let _stringDigitCount_ be _x_.[[StringDigitCount]].</ins>
86
86
1. <ins>Set _x_ to _x_.[[Value]].</ins>
87
87
1. <ins>Else,</ins>
88
88
1. <ins>Assert: _x_ is a mathematical value.</ins>
89
-
1. <ins>Let _stringDigits_ be 0.</ins>
89
+
1. <ins>Let _stringDigitCount_ be 0.</ins>
90
90
1. Let _exponent_ be 0.
91
91
1. If _x_ is ~not-a-number~, then
92
92
1. Let _n_ be an ILD String value indicating the *NaN* value.
@@ -100,7 +100,7 @@ contributors: Eemeli Aro
100
100
1. If _numberFormat_.[[Style]] is *"percent"*, set _x_ be 100 × _x_.
101
101
1. Set _exponent_ to ComputeExponent(_numberFormat_, _x_).
102
102
1. Set _x_ to _x_ × 10<sup>-_exponent_</sup>.
103
-
1. Let _formatNumberResult_ be FormatNumericToString(_numberFormat_, _x_<ins>, _stringDigits_</ins>).
103
+
1. Let _formatNumberResult_ be FormatNumericToString(_numberFormat_, _x_<ins>, _stringDigitCount_</ins>).
104
104
1. Let _n_ be _formatNumberResult_.[[FormattedString]].
105
105
1. Set _x_ to _formatNumberResult_.[[RoundedNumber]].
106
106
1. Let _pattern_ be GetNumberFormatPattern(_numberFormat_, _x_).
@@ -231,7 +231,7 @@ contributors: Eemeli Aro
231
231
<h1>
232
232
ToRawPrecision (
233
233
_x_: a non-negative mathematical value,
234
-
<ins>_stringDigits_: an integer,</ins>
234
+
<ins>_stringDigitCount_: an integer,</ins>
235
235
_minPrecision_: an integer in the inclusive interval from 1 to 21,
236
236
_maxPrecision_: an integer in the inclusive interval from 1 to 21,
237
237
_unsignedRoundingMode_: a specification type from the Unsigned Rounding Mode column of <emu-xref href="#table-intl-unsigned-rounding-modes"></emu-xref>, or *undefined*,
@@ -275,7 +275,7 @@ contributors: Eemeli Aro
275
275
1. Set _m_ to the string-concatenation of *"0."*, -(_e_ + 1) occurrences of the code unit 0x0030 (DIGIT ZERO), and _m_.
276
276
1. Let _int_ be 1.
277
277
1. If _m_ contains the code unit 0x002E (FULL STOP) and _maxPrecision_ > _minPrecision_, then
278
-
1. Let _cut_ be _maxPrecision_ - <del>_minPrecision_</del><ins>max(_stringDigits_, _minPrecision_)</ins>.
278
+
1. Let _cut_ be _maxPrecision_ - <del>_minPrecision_</del><ins>max(_stringDigitCount_, _minPrecision_)</ins>.
279
279
1. Repeat, while _cut_ > 0 and the last code unit of _m_ is 0x0030 (DIGIT ZERO),
280
280
1. Remove the last code unit from _m_.
281
281
1. Set _cut_ to _cut_ - 1.
@@ -289,7 +289,7 @@ contributors: Eemeli Aro
289
289
<h1>
290
290
ToRawFixed (
291
291
_x_: a non-negative mathematical value,
292
-
<ins>_stringDigits_: an integer,</ins>
292
+
<ins>_stringDigitCount_: an integer,</ins>
293
293
_minFraction_: an integer in the inclusive interval from 0 to 100,
294
294
_maxFraction_: an integer in the inclusive interval from 0 to 100,
295
295
_roundingIncrement_: an integer,
@@ -321,7 +321,7 @@ contributors: Eemeli Aro
321
321
1. Let _a_ be the first _k_ - _f_ code units of _m_, and let _b_ be the remaining _f_ code units of _m_.
322
322
1. <del>Set _m_ to the string-concatenation of _a_, *"."*, and _b_.</del>
323
323
1. Let _int_ be the length of _a_.
324
-
1. <ins>Let _cut_ be _maxFraction_ - max(_stringDigits_ - _int_, _minFraction_).</ins>
324
+
1. <ins>Let _cut_ be _maxFraction_ - max(_stringDigitCount_ - _int_, _minFraction_).</ins>
325
325
1. <ins>Repeat, while _cut_ > 0 and the last code unit of _b_ is 0x0030 (DIGIT ZERO),</ins>
326
326
1. <ins>Remove the last code unit from _b_.</ins>
327
327
1. <ins>Set _cut_ to _cut_ - 1.</ins>
@@ -472,42 +472,42 @@ contributors: Eemeli Aro
472
472
<dd>
473
473
It returns _value_ converted to an <dfn id="intl-mathematical-value">Intl mathematical value</dfn>, <del>which</del><ins>a Record with two fields:</ins>
474
474
<ins>[[Value]]</ins> is a mathematical value <del>together with</del><ins>or one of</ins> ~positive-infinity~, ~negative-infinity~, ~not-a-number~, <ins>or ~negative-zero~,</ins> and
475
-
<del>~negative-zero~</del><ins>[[StringDigits]] is an integer indicating the number of significant digits in _value_ when it is a String, or 0 otherwise</ins>.
475
+
<del>~negative-zero~</del><ins>[[StringDigitCount]] is an integer indicating the number of significant digits in _value_ when it is a String, or 0 otherwise</ins>.
476
476
This abstract operation is similar to <emu-xref href="#sec-tonumeric"></emu-xref>, but <del>a mathematical value can be returned instead of a Number or BigInt, so that exact decimal values can be represented</del><ins>retains the full precision of numeric strings</ins>.
477
477
</dd>
478
478
</dl>
479
479
<emu-alg>
480
480
1. Let _primValue_ be ? ToPrimitive(_value_, ~number~).
481
-
1. If _primValue_ is a BigInt, return <del>ℝ(_primValue_)</del><ins>the Record { [[Value]]: ℝ(_primValue_), [[StringDigits]]: 0 }</ins>.
481
+
1. If _primValue_ is a BigInt, return <del>ℝ(_primValue_)</del><ins>the Record { [[Value]]: ℝ(_primValue_), [[StringDigitCount]]: 0 }</ins>.
482
482
1. If _primValue_ is a String, then
483
483
1. Let _str_ be _primValue_.
484
484
1. Else,
485
485
1. Let _x_ be ? ToNumber(_primValue_).
486
-
1. If _x_ is *-0*<sub>𝔽</sub>, return <del>~negative-zero~</del><ins>the Record { [[Value]]: ~negative-zero~, [[StringDigits]]: 0 }</ins>.
486
+
1. If _x_ is *-0*<sub>𝔽</sub>, return <del>~negative-zero~</del><ins>the Record { [[Value]]: ~negative-zero~, [[StringDigitCount]]: 0 }</ins>.
487
487
1. Let _str_ be Number::toString(_x_, 10).
488
488
1. Let _text_ be StringToCodePoints(_str_).
489
489
1. Let _literal_ be ParseText(_text_, |StringNumericLiteral|).
490
-
1. If _literal_ is a List of errors, return <del>~not-a-number~</del><ins>the Record { [[Value]]: ~not-a-number~, [[StringDigits]]: 0 }</ins>.
490
+
1. If _literal_ is a List of errors, return <del>~not-a-number~</del><ins>the Record { [[Value]]: ~not-a-number~, [[StringDigitCount]]: 0 }</ins>.
491
491
1. Let <del>_intlMV_</del><ins>_stringData_</ins> be the StringIntlMV of _literal_.
492
492
1. <ins>Let _intlMV_ be _stringData_[0].</ins>
493
493
1. <ins>If _primValue_ is a String, then</ins>
494
-
1. <ins>Let _stringDigits_ be _stringData_[1].</ins>
494
+
1. <ins>Let _stringDigitCount_ be _stringData_[1].</ins>
495
495
1. <ins>Else,</ins>
496
-
1. <ins>Let _stringDigits_ be 0.</ins>
496
+
1. <ins>Let _stringDigitCount_ be 0.</ins>
497
497
1. If _intlMV_ is a mathematical value, then
498
498
1. Let _rounded_ be RoundMVResult(abs(_intlMV_)).
499
499
1. <del>If _rounded_ is *+∞*<sub>𝔽</sub> and _intlMV_ < 0, return ~negative-infinity~.</del>
500
500
1. <del>If _rounded_ is *+∞*<sub>𝔽</sub>, return ~positive-infinity~.</del>
501
501
1. <ins>If _rounded_ is *+∞*<sub>𝔽</sub>, then</ins>
502
502
1. <ins>If _intlMV_ < 0, set _intlMV_ to ~negative-infinity~.</ins>
503
503
1. <ins>Else, set _intlMV_ to ~positive-infinity~.</ins>
504
-
1. <ins>Set _stringDigits_ to 0.</ins>
504
+
1. <ins>Set _stringDigitCount_ to 0.</ins>
505
505
1. <del>If _rounded_ is *+0*<sub>𝔽</sub> and _intlMV_ < 0, return ~negative-zero~.</del>
506
506
1. <del>If _rounded_ is *+0*<sub>𝔽</sub>, return 0.</del>
507
507
1. <ins>If _rounded_ is *+0*<sub>𝔽</sub>, then</ins>
508
508
1. <ins>If _intlMV_ < 0, set _intlMV_ to ~negative-zero~.</ins>
509
509
1. <ins>Else, set _intlMV_ to 0.</ins>
510
-
1. Return <del>_intlMV_</del><ins>the Record { [[Value]]: _intlMV_, [[StringDigits]]: _stringDigits_ }</ins>.
510
+
1. Return <del>_intlMV_</del><ins>the Record { [[Value]]: _intlMV_, [[StringDigitCount]]: _stringDigitCount_ }</ins>.
511
511
</emu-alg>
512
512
</emu-clause>
513
513
@@ -600,14 +600,14 @@ contributors: Eemeli Aro
600
600
1. <del>Let _s_ be ! ToString(_n_)</del>
601
601
1. <del>Return the Record { [[PluralCategory]]: *"other"*, [[FormattedString]]: _s_ }.</del>
602
602
1. <ins>Let _x_ be _intlMV_.[[Value]].</ins>
603
-
1. <ins>Let _stringDigits_ be _intlMV_.[[StringDigits]].</ins>
603
+
1. <ins>Let _stringDigitCount_ be _intlMV_.[[StringDigitCount]].</ins>
604
604
1. <ins>If _x_ is ~not-a-number~, then</ins>
605
605
1. <ins>Return the Record { [[PluralCategory]]: *"other"*, [[FormattedString]]: *"NaN"* }</ins>.
606
606
1. <ins>Else if _x_ is ~positive-infinity~, then</ins>
607
607
1. <ins>Return the Record { [[PluralCategory]]: *"other"*, [[FormattedString]]: *"Infinity"* }.</ins>
608
608
1. <ins>Else if _x_ is ~negative-infinity~, then</ins>
609
609
1. <ins>Return the Record { [[PluralCategory]]: *"other"*, [[FormattedString]]: *"-Infinity"* }.</ins>
610
-
1. Let _res_ be FormatNumericToString(_pluralRules_, <del>ℝ(_n_)</del><ins>_x_, _stringDigits_</ins>).
610
+
1. Let _res_ be FormatNumericToString(_pluralRules_, <del>ℝ(_n_)</del><ins>_x_, _stringDigitCount_</ins>).
0 commit comments