6480539: BigDecimal.stripTrailingZeros() should specify no-op on zero BigDecimals (original) (raw)

Brian Burkhalter brian.burkhalter at oracle.com
Mon Feb 4 18:09:39 UTC 2013


Hi,

While stripTrailingZeros() should perhaps for purity of specification always return BigDecimal.ZERO for anything which is numerically equal to zero, the present behavior of this method has been extant for some years, so following the prevailing convention it would be preferable to modify the specification to match the behavior.

Proposed change:

diff -r 20eeb727d171 -r 8789e8736763 src/share/classes/java/math/BigDecimal.java --- a/src/share/classes/java/math/BigDecimal.java Fri Feb 01 16:32:53 2013 -0800 +++ b/src/share/classes/java/math/BigDecimal.java Fri Feb 01 16:32:53 2013 -0800 @@ -2589,7 +2589,9 @@ * the {@code BigDecimal} value {@code 600.0}, which has * [{@code BigInteger}, {@code scale}] components equals to * [6000, 1], yields {@code 6E2} with [{@code BigInteger},

Thanks,

Brian



More information about the core-libs-dev mailing list