Skip to content
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

Closed
justingrant opened this issue Oct 22, 2020 · 9 comments
Closed

Finalize rounding modes #1038

justingrant opened this issue Oct 22, 2020 · 9 comments
Labels
documentation Additions to documentation non-prod-polyfill THIS POLYFILL IS NOT FOR PRODUCTION USE! spec-text Specification text involved
Milestone

Comments

@justingrant
Copy link
Collaborator

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.

@justingrant justingrant added this to the Complete design decisions milestone Oct 22, 2020
@sffc
Copy link
Collaborator

sffc commented Oct 22, 2020

The main issue is tc39/proposal-intl-numberformat-v3#7. I made a proposal 14 days ago and am awaiting feedback.

@ptomato ptomato added the spec-text Specification text involved label Oct 23, 2020
@ptomato
Copy link
Collaborator

ptomato commented Oct 23, 2020

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.

ptomato added a commit that referenced this issue Oct 24, 2020
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
@ptomato
Copy link
Collaborator

ptomato commented Oct 24, 2020

I've opened #1051 to add this note. The rest of this issue can be done during Stage 3.

@ptomato ptomato modified the milestones: Stable proposal, Stage 4 Oct 24, 2020
Ms2ger pushed a commit that referenced this issue Oct 26, 2020
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
@ptomato ptomato modified the milestones: Stage 4, Stage 3 Mar 6, 2021
@ptomato ptomato added documentation Additions to documentation non-prod-polyfill THIS POLYFILL IS NOT FOR PRODUCTION USE! labels Mar 6, 2021
@ptomato
Copy link
Collaborator

ptomato commented Mar 6, 2021

It slipped my notice (hadn't subscribed to tc39/proposal-intl-numberformat-v3#7) that nearest was renamed to halfExpand in the 2021-02-11 402 meeting. This particular bit needs to be updated in Temporal before the plenary on Tuesday.

@littledan
Copy link
Member

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.

ptomato added a commit that referenced this issue Mar 9, 2021
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
cjtenny pushed a commit that referenced this issue Mar 9, 2021
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
@ptomato
Copy link
Collaborator

ptomato commented Mar 9, 2021

The above was done, so I'll move this issue to the Stage 4 to track further Intl.NumberFormat progress.

@ptomato ptomato modified the milestones: Stage 3, Stage 4 Mar 9, 2021
@ptomato
Copy link
Collaborator

ptomato commented Apr 5, 2022

Intl.NumberFormat v3 is in Stage 3 now, so the set of rounding modes is finalized. This means we should add expand, halfCeil, halfFloor, halfTrunc, and halfEven to Temporal.

ptomato added a commit that referenced this issue May 18, 2022
…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.
Ms2ger pushed a commit that referenced this issue May 19, 2022
…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.
@ptomato
Copy link
Collaborator

ptomato commented Jan 5, 2023

Verify that the rounding modes and their behaviour match NumberFormat, then close.

@ptomato
Copy link
Collaborator

ptomato commented Jan 5, 2023

This was done in #2262 and now matches the set of rounding modes in NumberFormat V3.

@ptomato ptomato closed this as completed Jan 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Additions to documentation non-prod-polyfill THIS POLYFILL IS NOT FOR PRODUCTION USE! spec-text Specification text involved
Projects
None yet
Development

No branches or pull requests

4 participants