[Libreoffice-commits] core.git: sc/source
Winfried Donkers
winfrieddonkers at libreoffice.org
Tue Feb 21 21:33:22 UTC 2017
sc/source/core/inc/interpre.hxx | 2 +-
sc/source/core/tool/interpr3.cxx | 5 +++--
sc/source/core/tool/interpr4.cxx | 4 ++--
3 files changed, 6 insertions(+), 5 deletions(-)
New commits:
commit 0aca3bde3ae6d1acc241e3aecde5ebca89b75b1b
Author: Winfried Donkers <winfrieddonkers at libreoffice.org>
Date: Thu Feb 9 17:21:28 2017 +0100
tdf#105885 fix incorrect result with CHISQ.DIST.RT.
With X-argument < 0 Excel returns an error; Calc now does too.
Change-Id: I58a84436b2418bef824b6494c2cc5737932cc936
Reviewed-on: https://gerrit.libreoffice.org/34098
Reviewed-by: Eike Rathke <erack at redhat.com>
Tested-by: Eike Rathke <erack at redhat.com>
diff --git a/sc/source/core/inc/interpre.hxx b/sc/source/core/inc/interpre.hxx
index ccc46ad..bbd18dd 100644
--- a/sc/source/core/inc/interpre.hxx
+++ b/sc/source/core/inc/interpre.hxx
@@ -877,7 +877,7 @@ void ScTDist_MS();
void ScTDist_T( int nTails );
void ScFDist();
void ScFDist_LT();
-void ScChiDist(); // for LEGACY.CHIDIST, returns right tail
+void ScChiDist( bool bODFF); // for LEGACY.CHIDIST, returns right tail
void ScChiSqDist(); // returns left tail or density
void ScChiSqDist_MS();
void ScChiSqInv(); //invers to CHISQDIST
diff --git a/sc/source/core/tool/interpr3.cxx b/sc/source/core/tool/interpr3.cxx
index 95010d2..bef7725 100644
--- a/sc/source/core/tool/interpr3.cxx
+++ b/sc/source/core/tool/interpr3.cxx
@@ -1729,14 +1729,15 @@ void ScInterpreter::ScFDist_LT()
}
}
-void ScInterpreter::ScChiDist()
+void ScInterpreter::ScChiDist( bool bODFF )
{
double fResult;
if ( !MustHaveParamCount( GetByte(), 2 ) )
return;
double fDF = ::rtl::math::approxFloor(GetDouble());
double fChi = GetDouble();
- if (fDF < 1.0) // x<=0 returns 1, see ODFF 6.17.10
+ if ( fDF < 1.0 // x<=0 returns 1, see ODFF1.2 6.18.11
+ || ( !bODFF && fChi < 0 ) ) // Excel does not accept negative fChi
{
PushIllegalArgument();
return;
diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index 09c75f7..b6e069e 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -4261,8 +4261,8 @@ StackVar ScInterpreter::Interpret()
case ocFDist :
case ocFDist_RT : ScFDist(); break;
case ocFDist_LT : ScFDist_LT(); break;
- case ocChiDist :
- case ocChiDist_MS : ScChiDist(); break;
+ case ocChiDist : ScChiDist( true ); break;
+ case ocChiDist_MS : ScChiDist( false ); break;
case ocChiSqDist : ScChiSqDist(); break;
case ocChiSqDist_MS : ScChiSqDist_MS(); break;
case ocStandard : ScStandard(); break;
More information about the Libreoffice-commits
mailing list