[Libreoffice-commits] core.git: sc/source

Winfried Donkers winfrieddonkers at libreoffice.org
Thu Oct 13 18:21:31 UTC 2016


 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 52c79bbd1b4c58124738b59214a3f2b111ff0191
Author: Winfried Donkers <winfrieddonkers at libreoffice.org>
Date:   Wed Sep 21 17:00:38 2016 +0200

    tdf#102328 Add constraint for argument X in Calc function GAMMA.DIST.
    
    Change-Id: I5702cabac8f1e331072acfe25581569f3b7f64cc
    Reviewed-on: https://gerrit.libreoffice.org/29148
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Eike Rathke <erack at redhat.com>

diff --git a/sc/source/core/inc/interpre.hxx b/sc/source/core/inc/interpre.hxx
index dbe0a3c..fadd474 100644
--- a/sc/source/core/inc/interpre.hxx
+++ b/sc/source/core/inc/interpre.hxx
@@ -856,7 +856,7 @@ void ScFisher();
 void ScFisherInv();
 void ScFact();
 void ScNormDist( int nMinParamCount );
-void ScGammaDist( int nMinParamCount );
+void ScGammaDist( bool bODFF );
 void ScGammaInv();
 void ScExpDist();
 void ScBinomDist();
diff --git a/sc/source/core/tool/interpr3.cxx b/sc/source/core/tool/interpr3.cxx
index 9b074fa..c877d72 100644
--- a/sc/source/core/tool/interpr3.cxx
+++ b/sc/source/core/tool/interpr3.cxx
@@ -2107,8 +2107,9 @@ double ScInterpreter::GetHypGeomDist( double x, double n, double M, double N )
     return fFactor;
 }
 
-void ScInterpreter::ScGammaDist( int nMinParamCount )
+void ScInterpreter::ScGammaDist( bool bODFF )
 {
+    sal_uInt8 nMinParamCount = ( bODFF ? 3 : 4 );
     sal_uInt8 nParamCount = GetByte();
     if ( !MustHaveParamCount( nParamCount, nMinParamCount, 4 ) )
         return;
@@ -2120,7 +2121,7 @@ void ScInterpreter::ScGammaDist( int nMinParamCount )
     double fBeta = GetDouble();                 // scale
     double fAlpha = GetDouble();                // shape
     double fX = GetDouble();                    // x
-    if (fAlpha <= 0.0 || fBeta <= 0.0)
+    if ((!bODFF && fX < 0) || fAlpha <= 0.0 || fBeta <= 0.0)
         PushIllegalArgument();
     else
     {
diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index 475e4ad..6f5c87e 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -4299,8 +4299,8 @@ StackVar ScInterpreter::Interpret()
                 case ocGammaLn          :
                 case ocGammaLn_MS       : ScLogGamma();                 break;
                 case ocGamma            : ScGamma();                    break;
-                case ocGammaDist        : ScGammaDist( 3 );             break;
-                case ocGammaDist_MS     : ScGammaDist( 4 );             break;
+                case ocGammaDist        : ScGammaDist( true );          break;
+                case ocGammaDist_MS     : ScGammaDist( false );         break;
                 case ocGammaInv         :
                 case ocGammaInv_MS      : ScGammaInv();                 break;
                 case ocChiTest          :


More information about the Libreoffice-commits mailing list