summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorWinfried Donkers <winfrieddonkers@libreoffice.org>2017-03-02 15:16:57 +0100
committerEike Rathke <erack@redhat.com>2017-03-06 15:50:47 +0000
commitccd030e61fa43c472b85b184882e87f4fab2faf2 (patch)
tree08c89905b1167917c4242a2fc8ad00ce01568c51 /sc
parent9a7b5d86aceb97fc9f3d36bee817d3d0fc976254 (diff)
tdf#106236 Check for all constraints with Calc function PDURATION.
Plus use of correct prefixes for variable names. Change-Id: I430039fa23fc73e13bf1992f4188a67ae47b52ab Reviewed-on: https://gerrit.libreoffice.org/34819 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/tool/interpr2.cxx11
1 files changed, 7 insertions, 4 deletions
diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx
index b9dd7381c1ee..a33aa336917c 100644
--- a/sc/source/core/tool/interpr2.cxx
+++ b/sc/source/core/tool/interpr2.cxx
@@ -1880,10 +1880,13 @@ void ScInterpreter::ScPDuration()
{
if ( MustHaveParamCount( GetByte(), 3 ) )
{
- double nFuture = GetDouble();
- double nPresent = GetDouble();
- double nInterest = GetDouble();
- PushDouble(log(nFuture / nPresent) / rtl::math::log1p(nInterest));
+ double fFuture = GetDouble();
+ double fPresent = GetDouble();
+ double fInterest = GetDouble();
+ if ( fFuture <= 0.0 || fPresent <= 0.0 || fInterest <= 0.0 )
+ PushIllegalArgument();
+ else
+ PushDouble( ( log( fFuture / fPresent ) / rtl::math::log1p( fInterest ) ) );
}
}