|
77 | 77 | 1. Let _mxfdDefault_ be 0.
|
78 | 78 | 1. Else,
|
79 | 79 | 1. Let _mxfdDefault_ be 3.
|
80 |
| - 1. <ins class="block">Let _roundingIncrement_ be ? GetNumberOption(_options_, *"roundingIncrement"*, 1, 5000, 1).</ins> |
81 |
| - 1. <ins class="block">If _roundingIncrement_ is not in « 1, 2, 5, 10, 20, 25, 50, 100, 200, 250, 500, 1000, 2000, 2500, 5000 », throw a *RangeError* exception.</ins> |
82 |
| - 1. <ins class="block">If _roundingIncrement_ is not 1, set _mxfdDefault_ to _mnfdDefault_.</ins> |
83 | 80 | 1. Let _notation_ be ? GetOption(_options_, *"notation"*, ~string~, « *"standard"*, *"scientific"*, *"engineering"*, *"compact"* », *"standard"*).
|
84 | 81 | 1. Set _numberFormat_.[[Notation]] to _notation_.
|
85 | 82 | 1. Perform ? SetNumberFormatDigitOptions(_numberFormat_, _options_, _mnfdDefault_, _mxfdDefault_, _notation_).
|
86 |
| - 1. <ins class="block">If _roundingIncrement_ is not 1, then</ins> |
87 |
| - 1. <ins class="block">If _numberFormat_.[[RoundingType]] is not ~fractionDigits~, throw a *TypeError* exception.</ins> |
88 |
| - 1. <ins class="block">If _numberFormat_.[[MaximumFractionDigits]] is not equal to _numberFormat_.[[MinimumFractionDigits]], throw a *RangeError* exception.</ins> |
89 |
| - 1. <ins class="block">Set _numberFormat_.[[RoundingIncrement]] to _roundingIncrement_.</ins> |
90 |
| - 1. <ins class="block">Let _trailingZeroDisplay_ be ? GetOption(_options_, *"trailingZeroDisplay"*, ~string~, « *"auto"*, *"stripIfInteger"* », *"auto"*).</ins> |
91 |
| - 1. <ins class="block">Set _numberFormat_.[[TrailingZeroDisplay]] to _trailingZeroDisplay_.</ins> |
92 | 83 | 1. Let _compactDisplay_ be ? GetOption(_options_, *"compactDisplay"*, ~string~, « *"short"*, *"long"* », *"short"*).
|
93 | 84 | 1. <ins class="block">Let _defaultUseGrouping_ be *"auto"*.</ins>
|
94 | 85 | 1. If _notation_ is *"compact"*, then
|
|
98 | 89 | 1. Set _numberFormat_.[[UseGrouping]] to _useGrouping_.
|
99 | 90 | 1. Let _signDisplay_ be ? GetOption(_options_, *"signDisplay"*, ~string~, « *"auto"*, *"never"*, *"always"*, *"exceptZero"*<ins>, *"negative"*</ins> », *"auto"*).
|
100 | 91 | 1. Set _numberFormat_.[[SignDisplay]] to _signDisplay_.
|
101 |
| - 1. <ins class="block">Let _roundingMode_ be ? GetOption(_options_, *"roundingMode"*, ~string~, « *"ceil"*, *"floor"*, *"expand"*, *"trunc"*, *"halfCeil"*, *"halfFloor"*, *"halfExpand"*, *"halfTrunc"*, *"halfEven"* », *"halfExpand"*).</ins> |
102 |
| - 1. <ins class="block">Set _numberFormat_.[[RoundingMode]] to _roundingMode_.</ins> |
103 | 92 | 1. Return _numberFormat_.
|
104 | 93 | </emu-alg>
|
105 | 94 | </emu-clause>
|
|
110 | 99 | <p>
|
111 | 100 | The abstract operation SetNumberFormatDigitOptions applies digit
|
112 | 101 | options used for number formatting onto the intl object.
|
| 102 | + <ins>It is used by both Intl.NumberFormat and Intl.PluralRules.</ins> |
113 | 103 | </p>
|
114 | 104 | <emu-alg>
|
115 | 105 | 1. Let _mnid_ be ? GetNumberOption(_options_, *"minimumIntegerDigits,"*, 1, 21, 1).
|
|
119 | 109 | 1. Let _mxsd_ be ? Get(_options_, *"maximumSignificantDigits"*).
|
120 | 110 | 1. Set _intlObj_.[[MinimumIntegerDigits]] to _mnid_.
|
121 | 111 | 1. <ins class="block">Let _roundingPriority_ be ? GetOption(_options_, *"roundingPriority"*, ~string~, « *"auto"*, *"morePrecision"*, *"lessPrecision"* », *"auto"*).</ins>
|
| 112 | + 1. <ins class="block">Let _roundingIncrement_ be ? GetNumberOption(_options_, *"roundingIncrement"*, 1, 5000, 1).</ins> |
| 113 | + 1. <ins class="block">If _roundingIncrement_ is not in « 1, 2, 5, 10, 20, 25, 50, 100, 200, 250, 500, 1000, 2000, 2500, 5000 », throw a *RangeError* exception.</ins> |
| 114 | + 1. <ins class="block">Let _roundingMode_ be ? GetOption(_options_, *"roundingMode"*, ~string~, « *"ceil"*, *"floor"*, *"expand"*, *"trunc"*, *"halfCeil"*, *"halfFloor"*, *"halfExpand"*, *"halfTrunc"*, *"halfEven"* », *"halfExpand"*).</ins> |
| 115 | + 1. <ins class="block">Let _trailingZeroDisplay_ be ? GetOption(_options_, *"trailingZeroDisplay"*, ~string~, « *"auto"*, *"stripIfInteger"* », *"auto"*).</ins> |
| 116 | + 1. <ins class="block">NOTE: All fields required by SetNumberFormatDigitOptions have now been read from _options_. The remainder of this AO interprets the options and may throw exceptions.</ins> |
| 117 | + 1. <ins class="block">If _roundingIncrement_ is not 1, set _mxfdDefault_ to _mnfdDefault_.</ins> |
| 118 | + 1. <ins class="block">Set _intlObj_.[[RoundingIncrement]] to _roundingIncrement_.</ins> |
| 119 | + 1. <ins class="block">Set _intlObj_.[[RoundingMode]] to _roundingMode_.</ins> |
| 120 | + 1. <ins class="block">Set _intlObj_.[[TrailingZeroDisplay]] to _trailingZeroDisplay_.</ins> |
122 | 121 | 1. If _mnsd_ is not *undefined* or _mxsd_ is not *undefined*, then
|
123 | 122 | 1. Let _hasSd_ be *true*.
|
124 | 123 | 1. Else,
|
|
181 | 180 | 1. <ins class="block">Set _intlObj_.[[MaximumFractionDigits]] to 0.</ins>
|
182 | 181 | 1. <ins class="block">Set _intlObj_.[[MinimumSignificantDigits]] to 1.</ins>
|
183 | 182 | 1. <ins class="block">Set _intlObj_.[[MaximumSignificantDigits]] to 2.</ins>
|
| 183 | + 1. <ins class="block">If _roundingIncrement_ is not 1, then</ins> |
| 184 | + 1. <ins class="block">If _intlObj_.[[RoundingType]] is not ~fractionDigits~, throw a *TypeError* exception.</ins> |
| 185 | + 1. <ins class="block">If _intlObj_.[[MaximumFractionDigits]] is not equal to _intlObj_.[[MinimumFractionDigits]], throw a *RangeError* exception.</ins> |
184 | 186 | </emu-alg>
|
185 | 187 | </emu-clause>
|
186 | 188 |
|
|
554 | 556 | [[SignDisplay]] is one of the String values *"auto"*, *"always"*, *"never"*, <del>or</del> *"exceptZero"*, <ins>or *"negative"*</ins>, specifying <del>whether to show the sign on negative numbers only, positive and negative numbers including zero, neither positive nor negative numbers, or positive and negative numbers but not zero</del> <ins>when to include a sign (with non-*"auto"* options respectively corresponding with inclusion always, never, only for nonzero numbers, or only for nonzero negative numbers)</ins>.
|
555 | 557 | In scientific notation, this slot affects the sign display of the mantissa but not the exponent.
|
556 | 558 | </li>
|
557 |
| - <li><ins class="block">[[RoundingMode]] is one of the String values in the *Identifier* column of <emu-xref href="#table-intl-rounding-modes"></emu-xref>, specifying the rounding strategy for the number.</ins></li> |
| 559 | + <li><ins class="block">[[RoundingMode]] is one of the String values in the Identifier column of <emu-xref href="#table-intl-rounding-modes"></emu-xref>, specifying which rounding mode to use.</ins></li> |
558 | 560 | <li><ins class="block">[[RoundingIncrement]] is an integer-valued Number that evenly divides 10, 100, 1000, or 10000 into tenths, fifths, quarters, or halves. It indicates the increment at which rounding should take place relative to the calculated rounding magnitude. For example, if [[MaximumFractionDigits]] is 2 and [[RoundingIncrement]] is 5, then the number is rounded to the nearest 0.05 ("nickel rounding").</ins></li>
|
559 | 561 | <li><ins class="block">[[TrailingZeroDisplay]] is one of the String values *"auto"* or *"stripIfInteger"*, indicating whether to strip trailing zeros if the formatted number is an integer (i.e., has no nonzero fraction digit).</ins></li>
|
560 | 562 | </ul>
|
|
0 commit comments