Apache OpenOffice (AOO) Bugzilla – Issue 7410
Wrong result on simple addition/subtraction
Last modified: 2010-04-03 08:52:15 UTC
Example: A1: =13114.77 A2: =13401.55 A3: =A1-A2 (shows -286.78) A4: =IF(A3=-286.78;"OK";"WHAT?!?") (shows WHAT?!?) If the accuracy of A3 is increased (e.g to 20 digis after the decimal point), one can see that the subtraction result is something -286.7799999999000000. Note that the numbers in A1 and A2 have been entered by hand, without any hidden digits. Looks like a real bug therefore. PS: I do not have one of these original Pentium, but an Athlon Thunderbird.
For me it seems to be one of these Issues dealing with the calculating capabilities of C++. Assigned to Eike. He will have a look at it. Workaround : Set Precision as shown under Tools - Options - Spreadsheet - Calculate Frank
This is normal computer behavior with roundoff errors, and it has nothing to do with C++ or any other computer language but binary representation of floating point values instead. If you want to compare floating point values you have to round them, so your conditional statement should read =IF(ROUND(A3;2)=-286.78;"OK";"WHAT?!?")
closing
*** Issue 41924 has been marked as a duplicate of this issue. ***
*** Issue 110570 has been marked as a duplicate of this issue. ***