@@ -412,6 +412,31 @@ location: https://github.com/tc39/proposal-decimal/
412412 <p>Decimal.Amount values are intended to contain a Decimal value together with a precision, as well as information about how the precision that number should be understood. The two ways precision can be understood are in terms of fractional digits and significant digits.</p>
413413 </emu-intro>
414414
415+ <emu-clause id="sec-decimal-amount-abstract-ops">
416+ <h1>Abstract Operations</h1>
417+ <emu-clause id="sec-decimal-amount-create-decimal-armount" type="abstract operation">
418+ <h1>
419+ CreateDecimalAmount (
420+ _value_ : a Decimal value,
421+ _digits_ : a mathematical value
422+ ): a Decimal.Amount object
423+ </h1>
424+ <dl class="header">
425+ <dt>description</dt>
426+ <dd>It creates a Decimal.Amount object having the given value with the given number of significant digits.</dd>
427+ </dl>
428+ <emu-alg>
429+ 1. Assert: _digits_ is an integer.
430+ 1. Assert: 0 ≤ _digits_.
431+ 1. Assert: _digits_ ≤ 34.
432+ 1. Let _O_ be ! OrdinaryCreateFromConstructor(%DecimalAmount%, *"%DecimalAmount.prototype%"*, « [[DecimalAmountData]], [[DecimalAmountSignificantDigits]] »).
433+ 1. Set _O_.[[DecimalAmountData]] to _value_.
434+ 1. Set _O_.[[DecimalAmountSignificantDigits]] to _digits_.
435+ 1. Return _O_.
436+ </emu-alg>
437+ </emu-clause>
438+ </emu-clause>
439+
415440 <emu-clause id="sec-the-decimal-amount-constructor">
416441 <h1>The Decimal.Amount Constructor</h1>
417442 <p>The Decimal.Amount constructor:</p>
@@ -432,10 +457,7 @@ location: https://github.com/tc39/proposal-decimal/
432457 1. If ℝ(_precision_) is not an integer, throw a *RangeError* exception.
433458 1. If ℝ(_precision_) > 34, throw a *RangeError* exception.
434459 1. Let _decimal_ be ? Construct(%Decimal%, _s_).
435- 1. Let _O_ be ? OrdinaryCreateFromConstructor(NewTarget, *"%DecimalAmount.prototype%"*, « [[DecimalAmountData]], [[DecimalAmountSignificantDigits]] »).
436- 1. Set _O_.[[DecimalAmountData]] to _decimal_.[[DecimalData]].
437- 1. Set _O_.[[DecimalAmountSignificantDigits]] to _precision_.
438- 1. Return _O_.
460+ 1. Return CreateDecimalAmount (_decimal_.[[DecimalData]], ℝ(_precision_)).
439461 </emu-alg>
440462 </emu-clause>
441463 </emu-clause>
@@ -1120,11 +1142,10 @@ location: https://github.com/tc39/proposal-decimal/
11201142 1. Let _d_ be _O_.[[DecimalData]].
11211143 1. Assert: _d_ is a mathematical value.
11221144 1. If _d_ = 0, return ? Construct(%DecimalAmount%, « *"0", _n_ * »).
1123- 1. Let _s_ be DecimalToDecimalString(_d_).
11241145 1. Let _l_ be log-10 of |_d_|.
11251146 1. Let _numIntegerDigits_ be _l_ + 1.
11261147 1. Let _newPrecision_ be _numIntegerDigits_ - ℝ(_n_).
1127- 1. Return ? Construct(%DecimalAmount%, « _s_, 𝔽( _newPrecision_) » ).
1148+ 1. Return CreateDecimalAmount(_d_, _newPrecision_).
11281149 </emu-alg>
11291150 </emu-clause>
11301151
@@ -1135,9 +1156,12 @@ location: https://github.com/tc39/proposal-decimal/
11351156 <emu-alg>
11361157 1. Let _O_ be the *this* value.
11371158 1. Perform ? RequireInternalSlot(_O_, [[DecimalData]]).
1159+ 1. If _n_ is not a Number, throw a *TypeError* exception.
1160+ 1. If ℝ(_n_) < 0, throw a *RangeError* exception.
1161+ 1. If ℝ(_n_) is not an integer, throw a *RangeError* exception.
1162+ 1. If ℝ(_n_) > 34, throw a *RangeError* exception.
11381163 1. Let _d_ be _O_.[[DecimalData]].
1139- 1. Let _s_ be DecimalToDecimalString(_d_).
1140- 1. Return ? Construct(%DecimalAmount%, « _s_, _n_ »).
1164+ 1. Return CreateDecimalAmount(_d_, ℝ(_n_)).
11411165 </emu-alg>
11421166 </emu-clause>
11431167
0 commit comments