[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - sc/source

Winfried Donkers winfrieddonkers at libreoffice.org
Tue Dec 3 10:01:03 PST 2013


 sc/source/core/inc/interpre.hxx  |    1 +
 sc/source/core/tool/interpr3.cxx |   24 ++++++++++++++++++++++++
 sc/source/core/tool/interpr4.cxx |    4 ++--
 sc/source/ui/src/scfuncs.src     |    2 +-
 4 files changed, 28 insertions(+), 3 deletions(-)

New commits:
commit a4332ca8536242d7975146bcd700ecb0acb88f31
Author: Winfried Donkers <winfrieddonkers at libreoffice.org>
Date:   Tue Dec 3 18:03:29 2013 +0100

    fdo#70797 fix incorrect argument handling of CHISQ.DIST
    
    Change-Id: I6187aa673034e6dc18f48f7b6b7ac88989ab55ec
    Reviewed-on: https://gerrit.libreoffice.org/6914
    Reviewed-by: Eike Rathke <erack at redhat.com>
    Tested-by: Eike Rathke <erack at redhat.com>
    (cherry picked from commit c3760e9099db9cf1be696347e2a0743a3cae1b20)

diff --git a/sc/source/core/inc/interpre.hxx b/sc/source/core/inc/interpre.hxx
index e8eefa3..f8fc0e9 100644
--- a/sc/source/core/inc/interpre.hxx
+++ b/sc/source/core/inc/interpre.hxx
@@ -754,6 +754,7 @@ void ScFDist();
 void ScFDist_LT();
 void ScChiDist();   // for LEGACY.CHIDIST, returns right tail
 void ScChiSqDist(); // returns left tail or density
+void ScChiSqDist_MS();
 void ScChiSqInv(); //invers to CHISQDIST
 void ScWeibull();
 void ScBetaDist();
diff --git a/sc/source/core/tool/interpr3.cxx b/sc/source/core/tool/interpr3.cxx
index 0cb0cc8..8fa0a0e 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 d230ac8..c70fdf4 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;
diff --git a/sc/source/ui/src/scfuncs.src b/sc/source/ui/src/scfuncs.src
index ba670a4..314355c 100644
--- a/sc/source/ui/src/scfuncs.src
+++ b/sc/source/ui/src/scfuncs.src
@@ -7681,7 +7681,7 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS2
         };
         String 7 // Description of Parameter 3
         {
-            Text [ en-US ] = "0 or FALSE calculates the probability density function. Any other value or TRUE or omitted calculates the cumulative distribution function." ;
+            Text [ en-US ] = "0 or FALSE calculates the probability density function. Any other value or TRUE calculates the cumulative distribution function." ;
         };
     };
 


More information about the Libreoffice-commits mailing list