[Libreoffice-bugs] [Bug 107519] Erroneous calculation in IF statements (order of operations)

bugzilla-daemon at bugs.documentfoundation.org bugzilla-daemon at bugs.documentfoundation.org
Sat Apr 29 18:51:24 UTC 2017


https://bugs.documentfoundation.org/show_bug.cgi?id=107519

LeMoyne Castle <lemoyne.castle at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEEDINFO                    |RESOLVED
         Resolution|---                         |NOTABUG

--- Comment #2 from LeMoyne Castle <lemoyne.castle at gmail.com> ---
A few notes: 

The SUM() function takes a semicolon separated list of values (or cells or
ranges).  The reported examples give only one value as an expression, so the
SUM function is not required here because SUM(x) == x.  See simplification at
end.

The two expressions within the SUM call are not the same, although they appear
to be equivalent (should produce the same result).  Doing the math by hand
either way, the correct result 1099440 is obtained.
first:  SUM( F6+$E$3 ) * (1+$E$2)  ==> 1099440 [correct] 
second: SUM( (F6+$E$3)*(1+$E$2) )  ==> 1099440 [correct]
(1000000 + 18000) * (1 + 0.08) = (1018000)*1.08 = 1099440

The erroneous result is 1080000
Note: 1080000 == (F6) * (1+$E$2) 
But this is the expression for the else clause in the =IF( ) formula that is
actually producing the 'erroneous' result...

I submit that $B$20 > F6 == 1000000 and the else result is being shown and
SUM() is not even being called.

Here is a simplification that may help: 
don't use the SUM function, just use the expression  (F6+$E$3)*(1+$E$2)

Unless there is a document that demonstrates this error in Calc, it is not a
bug.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice-bugs/attachments/20170429/917abf09/attachment.html>


More information about the Libreoffice-bugs mailing list