<i18n dev> RFR: 8262744: Formatter '%g' conversion uses wrong format for BigDecimal rounding up to limits [v2]

Ian Graves igraves at openjdk.java.net
Wed Apr 7 03:00:36 UTC 2021


On Tue, 6 Apr 2021 22:56:22 GMT, Joe Darcy <darcy at openjdk.org> wrote:

>> Ian Graves has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Adding BigDecimal equivalents to tests
>
> test/jdk/java/util/Formatter/BigDecimalRounding.java line 44:
> 
>> 42:     public static void testBigDecimalRounding() {
>> 43:         var res1 = String.format("%g", 0.00009999999999999995);
>> 44:         var res2 = String.format("%g", 0.00009999999f);
> 
> To avoid possible vagaries in decimal -> binary conversion of double values, I suggest also testing against a BigDecimal directly rounded to the precision in question.

Good thought, thanks.

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

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


More information about the i18n-dev mailing list