Bug 114051 - tests sc_array_functions_test fail due to floating point precision
Summary: tests sc_array_functions_test fail due to floating point precision
Status: RESOLVED MOVED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: x86-64 (AMD64) All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-11-25 20:50 UTC by Milton Vandersloot
Modified: 2017-11-26 19:04 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Milton Vandersloot 2017-11-25 20:50:41 UTC
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: https://cgit.freedesktop.org/libreoffice/core/commit/?id=588ebef9e8d1e2c703b79f51f2a1c8004cd7d96d
* Add linest.fods test: https://cgit.freedesktop.org/libreoffice/core/commit/?id=0523e11a2530ed101c580f93f94a4180e9dc0c9e
* Disable tests on 32-bit x86-linux due to floating point weirdness: https://cgit.freedesktop.org/libreoffice/core/commit/?id=b9a27d5856f60688456762bfcc29c38670009254

[0] https://en.wikipedia.org/wiki/Fused_multiply-add
[1] https://github.com/uclouvain/openjpeg/issues/1017
Comment 1 Buovjaga 2017-11-26 19:04:11 UTC
Please report this to the developer mailing list https://wiki.documentfoundation.org/Development/Mailing_List
Thank you.