Recently, I just upgrade from WAS8.5.5-java6 to WAS9.0-java8. I've experienced an issue of BigDecimal.add method. Below is my unit test code
MathContext context = MathContext.DECIMAL64; BigDecimal p = BigDecimal.valueOf(0.05); BigDecimal result = p.divide(BigDecimal.valueOf(12), context); System.out.println(BigDecimal.ONE.add(result, context));
It will print out as 1.000000000000000 instead of 1.004166666666666667. It worked just fine with WAS8.5.5 and java 6. Why does it cause the issue in java8?