<i18n dev> RFR: 8281317: CompactNumberFormat displays 4-digit values when rounding to a new range [v2]

Naoto Sato naoto at openjdk.java.net
Tue Feb 15 22:35:10 UTC 2022


On Tue, 15 Feb 2022 21:59:42 GMT, Joe Wang <joehw at openjdk.org> wrote:

>> Naoto Sato has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Addressing review comments
>
> src/java.base/share/classes/java/text/CompactNumberFormat.java line 595:
> 
>> 593:                 divisor = (Long) divisors.get(++compactDataIndex);
>> 594:                 iPart = getIntegerPart(number, divisor);
>> 595:             }
> 
> This and the few lines surrounding it were duplicated. Might be worth considering consolidation.

Right. In fact, I tried to converge them but ended up not to, as there are slight differences for each number type.

> test/jdk/java/text/Format/CompactNumberFormat/TestCompactPatternsValidity.java line 106:
> 
>> 104:             {COMPACT_PATTERN8, List.of(new BigInteger("223565686837667632"), new BigDecimal("12322456774334.89766"), 30000, 3456.78,
>> 105:                     new BigInteger("999999999999"), new BigDecimal("999999999999.0"), 999_999),
>> 106:                     List.of("223566T", "12T", "30K", "3K", "1T", "1T", "1M")},
> 
> The case where 999_999_999 was formatted to 1000 million and now 1 billion may be added too.

Sure, added the 1 bil test case.

-------------

PR: https://git.openjdk.java.net/jdk/pull/7412


More information about the i18n-dev mailing list