https://issues.apache.org/bugzilla/show_bug.cgi?id=51339
--- Comment #7 from Marcel May <[email protected]> 2011-06-09 08:26:00 UTC --- I think there's a misunderstanding - its not about displayed values, but about the rounding function implementation of POI. The ROUND(...) function of Excel uses the rounding mode HALF_UP, also known as 'arithmetic rounding' (see http://support.microsoft.com/kb/196652/EN-US). The issue is: The current POI implementation does not do arithmetic rounding (Michal pasted the code in a previous comment), im citing the critical part again: ... if (p != 0) { double temp = Math.pow(10, p); // NOT CORRECT ARITHMETIC retval = Math.round(n*temp)/temp; // ROUNDING ... This must be replaced with the previously suggested code using BigDecimal, to get a correct 'arithmetic rounding' as Excel uses: retval = java.math.BigDecimal.valueOf(2162.615).setScale(2, java.math.RoundingMode.HALF_UP).doubleValue() Cheers, Marcel -- Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email ------- 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]
