Name: jl125535 Date: 04/23/2002
FULL PRODUCT VERSION :
$ java -version
java version "1.4.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-b92)
Java HotSpot(TM) Client VM (build 1.4.0-b92, mixed mode)
FULL OPERATING SYSTEM VERSION :
Win2k
A DESCRIPTION OF THE PROBLEM :
java.math.BigX contains methods of the form "BigInteger
add(BigInteger)". They should be of the form "Number
add(Number)" allowing BigDecimals and BigIntegers to play
nicely together. This will require a redesign.
This bug can be reproduced occasionally.
CUSTOMER WORKAROUND :
if (lvalue instanceof BigInteger) {
if (rvalue instanceof BigInteger) {
lvalue =
((BigInteger)lvalue).add((BigInteger)rvalue);
} else {
lvalue = (new
BigDecimal(lvalue)).add((BigDecimal)rvalue);
}
} else {
if (rvalue instanceof BigInteger) {
lvalue = ((BigDecimal)lvalue)
.add(new BigDecimal((BigInteger)rvalue));
} else {
lvalue =
((BigDecimal)lvalue).add((BigDecimal)rvalue);
}
}
(Review ID: 145732)
======================================================================