Skip to content

Commit 4490a2d

Browse files
committed
Rename [[StringDigits]] as [[StringDigitCount]] (#7)
1 parent a8ba01b commit 4490a2d

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

spec.emu

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ contributors: Eemeli Aro
2020
FormatNumericToString (
2121
_intlObject_: an Object,
2222
_x_: a mathematical value or ~negative-zero~,
23-
<ins>_stringDigits_: an integer,</ins>
23+
<ins>_stringDigitCount_: an integer,</ins>
2424
): a Record with fields [[RoundedNumber]] (a mathematical value or ~negative-zero~) and [[FormattedString]] (a String)
2525
</h1>
2626
<dl class="header">
@@ -39,12 +39,12 @@ contributors: Eemeli Aro
3939
1. Set _x_ to -_x_.
4040
1. Let _unsignedRoundingMode_ be GetUnsignedRoundingMode(_intlObject_.[[RoundingMode]], _sign_).
4141
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_).
4343
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_).
4545
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_).
4848
1. If _fResult_.[[RoundingMagnitude]] &lt; _sResult_.[[RoundingMagnitude]], let _fixedIsMorePrecise_ be *true*; else let _fixedIsMorePrecise_ be *false*.
4949
1. If _intlObject_.[[RoundingType]] is ~more-precision~ and _fixedIsMorePrecise_ is *true*, then
5050
1. Let _result_ be _fResult_.
@@ -82,11 +82,11 @@ contributors: Eemeli Aro
8282

8383
<emu-alg>
8484
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>
8686
1. <ins>Set _x_ to _x_.[[Value]].</ins>
8787
1. <ins>Else,</ins>
8888
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>
9090
1. Let _exponent_ be 0.
9191
1. If _x_ is ~not-a-number~, then
9292
1. Let _n_ be an ILD String value indicating the *NaN* value.
@@ -100,7 +100,7 @@ contributors: Eemeli Aro
100100
1. If _numberFormat_.[[Style]] is *"percent"*, set _x_ be 100 × _x_.
101101
1. Set _exponent_ to ComputeExponent(_numberFormat_, _x_).
102102
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>).
104104
1. Let _n_ be _formatNumberResult_.[[FormattedString]].
105105
1. Set _x_ to _formatNumberResult_.[[RoundedNumber]].
106106
1. Let _pattern_ be GetNumberFormatPattern(_numberFormat_, _x_).
@@ -231,7 +231,7 @@ contributors: Eemeli Aro
231231
<h1>
232232
ToRawPrecision (
233233
_x_: a non-negative mathematical value,
234-
<ins>_stringDigits_: an integer,</ins>
234+
<ins>_stringDigitCount_: an integer,</ins>
235235
_minPrecision_: an integer in the inclusive interval from 1 to 21,
236236
_maxPrecision_: an integer in the inclusive interval from 1 to 21,
237237
_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
275275
1. Set _m_ to the string-concatenation of *"0."*, -(_e_ + 1) occurrences of the code unit 0x0030 (DIGIT ZERO), and _m_.
276276
1. Let _int_ be 1.
277277
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>.
279279
1. Repeat, while _cut_ > 0 and the last code unit of _m_ is 0x0030 (DIGIT ZERO),
280280
1. Remove the last code unit from _m_.
281281
1. Set _cut_ to _cut_ - 1.
@@ -289,7 +289,7 @@ contributors: Eemeli Aro
289289
<h1>
290290
ToRawFixed (
291291
_x_: a non-negative mathematical value,
292-
<ins>_stringDigits_: an integer,</ins>
292+
<ins>_stringDigitCount_: an integer,</ins>
293293
_minFraction_: an integer in the inclusive interval from 0 to 100,
294294
_maxFraction_: an integer in the inclusive interval from 0 to 100,
295295
_roundingIncrement_: an integer,
@@ -321,7 +321,7 @@ contributors: Eemeli Aro
321321
1. Let _a_ be the first _k_ - _f_ code units of _m_, and let _b_ be the remaining _f_ code units of _m_.
322322
1. <del>Set _m_ to the string-concatenation of _a_, *"."*, and _b_.</del>
323323
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>
325325
1. <ins>Repeat, while _cut_ > 0 and the last code unit of _b_ is 0x0030 (DIGIT ZERO),</ins>
326326
1. <ins>Remove the last code unit from _b_.</ins>
327327
1. <ins>Set _cut_ to _cut_ - 1.</ins>
@@ -472,42 +472,42 @@ contributors: Eemeli Aro
472472
<dd>
473473
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>
474474
<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>.
476476
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>.
477477
</dd>
478478
</dl>
479479
<emu-alg>
480480
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>.
482482
1. If _primValue_ is a String, then
483483
1. Let _str_ be _primValue_.
484484
1. Else,
485485
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>.
487487
1. Let _str_ be Number::toString(_x_, 10).
488488
1. Let _text_ be StringToCodePoints(_str_).
489489
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>.
491491
1. Let <del>_intlMV_</del><ins>_stringData_</ins> be the StringIntlMV of _literal_.
492492
1. <ins>Let _intlMV_ be _stringData_[0].</ins>
493493
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>
495495
1. <ins>Else,</ins>
496-
1. <ins>Let _stringDigits_ be 0.</ins>
496+
1. <ins>Let _stringDigitCount_ be 0.</ins>
497497
1. If _intlMV_ is a mathematical value, then
498498
1. Let _rounded_ be RoundMVResult(abs(_intlMV_)).
499499
1. <del>If _rounded_ is *+∞*<sub>𝔽</sub> and _intlMV_ &lt; 0, return ~negative-infinity~.</del>
500500
1. <del>If _rounded_ is *+∞*<sub>𝔽</sub>, return ~positive-infinity~.</del>
501501
1. <ins>If _rounded_ is *+∞*<sub>𝔽</sub>, then</ins>
502502
1. <ins>If _intlMV_ &lt; 0, set _intlMV_ to ~negative-infinity~.</ins>
503503
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>
505505
1. <del>If _rounded_ is *+0*<sub>𝔽</sub> and _intlMV_ &lt; 0, return ~negative-zero~.</del>
506506
1. <del>If _rounded_ is *+0*<sub>𝔽</sub>, return 0.</del>
507507
1. <ins>If _rounded_ is *+0*<sub>𝔽</sub>, then</ins>
508508
1. <ins>If _intlMV_ &lt; 0, set _intlMV_ to ~negative-zero~.</ins>
509509
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>.
511511
</emu-alg>
512512
</emu-clause>
513513

@@ -600,14 +600,14 @@ contributors: Eemeli Aro
600600
1. <del>Let _s_ be ! ToString(_n_)</del>
601601
1. <del>Return the Record { [[PluralCategory]]: *"other"*, [[FormattedString]]: _s_ }.</del>
602602
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>
604604
1. <ins>If _x_ is ~not-a-number~, then</ins>
605605
1. <ins>Return the Record { [[PluralCategory]]: *"other"*, [[FormattedString]]: *"NaN"* }</ins>.
606606
1. <ins>Else if _x_ is ~positive-infinity~, then</ins>
607607
1. <ins>Return the Record { [[PluralCategory]]: *"other"*, [[FormattedString]]: *"Infinity"* }.</ins>
608608
1. <ins>Else if _x_ is ~negative-infinity~, then</ins>
609609
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>).
611611
1. Let _s_ be _res_.[[FormattedString]].
612612
1. Let _locale_ be _pluralRules_.[[Locale]].
613613
1. Let _type_ be _pluralRules_.[[Type]].

0 commit comments

Comments
 (0)