FULL PRODUCT VERSION :
java version "1.5.0_05"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_05-b05)
Java HotSpot(TM) Client VM (build 1.5.0_05-b05, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Linux 2.6.11-6mdk #1 Tue Mar 22 16:04:32 CET 2005 i686 Intel(R) Pentium(R) 4 CPU 2.26GHz unknown GNU/Linux
A DESCRIPTION OF THE PROBLEM :
Dividing ONE with a very high negative scale, by ONE return ZERO
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
(new BigDecimal(BigInteger.ONE, Integer.MIN_VALUE)).divideToIntegralValue(BigDecimal.ONE)
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
1E+2147483648
ACTUAL -
0E+2147483648
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.math.*;
public class BugDivide{
public static void main(String[] args){
System.out.println((new BigDecimal(BigInteger.ONE, Integer.MIN_VALUE)).divideToIntegralValue(BigDecimal.ONE));
}
}
---------- END SOURCE ----------