[Libreoffice-bugs] [Bug 141752] New: calc: calculate: trap in rawsubtract, wrong calculation sequence, documentation imprecise
bugzilla-daemon at bugs.documentfoundation.org
bugzilla-daemon at bugs.documentfoundation.org
Mon Apr 19 03:51:59 UTC 2021
https://bugs.documentfoundation.org/show_bug.cgi?id=141752
Bug ID: 141752
Summary: calc: calculate: trap in rawsubtract, wrong
calculation sequence, documentation imprecise
Product: LibreOffice
Version: 6.1.6.3 release
Hardware: All
OS: All
Status: UNCONFIRMED
Severity: normal
Priority: medium
Component: Calc
Assignee: libreoffice-bugs at lists.freedesktop.org
Reporter: newbie-02 at gmx.de
Description:
rawsubtract() is a handy tool to check e.g. which deviations evolve from
fp-math vs. e.g. calc rounding, and to perform precise 'unrounded'
calculations,
the documentation says, as well as the tooltip:
'RAWSUBTRACT(Minuend, Subtrahend1, Subtrahend2, ...)'
<https://help.libreoffice.org/6.1/he/text/scalc/01/func_rawsubtract.html>
one would expect to get:
((Minuend - Subtrahend1) - Subtrahend2) ... - Subtrahendx and not:
((Minuend - Subtrahendx) - Subtrahendx-1) ... - Subtrahend1
but what you get is indeed the second calculation, reverse sequence of
processing the operands.
as the sequence matters (non associativity of fp-addition) and e.g.
'=1E16 + 1 - 1E16' results in 0 while
'=1E16 - 1E16 + 1' gives 1 it is:
1. important to process the operands in a meaningful order (suppose to correct
that), and
2. important to have the documentation (and tooltip) matching the operation,
which does not as it is now,
practical sample:
'=RAWSUBTRACT(1E+016;1E+016;1)' -> '0', should be '-1',
'=RAWSUBTRACT(1E+016;1;1E+016)' -> '-1', should be '0' due to fp-math :-(
assumptions: compiler optimizations?
difficult: changing the order will break compatibility for existing sheets, not
changing the order but only the documentation will trap more users in the
future (as they normally don't check the documentation, but expect a program
that can be operated intuitively)
besides rawsubtract being rarely used (quite rarely know to users), it does!
matter to work in a meaningful way because if, then it's used to check
difficult things where precise functioning makes big difference.
Steps to Reproduce:
1. key '=RAWSUBTRACT(1E+016;1E+016;1)' in a cell,
2. key '=RAWSUBTRACT(1E+016;1;1E+016)' in the cell below
Actual Results:
'0'
'-1'
Expected Results:
'-1'
'0'
Reproducible: Always
User Profile Reset: No
Additional Info:
didn't check other hardware than Intel (Xeon), assume 'all',
didn't check Linux, assume 'all',
didn't check Versions prior 6.1.6.3, assume all versions having rawsubtract,
didn't reset user profile as clear repro in different independent installs,
--
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/20210419/dabc0172/attachment.htm>
More information about the Libreoffice-bugs
mailing list