Skip to content

Commit ceaf8a7

Browse files
committed
Handle multiples of ten
1 parent 138ec53 commit ceaf8a7

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

spec.emu

+5-2
Original file line numberDiff line numberDiff line change
@@ -265,15 +265,18 @@ location: https://github.com/tc39/proposal-decimal/
265265
1. If _argument_ is *+0*<sub>𝔻</sub>, return the string concatenation of _prefix_ and *"0"*.
266266
1. Let _q_ be the largest integer such that _argument_ × 10<sup>−_q_</sup> is an integer.
267267
1. Let _n_ be _argument_ × 10<sup>−_q_</sup>.
268+
1. Let _x_ be floor(_argument_).
269+
1. Let _y_ be _argument_ mod 1.
268270
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.
270273
1. Let _numDigits_ be the length of _digits_.
271274
1. Let _integerPart_ be the substring of _digits_ from 0 to _numDigits_.
272275
1. If _argument_ is an integer, then
273276
1. Assert: _integerPart_ is not *""*.
274277
1. Return _integerPart_.
275278
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_.
277280
1. Let _renderedAbsoluteValue_ be the concatenation of _integerPart_, *"."*, and _nonIntegerPart_.
278281
1. Let _s_ be the concatenation of _prefix_ and _renderedAbsoluteValue_.
279282
1. Return CanonicalizeDecimalString(_s_).

0 commit comments

Comments
 (0)