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

Finish compact decimal formatting #3647

Open
sffc opened this issue Jul 7, 2023 · 1 comment
Open

Finish compact decimal formatting #3647

sffc opened this issue Jul 7, 2023 · 1 comment
Assignees
Labels
C-numbers Component: Numbers, units, currencies U-ecma402 User: ECMA-402 compatibility

Comments

@sffc
Copy link
Member

sffc commented Jul 7, 2023

We have formatting from integers. We need to add it from general FixedDecmial & f64 and add support for currencies.

@sffc
Copy link
Member Author

sffc commented Jul 7, 2023

Note that there are two places where floating point numbers are rounded: first in the conversion of the floating point number to the shortest decimal string, and second when performing the user-visible rounding logic.

Discussion about double rounding:

  • @sffc - Double-rounding is specified here in EMCA-402. In ECMAScript, a way to rationalize this is that floating point numbers are seen as compact representations of decimal numbers, so this operation is simply a function in the 1:1 mapping.
  • @eggrobin - In the general case, that rationalization is not applicable. But, in the case of number formatting in ICU4X, this is a definite edge case. We could say that we can change the behavior here in the future if desired. I don't want to tie ourselves to the ECMA double rounding standard.

Consensus: For now, implement compact rounding with the ECMA-style double rounding, but leave open the door to do it differently in the future.

LGTM: @eggrobin @sffc @skius @younies

@sffc sffc added the C-numbers Component: Numbers, units, currencies label Jul 7, 2023
@sffc sffc added this to the 1.x Priority ⟨P2⟩ milestone Jul 27, 2023
@sffc sffc assigned sffc and younies Jul 27, 2023
@hsivonen hsivonen added the U-ecma402 User: ECMA-402 compatibility label Aug 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-numbers Component: Numbers, units, currencies U-ecma402 User: ECMA-402 compatibility
Projects
None yet
Development

No branches or pull requests

3 participants