GNOME Bugzilla – Bug 662938
Bad calculation
Last modified: 2011-10-28 19:44:42 UTC
Type the following in any cell 0,05 -0,07 0,02 0 Do a sum of the above cells gives -3,46944695195361E-018 instead of 0 Same bug in Excel but not in calc
*** This bug has been marked as a duplicate of bug 613557 ***
One should probably note that this is not a bug. The explanation for this is in the duplicate "bug" report.
Oh the more detailed explanation is in bug #509965.
Many thanks for the explanation. One of my students (17 years) came up with calculation. Now I may try to explain it to him.
I would think it the easiest if you first explain it in terms of decimal representations: We all know that 1/3 + 1/3 + 1/3 - 1 = 0 but if you wrote them as decimals with a fixed number (say 4) of decimal digits, then we have: 0.3333 + 0.3333 + 0.3333 - 1.000 = 0.9999 - 1.000 = -0.0001 and only then transfer it to binary where the closest approximation of 1/3 is 0.0101 (=5/16): 0.0101 + 0.0101 + 0.0101 - 1.0000 = 0.1111 - 1.0000 = - 0.0001 (or -1/16) In computers numbers of the same magnitude are represented with the same number of fractional binary digits, just much more than 4. Good luck!