You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
1. Let _scaledV_ be _d_ × 10<sup>_numDigits_</sup>.
990
990
1. Let _roundedScaledV_ be ApplyRoundingModeToPositive(_scaledV_, _roundingMode_).
991
-
1. Let _s_ be the unique decimal string representation of _roundedScaledV_ without leading zeroes.
992
-
1. Let _integerDigits_ be _s_.
993
-
1. Let _nonIntegerDigits_ be *""*.
994
-
1. If _s_ contains an occurrence of *"."*, then
995
-
1. Let _i_ be the index of the first occurrence of *"."* in _s_.
996
-
1. Set _integerDigits_ to the substring of _s_ from 0 to _i_.
997
-
1. Set _nonIntegerDigits_ to the substring of _s_ from _i_ + 1.
998
-
1. If _numDigits_ = 0, return _integerDigits_.
999
-
1. Let _numNonIntegerDigits_ be the length of _nonIntegerDigits_.
1000
-
1. If the _numNonIntegerDigits_ < _numDigits_, then
1001
-
1. Let _additionalZeroes_ be the string *"0"* repeated _numDigits_ - _numNonIntegerDigits_ times.
1002
-
1. Set _nonIntegerDigits_ to the concatenation of _nonIntegerDigits_ and _additionalZeroes_.
1003
-
1. Else if _numNonIntegerDigits_ > _numDigits_, then
1004
-
1. Set _nonIntegerDigits_ to the substring of _nonIntegerDigits_ from 0 to _numDigits_.
1005
-
1. Return the concatenation of _signPrefix_, _integerDigits_, *"."*, and _nonIntegerDigits_.
991
+
1. Let _remainder_ be _scaledV_ - _roundedScaledV_.
992
+
1. Let _remainderStr_ be Decimal128ToDecimalString(_remainder_).
993
+
1. Let _integerDigits_ be the unique decimal string representation of _roundedScaledV_ without leading zeroes.
994
+
1. Let _nonIntegerDigits_ be the substring of _remainderStr_ from 0 to _numDigits_ + 1.
995
+
1. Let _s_ be the concatenation of _signPrefix_, _integerDigits_, *"."*, and _nonIntegerDigits_.
996
+
1. Return CanonicalizeDecimalString(_s_).
1006
997
</emu-alg>
1007
998
<emu-note>
1008
999
<p>This operation follows the specification of the conversion of IEEE 754-2019 Decimal128 values to strings (external character sequences) discussed in Section 5.12 of <emu-xref href="#sec-bibliography">IEEE 754-2019</emu-xref>.</p>
0 commit comments