-
Notifications
You must be signed in to change notification settings - Fork 174
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
Support number format digit options for PluralRules #3929
Comments
We support these already:
The following can be implemented fairly easily in wrapper code, but it may still be useful to move them into the library:
The following is less trivial to implement in user code so should definitely land in ICU4X:
|
I made an issue #3942 in order to make an API that more directly handles the rounding-related ECMA-402 options listed above (which I think is all but trailingZeroDisplay). |
FWIW, most of the options were very straightforward to apply: However, I couldn't find a way to apply the let increment: FixedDecimal = FixedDecimal::from(_rounding_increment).multiplied_pow10(-max_fraction);
number /= increment;
round(number, 0, rounding_mode);
number *= increment; and that is essentially what ICU4C does: |
Yeah, It would be an excellent first issue for someone to write the following API: pub enum RoundingIncrement {
I1, I2, I5, I10, I20, I25, I50, I100, I200, I250, I500, I1000, I2000, I2500, I5000
}
impl FixedDecimal {
pub fn round_half_even_with_increment(&mut self, position: i16, increment: RoundingIncrement) { ... }
} Come to think of it, we should really only need |
Discussion from team meeting on 2023-10-26:
Conclusion: LGTM: @sffc (@robertbastian) (@Manishearth) Enum values: enum RoundingIncrement {
#[default]
MultiplesOf1,
MultiplesOf2,
MultiplesOf5,
MultiplesOf25,
} LGTM: @sffc @robertbastian (@Manishearth) |
@jedel1043 merged Another thing I'd like us to measure is whether the new rounding increment code has an impact on the performance of the |
Just wanted to notify that I have in the queue a PR for |
Fantastic! Just to highlight as part of your testing in the |
Currently, the options from https://tc39.es/ecma402/#sec-setnfdigitoptions are unsupported. These are:
These need to be supported for ECMA-402 compat.
The text was updated successfully, but these errors were encountered: