@@ -265,15 +265,18 @@ location: https://github.com/tc39/proposal-decimal/
265
265
1. If _argument_ is *+0*<sub>𝔻</sub>, return the string concatenation of _prefix_ and *"0"*.
266
266
1. Let _q_ be the largest integer such that _argument_ × 10<sup>−_q_</sup> is an integer.
267
267
1. Let _n_ be _argument_ × 10<sup>−_q_</sup>.
268
+ 1. Let _x_ be floor(_argument_).
269
+ 1. Let _y_ be _argument_ mod 1.
268
270
1. Assert: 0 < _n_ < 10<sup>34</sup>.
269
- 1. Let _digits_ be the unique decimal string representation of _n_ without leading zeroes.
271
+ 1. Let _digits_ be the unique decimal string representation of _x_ without leading zeroes.
272
+ 1. If _y_ = 0, let _fractionalPart_ be *""*, else let _fractionalPart_ be the unique decimal string representation of _y_ without leading zeroes.
270
273
1. Let _numDigits_ be the length of _digits_.
271
274
1. Let _integerPart_ be the substring of _digits_ from 0 to _numDigits_.
272
275
1. If _argument_ is an integer, then
273
276
1. Assert: _integerPart_ is not *""*.
274
277
1. Return _integerPart_.
275
278
1. If _integerPart_ is *""*, set _integerPart_ to *"0"*.
276
- 1. Let _nonIntegerPart_ be the substring of _digits_ from _numDigits_.
279
+ 1. Let _nonIntegerPart_ be the substring of _fractionalPart_ from 0 to _numDigits_.
277
280
1. Let _renderedAbsoluteValue_ be the concatenation of _integerPart_, *"."*, and _nonIntegerPart_.
278
281
1. Let _s_ be the concatenation of _prefix_ and _renderedAbsoluteValue_.
279
282
1. Return CanonicalizeDecimalString(_s_).
0 commit comments