summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorWinfried Donkers <winfrieddonkers@libreoffice.org>2017-03-07 17:24:41 +0100
committerEike Rathke <erack@redhat.com>2017-03-07 17:12:00 +0000
commit94509163e8690351f47bb32eaff6ace14b1b808a (patch)
tree675fe46ff38ef5ce85d6c39c4e50744b65528e74 /sc
parent04c7d5013b9b87709b913e26190fb347a4916566 (diff)
Follow up of commit 055c8cc676921176e2b9df76bd0e09bacab1d80b
Change type of error from #NUM! to #DIV/0! in case of TimeLength being 0. Change-Id: I09abde85badb08afc1c688452b33ee0b5c39859b Reviewed-on: https://gerrit.libreoffice.org/34954 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'sc')
-rw-r--r--sc/qa/unit/data/functions/financial/fods/sln.fods6
-rw-r--r--sc/source/core/tool/interpr2.cxx11
2 files changed, 6 insertions, 11 deletions
diff --git a/sc/qa/unit/data/functions/financial/fods/sln.fods b/sc/qa/unit/data/functions/financial/fods/sln.fods
index 05a85c3f9b80..2e97a9e3be59 100644
--- a/sc/qa/unit/data/functions/financial/fods/sln.fods
+++ b/sc/qa/unit/data/functions/financial/fods/sln.fods
@@ -2529,10 +2529,10 @@
<table:table-cell table:formula="of:=SLN(100;10;0)" office:value-type="string" office:string-value="" calcext:value-type="error">
<text:p>Err:502</text:p>
</table:table-cell>
- <table:table-cell table:formula="of:#ERR502!" office:value-type="string" office:string-value="" calcext:value-type="error">
+ <table:table-cell table:formula="of:#DIV/0!" office:value-type="string" office:string-value="" calcext:value-type="error">
<text:p>Err:502</text:p>
</table:table-cell>
- <table:table-cell table:style-name="ce71" table:formula="of:=ORG.OPENOFFICE.ERRORTYPE([.A12])=502" office:value-type="boolean" office:boolean-value="true" calcext:value-type="boolean">
+ <table:table-cell table:style-name="ce71" table:formula="of:=ISERROR([.A12])" office:value-type="boolean" office:boolean-value="true" calcext:value-type="boolean">
<text:p>TRUE</text:p>
</table:table-cell>
<table:table-cell table:style-name="ce26" table:formula="of:=FORMULA([.A12])" office:value-type="string" office:string-value="=SLN(100,10,0)" calcext:value-type="string">
@@ -2879,4 +2879,4 @@
</table:named-expressions>
</office:spreadsheet>
</office:body>
-</office:document> \ No newline at end of file
+</office:document>
diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx
index a25da2993368..9f6894868e8f 100644
--- a/sc/source/core/tool/interpr2.cxx
+++ b/sc/source/core/tool/interpr2.cxx
@@ -1896,14 +1896,9 @@ void ScInterpreter::ScSLN()
if ( MustHaveParamCount( GetByte(), 3 ) )
{
double fTimeLength = GetDouble();
- if ( fTimeLength == 0.0 )
- PushIllegalArgument();
- else
- {
- double fRest = GetDouble();
- double fValue = GetDouble();
- PushDouble((fValue - fRest) / fTimeLength);
- }
+ double fRest = GetDouble();
+ double fValue = GetDouble();
+ PushDouble( div( fValue - fRest, fTimeLength ) );
}
}