Bug 149333 - Goal Seek calculation error in specific formula that works in Excel
Summary: Goal Seek calculation error in specific formula that works in Excel
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
3.5.0 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: GoalSeek
  Show dependency treegraph
 
Reported: 2022-05-27 12:06 UTC by Nas
Modified: 2024-06-14 11:21 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
Excel file containing bug replication try-outs (7.29 KB, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet)
2022-05-27 16:44 UTC, Nas
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Nas 2022-05-27 12:06:19 UTC Comment hidden (obsolete)
Comment 1 Roman Kuznetsov 2022-05-27 14:29:04 UTC Comment hidden (obsolete)
Comment 2 Nas 2022-05-27 16:44:31 UTC Comment hidden (obsolete)
Comment 3 QA Administrators 2022-05-28 03:34:56 UTC Comment hidden (obsolete)
Comment 4 Buovjaga 2023-01-12 12:18:29 UTC Comment hidden (obsolete)
Comment 5 Mike Kaganski 2024-06-14 05:41:10 UTC
Maybe the easiest example (inspired by bug 161338):

A1: 200
A2: =1/A1

Goal Seek
Formula cell: $A$2
Target value: 100
Variable cell: $A$1

The method used in ScDocument::Solver (sc/source/core/data/documen4.cxx), Regula Falsi, is known to have limitations for discontinuous functions (like the cases mentioned here). Some improvements are needed to overcome the limitations. Excel's Goal Seek converges much slower in these cases, compared to instant failure of Calc; it looks OK to try to introduce additional steps (alternative methods? more clever detection of special points?) here, if that helps.
Comment 6 Mike Kaganski 2024-06-14 06:10:47 UTC
But in fact, the original report is wrong.
The step 3 (Run Goal Seek), putting the value of 0.0136494244938458 into D9, produces not "1.055410......" in D10, but specifically 1.05498026314876E-07 - i.e., approximately 1*10^-7 - which *is* a good approximation of the target value of zero (its usual representation is 0.00000010549802631488; at least it's much better than original 0.0007979).

And Excel, with its suggested variable value of 0,0136494425233952, producing target value of -5,82678759286637E-06 (-0,00000582678759286637), is in fact about 50 times *worse* (!) than the Calc's result.

Let me hijack the bug for comment 5. Everything else here is INVALID.