Java 8 RFR 6480539: BigDecimal.stripTrailingZeros() has no effect on zero itself ("0.0")

Joe Darcy joe.darcy at oracle.com
Wed Jul 3 17:35:47 UTC 2013


Hi Brian,

I have some concerns with this patch.

First, I think the stripTrailingZeros specification should explicitly 
call out what happens with a numerically zero value.

Second, I would have expected the code change to be limited to the 
stripTrailingZeros method. The private createAndStripZerosToMatchScale 
methods are used during rounding operations and unconditionally set the 
scale of a zero value to zero, which is incorrect according to the 
specification.

I believe sufficiently thorough tests of divide should fail with the 
current changes to createAndStripZerosToMatchScale.

Cheers,

-Joe

On 07/03/2013 08:46 AM, Brian Burkhalter wrote:
> Hello,
>
> The patch here
>
> http://cr.openjdk.java.net/~bpb/6480539/
>
> is proposed to resolve this issue
>
> http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6480539
>
> which was most recently discussed in this thread
>
> http://mail.openjdk.java.net/pipermail/core-libs-dev/2013-February/014252.html
>
> The proposed fix in this prior thread is withdrawn.
>
> Thanks,
>
> Brian




More information about the core-libs-dev mailing list