<html>
    <head>
      <base href="https://bugs.documentfoundation.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_UNCONFIRMED "
   title="UNCONFIRMED - Erroneous calculation in IF statements (order of operations)"
   href="https://bugs.documentfoundation.org/show_bug.cgi?id=107519">107519</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Erroneous calculation in IF statements (order of operations)
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>LibreOffice
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>5.3.2.2 release
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>UNCONFIRMED
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>medium
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Calc
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>libreoffice-bugs@lists.freedesktop.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>chbug@chaven.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Description:

A cell that  has:
=SUM(F6+$E$3)*(1+$E$2)

produces the correct valuation

When using the same calculation in an IF statement, it does not produce the
same results:

=IF(F6<$B$20,sum((F6+$E$3)*(1+$E$2)),F6*(1+$E$2))

(when the sum calculation is performed it apparently does not follow the
correct order of operations.    so both formulas implementations achieve
different results.



Steps to Reproduce:
1.F6 = 1000000 ; $E$3 = 18000 ; $E$2 = .08
2.=SUM(F6+$E$3)*(1+$E$2)     produces 1099440
3.=IF(F6<$B$20,sum((F6+$E$3)*(1+$E$2)),F6*(1+$E$2))     produces: 1080000

Same results regardless of initial values so it's the operation that is faulty.

Actual Results:  
1.F6 = 1000000 ; $E$3 = 18000 ; $E$2 = .08
2.=SUM(F6+$E$3)*(1+$E$2)     produces 1099440
3.=IF(F6<$B$20,sum((F6+$E$3)*(1+$E$2)),F6*(1+$E$2))     produces: 1080000

Same results regardless of initial values so it's the operation that is faulty.

Expected Results:
Should follow the same order of operations.


Reproducible: Always

User Profile Reset: no; happens on different systems.

Additional Info:


User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like
Gecko) Chrome/57.0.2987.98 Safari/537.36 OPR/44.0.2510.857</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>