<i18n dev> RFR: 8338690: CompactNumberInstance.format incorrectly formats some numbers (few vs many)
Naoto Sato
naoto at openjdk.org
Fri Aug 23 21:18:03 UTC 2024
On Fri, 23 Aug 2024 19:01:11 GMT, Roger Riggs <rriggs at openjdk.org> wrote:
>> 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?
>
> I guess the range of the divisor may be bigger than a long.
That is my thinking too. Compact format is supposed to deal with big numbers, it can go beyond the range of a long.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/20680#discussion_r1729523116
More information about the i18n-dev
mailing list