-
Notifications
You must be signed in to change notification settings - Fork 12
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
Throw roundingIncrement if maximumFractionDigits is not 0 #81
Comments
I agree that this is an area we could change, but I think I would prefer adjusting the options after reading them, rather than throwing an exception. The reason is that there is actually a use case for this: |
The behavior I'd propose to fix this and other issues is this: If This is a requirement that could be relaxed in the future once ICU supports it in the skeleton (https://unicode-org.atlassian.net/browse/ICU-21866). I believe this new requirement fixes Frank's issue in the OP, and it is also a workaround to make this proposal implementable with ICU 70. |
I do not mind you ALSO propose that, but how would that change the fact that {roundingIncrement:5, maximumFractionDigits:0 } is the same as ??? since minimumFractionDigits is neither in these options. I do not think your proposal can solve this issue. It could solve the other issue only. |
With my proposed requirement, all of those options bags except the first one would be illegal, because |
you missed my point, then how about |
Those are different, because they result in different numbers of trailing zeros. "5" != "5.0" != "5.00" != "5.000" |
ok, I missed that. |
If we want to avoid the exception and perhaps be more forward-compatible, I'm also happy to just set minimumFractionDigits to maximumFractionDigits when roundingIncrement is used. |
2021-01-13 discussion: https://github.com/tc39/ecma402/blob/master/meetings/notes-2022-01-13.md#throw-roundingincrement-if-maximumfractiondigits-is-not-0-81 Conclusion: Do as I proposed above and require minFrac=maxFrac when roundingIncrement is being used. |
We currently read the roundingIncrement the following
https://tc39.es/proposal-intl-numberformat-v3/out/numberformat/proposed.html
But {roundingIncrement:5, maximumFractionDigits:0 } is the same as
{roundingIncrement:50, maximumFractionDigits:1 } and
{roundingIncrement:500, maximumFractionDigits:2 } and
{roundingIncrement:5000, maximumFractionDigits:3 }
How about we ALSO ADD the following AFTER the above lines
This will ensure these values of roundingIncrement will not be used while not needed.
so while maximumFractionDigits > 0, roundingIncrement can only be 1, 2, 5, 25 . In this way, we disallow different combination of roundingIncrement+maximumFractionDigits produce the same result.
@sffc
The text was updated successfully, but these errors were encountered: