RFR: 8338690: CompactNumberInstance.format incorrectly formats some numbers (few vs many)
Roger Riggs
rriggs at openjdk.org
Fri Aug 23 18:08:04 UTC 2024
On Thu, 22 Aug 2024 16:14:08 GMT, Naoto Sato <naoto at openjdk.org> wrote:
> Fixing an issue wrt wrong plural suffix with compact format for some locales. It was retrieving the suffix based on the value before the rounding, which ended up in wrong plural expression.
src/java.base/share/classes/java/text/CompactNumberFormat.java line 905:
> 903: divisor = divisors.get(++compactDataIndex);
> 904: }
> 905: var noFraction = number.mod(new BigInteger(divisor.toString()))
Why not create the BigInteger from the `divisor.longValue()`.
I see the pattern formatting to a string and BigInteger re-parsing it but why?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/20680#discussion_r1729330940
More information about the core-libs-dev
mailing list