summaryrefslogtreecommitdiff
path: root/sc/source/core/tool
diff options
context:
space:
mode:
authorWinfried Donkers <winfrieddonkers@libreoffice.org>2013-12-03 18:03:29 +0100
committerEike Rathke <erack@redhat.com>2013-12-03 11:50:47 -0600
commitc3760e9099db9cf1be696347e2a0743a3cae1b20 (patch)
tree1a412327cc96356bfa20be03db85cd1569455160 /sc/source/core/tool
parentb40dcdf4f5a03b71fe9e45f8f24fcaf25fd2febf (diff)
fdo#70797 fix incorrect argument handling of CHISQ.DIST
Change-Id: I6187aa673034e6dc18f48f7b6b7ac88989ab55ec Reviewed-on: https://gerrit.libreoffice.org/6914 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'sc/source/core/tool')
-rw-r--r--sc/source/core/tool/interpr3.cxx24
-rw-r--r--sc/source/core/tool/interpr4.cxx4
2 files changed, 26 insertions, 2 deletions
diff --git a/sc/source/core/tool/interpr3.cxx b/sc/source/core/tool/interpr3.cxx
index 9f5aa000d6d3..79934e63cc45 100644
--- a/sc/source/core/tool/interpr3.cxx
+++ b/sc/source/core/tool/interpr3.cxx
@@ -721,6 +721,30 @@ void ScInterpreter::ScChiSqDist()
}
}
+void ScInterpreter::ScChiSqDist_MS()
+{
+ sal_uInt8 nParamCount = GetByte();
+ if ( !MustHaveParamCount( nParamCount, 3, 3 ) )
+ return;
+ bool bCumulative = GetBool();
+ double fDF = ::rtl::math::approxFloor( GetDouble() );
+ if ( fDF < 1.0 || fDF > 1E10 )
+ PushIllegalArgument();
+ else
+ {
+ double fX = GetDouble();
+ if ( fX < 0 )
+ PushIllegalArgument();
+ else
+ {
+ if ( bCumulative )
+ PushDouble( GetChiSqDistCDF( fX, fDF ) );
+ else
+ PushDouble( GetChiSqDistPDF( fX, fDF ) );
+ }
+ }
+}
+
void ScInterpreter::ScGamma()
{
double x = GetDouble();
diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index 2a92252bbc12..b341eaa39669 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -4118,8 +4118,8 @@ StackVar ScInterpreter::Interpret()
case ocFDist_LT : ScFDist_LT(); break;
case ocChiDist :
case ocChiDist_MS : ScChiDist(); break;
- case ocChiSqDist :
- case ocChiSqDist_MS : ScChiSqDist(); break;
+ case ocChiSqDist : ScChiSqDist(); break;
+ case ocChiSqDist_MS : ScChiSqDist_MS(); break;
case ocStandard : ScStandard(); break;
case ocAveDev : ScAveDev(); break;
case ocDevSq : ScDevSq(); break;