RFR: 8262744: Formatter '%g' conversion uses wrong format for BigDecimal rounding up to limits [v2]
igraves at openjdk.java.net
Fri Apr 16 16:14:42 UTC 2021
On Fri, 16 Apr 2021 14:26:58 GMT, Roger Riggs <rriggs 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
> src/java.base/share/classes/java/util/Formatter.java line 3826:
>> 3824: BigDecimal tenToTheNegFour = BigDecimal.valueOf(1, 4);
>> 3825: BigDecimal tenToThePrec = BigDecimal.valueOf(1, -prec);
>> 3826: value = value.round(new MathContext(prec));
> While you are in the area, how about inlining the creation of the tenToTheNegFour and tenToThePrec values.
> They are used only once and may not be used at all. They don't appear to be needed except for the comparisons.
Makes sense to me.
More information about the core-libs-dev