<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 - tests sc_array_functions_test fail due to floating point precision"
   href="https://bugs.documentfoundation.org/show_bug.cgi?id=114051">114051</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>tests sc_array_functions_test fail due to floating point precision
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>x86-64 (AMD64)
          </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>miltonvandersloot@fake-box.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The test ArrayFunctionsTest::testArrayFormulasFODS (files
sc/qa/unit/functions_test.cxx, sc/qa/unit/functions_array.cxx) fails the test
document sc/qa/unit/data/functions/array/fods/linest.fods. Opening the files in
sc/qa/unit/data/functions/array/fods/ reveals also that the file logest.fods
also fails (the others do not fail for me).

Error message in the compile run (Note that 1 = TRUE, 0 = FALSE in the
document)


functions_test.cxx:43:Assertion
Test name: ArrayFunctionsTest::testArrayFormulasFODS
double equality assertion failed
- Expected: 1
- Actual  : 0
- Delta   : 1e-14


The issue seems to be (again) floating point precision. Indeed, I've compiled
LibreOffice with FMA (fused multiply-add) instructions, if I disable them, i.e.
passing -ffp-contract=off to the compiler, then the tests succeed. Note that
FMA has slightly different floating point precision than ordinary plus and mult
[0, 1].

Mentionable commits:

* Add logest.fods test:
<a href="https://cgit.freedesktop.org/libreoffice/core/commit/?id=588ebef9e8d1e2c703b79f51f2a1c8004cd7d96d">https://cgit.freedesktop.org/libreoffice/core/commit/?id=588ebef9e8d1e2c703b79f51f2a1c8004cd7d96d</a>
* Add linest.fods test:
<a href="https://cgit.freedesktop.org/libreoffice/core/commit/?id=0523e11a2530ed101c580f93f94a4180e9dc0c9e">https://cgit.freedesktop.org/libreoffice/core/commit/?id=0523e11a2530ed101c580f93f94a4180e9dc0c9e</a>
* Disable tests on 32-bit x86-linux due to floating point weirdness:
<a href="https://cgit.freedesktop.org/libreoffice/core/commit/?id=b9a27d5856f60688456762bfcc29c38670009254">https://cgit.freedesktop.org/libreoffice/core/commit/?id=b9a27d5856f60688456762bfcc29c38670009254</a>

[0] <a href="https://en.wikipedia.org/wiki/Fused_multiply-add">https://en.wikipedia.org/wiki/Fused_multiply-add</a>
[1] <a href="https://github.com/uclouvain/openjpeg/issues/1017">https://github.com/uclouvain/openjpeg/issues/1017</a></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>