Issue 100654 - sum function not correct
Summary: sum function not correct
Alias: None
Product: Calc
Classification: Application
Component: code (show other issues)
Version: OOO310m8
Hardware: PC Windows XP
: P3 Trivial (vote)
Target Milestone: ---
Assignee: spreadsheet
QA Contact: issues@sc
Keywords: oooqa
Depends on:
Reported: 2009-03-30 03:13 UTC by b_art
Modified: 2010-03-01 14:07 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---

Odd calculation SUM() (15.67 KB, application/vnd.oasis.opendocument.spreadsheet)
2009-03-30 03:15 UTC, b_art
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description b_art 2009-03-30 03:13:23 UTC
Versionnumber is OOO310m15.

Adding a list of numbers with no more than 2 numbers after the decimal gives an
odd result subtracing another list of such numbers.
Comment 1 b_art 2009-03-30 03:15:05 UTC
Created attachment 61265 [details]
Odd calculation SUM()
Comment 2 Regina Henschel 2009-03-30 19:31:44 UTC
That is the general problem, using numbers with fractional part. Converting to
binary number give theoretically a infinite amount of decimal places, which are
cut somewhere. So you get a slightly different value, when converting back to
decimal. If you subtract a number of nearly the same amount, the significant
parts are lost and the wrong decimal places come into sight and are no longer
covered by rounding.

If you need accurate currency, you must calculate in cent and apply the
prescribed rounding rules.

*** This issue has been marked as a duplicate of 69749 ***
Comment 3 Regina Henschel 2009-03-30 19:32:27 UTC
closing, duplicate to issue 69749
Comment 4 b_art 2009-03-31 04:42:33 UTC
I think this is still an error.

The SUM should be correct for the 2 figures after the decimal.
It is more simple for an user to understand, not everybody is a math guru in the
binary way. If I am counting with % then I would understand.

But when I compare the 2 SUM cells with an IF then they are equal! Only and only
then when I subtracted the 2 SUM cells I get this behavior, why?

Also the precision is no more then 10 figures behind the decimal? When you can
use the floating point, why not use it? 
Comment 5 avcomp 2009-12-30 17:07:23 UTC
I just noted an error in a spreadsheet using the Sum function.  I asked the
function to sum two cells, both using currency, and the answer was off %0.01.

The values were 293.73 + 14.69 = $316.22  OO returned a value of $316.21.

The cell values were the result of a Sum function of other cells, and there are
no rounding errors in the cells used for the Sum.

Is there a fix for this in the works?  I have never noted such an error until
version 3.1.1 OOO310m19 (Build 9420) and have used OO for years.
Comment 6 Mechtilde 2010-03-01 12:29:33 UTC
Calc has 15 (fifteen) significant figures as other spreadsheets too.

So if you need a higher signification you need to use a special programm for it.

so I also want to close this issue as wontfix
Comment 7 ooo 2010-03-01 14:07:06 UTC
I very much doubt that OOo for 293.73 + 14.69 ever returned the value 316.21,
the result is 308.42