- marked as minor
Addition / Sum Bug
Issue #48
wontfix
Try evaluating "23.1+78.2" and it equals "101.30000000000001". I tried it with similar numbers and it seems to do it with a variety of numbers with ".1" and ".2"
Comments (5)
-
repo owner -
repo owner - changed status to wontfix
-
Any way you can use BigDecimal? Or would that conflict with something? Let me know the section that would need changing. I could contribute.
-
repo owner Commons math uses double types in almost all of the algorithms.
On the other side maybe the commons math Dfp numbers may match your requirements?
-
That looks good, I'll make a fork in the coming days
- Log in to comment
This is due to how floating point arithmetic works in Java (or other programming languages): You can try the following example:
See these questions on stackoverflow.com:
Floating point arithmetic not producing exact results
Java floats and doubles...