Skip to content

Commit

Permalink
Handle multiples of ten
Browse files Browse the repository at this point in the history
  • Loading branch information
jessealama committed Dec 11, 2024
1 parent 138ec53 commit ceaf8a7
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions spec.emu
Original file line number Diff line number Diff line change
Expand Up @@ -265,15 +265,18 @@ location: https://github.com/tc39/proposal-decimal/
1. If _argument_ is *+0*<sub>𝔻</sub>, return the string concatenation of _prefix_ and *"0"*.
1. Let _q_ be the largest integer such that _argument_ × 10<sup>−_q_</sup> is an integer.
1. Let _n_ be _argument_ × 10<sup>−_q_</sup>.
1. Let _x_ be floor(_argument_).
1. Let _y_ be _argument_ mod 1.
1. Assert: 0 < _n_ < 10<sup>34</sup>.
1. Let _digits_ be the unique decimal string representation of _n_ without leading zeroes.
1. Let _digits_ be the unique decimal string representation of _x_ without leading zeroes.
1. If _y_ = 0, let _fractionalPart_ be *""*, else let _fractionalPart_ be the unique decimal string representation of _y_ without leading zeroes.
1. Let _numDigits_ be the length of _digits_.
1. Let _integerPart_ be the substring of _digits_ from 0 to _numDigits_.
1. If _argument_ is an integer, then
1. Assert: _integerPart_ is not *""*.
1. Return _integerPart_.
1. If _integerPart_ is *""*, set _integerPart_ to *"0"*.
1. Let _nonIntegerPart_ be the substring of _digits_ from _numDigits_.
1. Let _nonIntegerPart_ be the substring of _fractionalPart_ from 0 to _numDigits_.
1. Let _renderedAbsoluteValue_ be the concatenation of _integerPart_, *"."*, and _nonIntegerPart_.
1. Let _s_ be the concatenation of _prefix_ and _renderedAbsoluteValue_.
1. Return CanonicalizeDecimalString(_s_).
Expand Down

0 comments on commit ceaf8a7

Please sign in to comment.