summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorWinfried Donkers <winfrieddonkers@libreoffice.org>2017-09-06 16:52:05 +0200
committerEike Rathke <erack@redhat.com>2017-09-07 15:16:58 +0200
commit085768b2a0dd1fc6371e8b2ba4e2418ba96cdb21 (patch)
tree030d5c0a815372f1daee034376f4a1e90fac928f /sc
parent0b172f1d95c726c3e0bbc0b58a8605bf06bf6c67 (diff)
tdf#112177 remove incorrect constraint for Calc function NPER.
Change-Id: I123ea8ee2e333665ac448c6b3814c3bac0b687ab Reviewed-on: https://gerrit.libreoffice.org/42011 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Eike Rathke <erack@redhat.com> (cherry picked from commit 003c2cfaa258e204402a366a105366da74e220a2) Reviewed-on: https://gerrit.libreoffice.org/42047
Diffstat (limited to 'sc')
-rw-r--r--sc/qa/unit/data/functions/financial/fods/nper.fods36
-rw-r--r--sc/source/core/tool/interpr2.cxx2
2 files changed, 27 insertions, 11 deletions
diff --git a/sc/qa/unit/data/functions/financial/fods/nper.fods b/sc/qa/unit/data/functions/financial/fods/nper.fods
index 22c06f914a25..2eac9b8f339f 100644
--- a/sc/qa/unit/data/functions/financial/fods/nper.fods
+++ b/sc/qa/unit/data/functions/financial/fods/nper.fods
@@ -1528,20 +1528,20 @@
<table:table-cell table:number-columns-repeated="9"/>
</table:table-row>
<table:table-row table:style-name="ro6">
- <table:table-cell table:style-name="ce48" table:formula="of:=NPER(0.06/52; 0; 8000; 0 ;2)" office:value-type="string" office:string-value="" calcext:value-type="error">
- <text:p>Err:502</text:p>
+ <table:table-cell table:formula="of:=NPER(0.06; 0; -80; 400 ;2)" office:value-type="float" office:value="27.6208695898296" calcext:value-type="float">
+ <text:p>27.6208695898296</text:p>
</table:table-cell>
- <table:table-cell table:formula="of:#ERR502!" office:value-type="string" office:string-value="" calcext:value-type="error">
- <text:p>Err:502</text:p>
+ <table:table-cell office:value-type="float" office:value="27.6208695898296" calcext:value-type="float">
+ <text:p>27.6208695898296</text:p>
</table:table-cell>
- <table:table-cell table:style-name="ce53" table:formula="of:=ORG.OPENOFFICE.ERRORTYPE([.A12])=502" office:value-type="boolean" office:boolean-value="true" calcext:value-type="boolean">
- <text:p>TRUE</text:p>
+ <table:table-cell table:style-name="ce51" table:formula="of:=ROUND([.A12];12)=ROUND([.B12];12)" office:value-type="boolean" office:boolean-value="true" calcext:value-type="boolean">
+ <text:p>WAAR</text:p>
</table:table-cell>
- <table:table-cell table:formula="of:=FORMULA([.A12])" office:value-type="string" office:string-value="=NPER(0.06/52, 0, 8000, 0 ,2)" calcext:value-type="string">
- <text:p>=NPER(0.06/52, 0, 8000, 0 ,2)</text:p>
+ <table:table-cell table:formula="of:=FORMULA([.A12])" office:value-type="string" office:string-value="=NPER(0.06; 0; -80; 400 ;2)" calcext:value-type="string">
+ <text:p>=NPER(0,06; 0; -80; 400 ;2)</text:p>
</table:table-cell>
<table:table-cell office:value-type="string" calcext:value-type="string">
- <text:p>No payment, no result</text:p>
+ <text:p>future value achieved with interest from present value</text:p>
</table:table-cell>
<table:table-cell table:number-columns-repeated="4"/>
<table:table-cell table:style-name="ce20" table:number-columns-repeated="2"/>
@@ -1570,6 +1570,24 @@
<table:table-cell table:number-columns-repeated="6"/>
</table:table-row>
<table:table-row table:style-name="ro6">
+ <table:table-cell table:formula="of:=NPER(0.06; 0; 80; 400 ;2)" office:value-type="string" office:string-value="" calcext:value-type="error">
+ <text:p>#NUM!</text:p>
+ </table:table-cell>
++ <table:table-cell office:value-type="string" calcext:value-type="string">
++ <text:p>#NUM!</text:p>
+ </table:table-cell>
+ <table:table-cell table:style-name="ce26" table:formula="of:=ISERROR([.A14])" office:value-type="boolean" office:boolean-value="true" calcext:value-type="boolean">
+ <text:p>WAAR</text:p>
+ </table:table-cell>
+ <table:table-cell table:formula="of:=FORMULA([.A14])" office:value-type="string" office:string-value="=NPER(0,06; 0; 80; 400 ;2)" calcext:value-type="string">
+ <text:p>=NPER(0,06; 0; 80; 400 ;2)</text:p>
+ </table:table-cell>
+ <table:table-cell office:value-type="string" calcext:value-type="string">
+ <text:p>future value cannot be achieved with interest from present value</text:p>
+ </table:table-cell>
+ <table:table-cell table:number-columns-repeated="15"/>
+ </table:table-row>
+ <table:table-row table:style-name="ro6">
<table:table-cell table:style-name="ce21"/>
<table:table-cell/>
<table:table-cell table:style-name="ce26"/>
diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx
index 3e61c081e24b..35f748a959e2 100644
--- a/sc/source/core/tool/interpr2.cxx
+++ b/sc/source/core/tool/interpr2.cxx
@@ -2007,8 +2007,6 @@ void ScInterpreter::ScNper()
// amount to be paid to get from fPV to fFV is fFV_+_fPV.
if ( fPV + fFV == 0.0 )
PushDouble( 0.0 );
- else if ( fPmt == 0.0 )
- PushIllegalArgument(); // No payment, future value can never be reached
else if (fInterest == 0.0)
PushDouble(-(fPV + fFV)/fPmt);
else if (bPayInAdvance)