Issue 92774 - ODFF: NPV() must evaluate arguments in the order given and row-wise
Summary: ODFF: NPV() must evaluate arguments in the order given and row-wise
Status: CLOSED FIXED
Alias: None
Product: Calc
Classification: Application
Component: programming (show other issues)
Version: recent-trunk
Hardware: All All
: P3 Trivial (vote)
Target Milestone: 3.4.0
Assignee: kla
QA Contact: issues@sc
URL:
Keywords: ms_interoperability
Depends on:
Blocks:
 
Reported: 2008-08-13 19:40 UTC by ooo
Modified: 2017-05-20 10:30 UTC (History)
2 users (show)

See Also:
Issue Type: PATCH
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments
test case, result in D6 is wrong (18.00 KB, application/vnd.ms-excel)
2008-08-13 19:48 UTC, ooo
no flags Details
Patch 1, small change. (2.82 KB, text/plain)
2009-05-22 08:37 UTC, lvyue
no flags Details
Another test case. (9.00 KB, application/vnd.ms-excel)
2009-06-10 08:03 UTC, lvyue
no flags Details
Patch 2. (10.94 KB, text/plain)
2009-06-29 04:14 UTC, lvyue
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description ooo 2008-08-13 19:40:47 UTC
In NPV() the order of values is significant and affects the result. Evaluation
of arguments must be in the order given and range reference and array arguments
must be evaluated row-wise starting from top left to comply with ODFF and be
compatible with other spreadsheet applications.
Comment 1 ooo 2008-08-13 19:48:42 UTC
Created attachment 55754 [details]
test case, result in D6 is wrong
Comment 2 lvyue 2009-05-22 08:37:53 UTC
Created attachment 62428 [details]
Patch 1, small change.
Comment 3 ooo 2009-06-03 10:41:23 UTC
As discussed on IRC, a row-wise value iterator may be better suited that then
could be reused in other statistical functions needing to evaluate data row-wise.
The challenge is to not lose the performance benefit of the ScValueIterator that
accesses the data column-wise as it is stored internally. Setting up an array of
ScValueIterators, one per column, comes to mind; that then could be iterated
through for each row. Just a quick idea..
Comment 4 ooo 2009-06-03 11:08:17 UTC
Take a look at ScHorizontalCellIterator, that combined with the functionality of
ScValueIterator might be it.
Comment 5 lvyue 2009-06-10 08:03:08 UTC
Created attachment 62898 [details]
Another test case.
Comment 6 lvyue 2009-06-10 08:06:11 UTC
I found another problem with NPV(),
see the attached file i92774_NPV_singleref.xls,
in Excel, the results of C4 and D4 are the same,
but in OOo, they are not.
Please check this.
Comment 7 lvyue 2009-06-29 04:14:21 UTC
Created attachment 63261 [details]
Patch 2.
Comment 8 ooo 2009-07-01 13:41:46 UTC
A patch is a patch.
Comment 9 ooo 2010-12-03 21:11:36 UTC
With a little modification.

In cws dr78:

changeset 297b5255c27a
http://hg.services.openoffice.org/cws/dr78/changeset/297b5255c27a
M sc/inc/column.hxx
M sc/inc/dociter.hxx
M sc/inc/document.hxx
M sc/inc/table.hxx
M sc/source/core/data/dociter.cxx
M sc/source/core/tool/interpr2.cxx

You can observe the progress and possible integration date of CWS dr78 at
http://tools.services.openoffice.org/EIS2/cws.ShowCWS?Path=DEV300%2Fdr78
Comment 10 ooo 2011-03-01 19:44:54 UTC
Reassigning to QA for verification.
Comment 11 kla 2011-03-16 09:35:44 UTC
Seen ok in cws dr78 -> verified