Skip to content

Commit

Permalink
toFixed: Permit a rounding mode option
Browse files Browse the repository at this point in the history
  • Loading branch information
jessealama committed Jul 31, 2024
1 parent 86b8439 commit ced972c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions spec.emu
Original file line number Diff line number Diff line change
Expand Up @@ -1130,12 +1130,17 @@ location: https://github.com/tc39/proposal-decimal/
1. Let _O_ be the *this* value.
1. Perform ? RequireInternalSlot(_O_, [[Decimal128Data]]).
1. Let _numDigits_ be *+0*<sub>𝔽</sub>.
1. Let _roundingMode_ be *undefined*.
1. If _options_ is not *undefined*, then
1. If _options_ is not an Object, throw a *TypeError* exception.
1. Set _numDigits_ to ? Get(_options_, *"digits"*).
1. If _numDigits_ is not a Number, throw a *TypeError* exception.
1. Set _roundingMode_ to ? Get(_options_, *"roundingMode"*).
1. If _numDigits_ < 0, throw a *RangeError* exception.
1. If _numDigits_ is not an integer, throw a *RangeError* exception.
1. If _roundingMode_ is *undefined*, set _roundingMode_ to *"halfEven"*.
1. Else if _roundingMode_ is not a String, throw a *TypeError* exception.
1. Else if _roundingMode_ is not a <emu-xref href="#dfn-decimal128-rounding-mode">Decimal128 rounding mode</emu-xref>, throw a *RangeError* exception.
1. Let _s_ be Decimal128ToDecimalString(_O_, *false*).
1. If _s_ is *"NaN"*, *"Infinity"*, or *"-Infinity"*, return _s_.
1. Let _integerDigits_ be *""*.
Expand Down

0 comments on commit ced972c

Please sign in to comment.