poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bryan Varner <bryan.var...@e-gineering.com>
Subject Re: Precision of double calculations...
Date Tue, 17 Mar 2015 15:16:06 GMT

On Mar 17, 2015, at 10:43 AM, Nick Burch <apache@gagravarr.org<mailto:apache@gagravarr.org>>
wrote:

On Tue, 17 Mar 2015, Bryan Varner wrote:
I’m working with a client making use of POI to do some heavy calculations of workbook formulas
in java.

We’re having issues with the precision of some of the math functions (TwoOperandNumericOperation)
being based on double math rather than BigDecimal math.

I believe that Excel uses doubles internally as well, no big decimals. The problem is that
it doesn't quite use the same rounding as Java does. There's a bit of an explanation of the
problems this can cause in this stackoverflow discussion:
http://stackoverflow.com/questions/28537614/matching-excels-floating-point-in-java

If your problem is that, then I'm not sure that dropping in a big decimal will work, as the
Java big decimal's rounding rules don't match the Excel ones

David North has been doing lots of work on / around this area, so we might want to wait for
him to chime in

Nick

Thanks Nick for the input. The client has a 3.9 fork they’ve been using internally, but
wants to get something functionally identical merged upstream. They’ve switched things to
use BigDecimal internally, and made use of http://arxiv.org/abs/0908.3030v2 in their fork
to get the numbers they expected.

I think waiting on David to chime in sounds like a good idea.

My client has been over this a _lot_, and they swear their computations are (more) accurate
now when compared to Excel. I tend to trust them on this, due to the nature of the workbooks
they’re evaluating, and the … critical nature of getting these numbers right for their
business…

Being that their code is based off of 3.9, I started looking at ways we could at least make
adjustments to the POI code to let us drop in their calculation functions or forward-port
to a newer POI release. They do want to contribute upstream if possible, especially if it
reduces the long-term maintenance burden. In my digging, I’ve noticed a few other oddities
(but I’m looking at the 3.9 release code right now) and low-hanging places to improve things
in POI, but my focus right now is still on getting the math results my client says they need.

What’s the best way to contribute back upstream at this point? Are pull requests from github
still frowned upon?

-Bryan


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message