https://bz.apache.org/bugzilla/show_bug.cgi?id=65792
--- Comment #6 from PJ Fanning <[email protected]> --- We are in the middle of a release so I don't want to merge any changes until that is done. I have reproduced this issue and it actually happens in the `880000000*0.84900%` part. The multiplication is done using 2 java doubles and the result is not exact. The correct result is 7471200.0 but the POI java code produces something more like 7471199.999999. I hacked the multiply code as below but it is a hack. The idea is to try to round doubles that are very close to integers to those integers. public static final Function MultiplyEval = new TwoOperandNumericOperation() { @Override protected double evaluate(double d0, double d1) { - return d0*d1; + BigDecimal bd = new BigDecimal(d0).multiply(new BigDecimal(d1)); + BigDecimal possibleInt = bd.setScale(8, RoundingMode.HALF_UP); + if (possibleInt.doubleValue() == possibleInt.setScale(0, RoundingMode.HALF_UP).doubleValue()) { + return possibleInt.doubleValue(); + } else { + return bd.doubleValue(); + } } }; -- You are receiving this mail because: You are the assignee for the bug. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
