Skip to content
This repository has been 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
sffc opened this issue Apr 20, 2018 · 0 comments
Closed

Comments

@sffc
Copy link
Collaborator

sffc commented Apr 20, 2018

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.

@sffc sffc closed this as completed in bc60035 Oct 24, 2018
sffc added a commit that referenced this issue Oct 24, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant