This repository was archived by the owner on Jan 26, 2022. It is now read-only.
This repository was archived by the owner on Jan 26, 2022. It is now read-only.
Task: Allow significant digits rounding to use minimum integer digits #2
Closed
Description
In this section:
<emu-clause id="sec-formatnumberstring" aoid="FormatNumberToString">
<h1>FormatNumberToString ( _intlObject_, _x_ )</h1>
<p>
The FormatNumberToString abstract operation is called with arguments _intlObject_ (which must be an object with [[MinimumSignificantDigits]], [[MaximumSignificantDigits]], [[MinimumIntegerDigits]], [[MinimumFractionDigits]], and [[MaximumFractionDigits]] internal slots), and _x_ (which must be a Number value), and returns _x_ as a string value with digits formatted according to the five formatting parameters.
</p>
<emu-alg>
1. If _intlObject_.[[MinimumSignificantDigits]] and _intlObject_.[[MaximumSignificantDigits]] are both not *undefined*, then
1. Let _result_ be ToRawPrecision(_x_, _intlObject_.[[MinimumSignificantDigits]], _intlObject_.[[MaximumSignificantDigits]]).
1. Else,
1. Let _result_ be ToRawFixed(_x_, _intlObject_.[[MinimumIntegerDigits]], _intlObject_.[[MinimumFractionDigits]], _intlObject_.[[MaximumFractionDigits]]).
1. Return _result_.
</emu-alg>
</emu-clause>
MinimumIntegerDigits
is used in ToRawFixed
but not ToRawPrecision
. Since it does not affect rounding behavior, MinimumIntegerDigits
should be removed from ToRawFixed
and should be applied to the string result
after the two helper methods perform their rounding operation.
Metadata
Metadata
Assignees
Labels
No labels