-
Notifications
You must be signed in to change notification settings - Fork 160
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Finalize rounding modes #1038
Comments
The main issue is tc39/proposal-intl-numberformat-v3#7. I made a proposal 14 days ago and am awaiting feedback. |
Meeting, Oct 23: The action here is to make an editorial note in the spec, mentioning that the exact set of rounding modes and strings is intended to be the same as Intl.NumberFormat v3. |
The set of accepted values for roundingMode is intended to be the same as whatever is standardized, not necessarily this particular set of rounding modes and these particular names. See: #1038
I've opened #1051 to add this note. The rest of this issue can be done during Stage 3. |
The set of accepted values for roundingMode is intended to be the same as whatever is standardized, not necessarily this particular set of rounding modes and these particular names. See: #1038
It slipped my notice (hadn't subscribed to tc39/proposal-intl-numberformat-v3#7) that |
I want to note that Temporal currently contains a subset of the proposed Intl.NumberFormat v3 modes. I think this is reasonable to go to Stage 3 with and declare that the design is complete--these are likely the four most useful modes. Additional modes could be added in a follow-on proposal (maybe a PR with consensus, adopted during Stage 3 or after Stage 4, or it could even be part of the Intl.NumberFormat v3 proposal). Additing further modes would be a backwards-compatible change. |
In the ECMA-402 meeting of 2021-02-11, 'nearest' was renamed to 'halfExpand'. By definition, Temporal uses the same names for rounding modes as in that proposal. See: #1038
In the ECMA-402 meeting of 2021-02-11, 'nearest' was renamed to 'halfExpand'. By definition, Temporal uses the same names for rounding modes as in that proposal. See: #1038
The above was done, so I'll move this issue to the Stage 4 to track further Intl.NumberFormat progress. |
Intl.NumberFormat v3 is in Stage 3 now, so the set of rounding modes is finalized. This means we should add |
…t V3 We intend to standardize on the same rounding modes as Intl.NumberFormat (see #1038), so it makes sense to use the same abstract operations, namely GetUnsignedRoundingMode and ApplyUnsignedRoundingMode. Note that this does not yet add user-visible support for the full set of rounding modes that Intl.NumberFormat does; that (#1038) is a normative change that we'll apply once Intl.NumberFormat goes to Stage 4. However, this way of expressing rounding makes it easier to make that change in the future, and makes it easier to address #2191 in the short term. RoundTowardsZero stays the same, since that is used for several other things as well as rounding according to a rounding mode.
…t V3 We intend to standardize on the same rounding modes as Intl.NumberFormat (see #1038), so it makes sense to use the same abstract operations, namely GetUnsignedRoundingMode and ApplyUnsignedRoundingMode. Note that this does not yet add user-visible support for the full set of rounding modes that Intl.NumberFormat does; that (#1038) is a normative change that we'll apply once Intl.NumberFormat goes to Stage 4. However, this way of expressing rounding makes it easier to make that change in the future, and makes it easier to address #2191 in the short term. RoundTowardsZero stays the same, since that is used for several other things as well as rounding according to a rounding mode.
Verify that the rounding modes and their behaviour match NumberFormat, then close. |
This was done in #2262 and now matches the set of rounding modes in NumberFormat V3. |
This is a placeholder issue to remind us that we still need to finalize which rounding modes Temporal will support. If I remember correctly, the plan was to sync the modes and their names with Intl and Decimal.
@sffc, is this coordination something that you're driving?
FWIW, after writing a bunch of test code for rounding, I found myself lamenting that there's no mode that always rounds away from zero, i.e. the opposite of
trunc
. Currently, achieving away-fron-zero rounding is surprisingly difficult because you need conditional code depending on the sign of the result. This seems like a good mode to add if possible.The text was updated successfully, but these errors were encountered: