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

Winfried Donkers winfrieddonkers at libreoffice.org
Mon Oct 24 12:08:54 UTC 2016


 formula/source/core/api/token.cxx    |    4 ++++
 sc/source/core/tool/interpr3.cxx     |   13 +++++++------
 sc/source/filter/excel/xeformula.cxx |    1 +
 sc/source/ui/src/scfuncs.src         |    2 +-
 4 files changed, 13 insertions(+), 7 deletions(-)

New commits:
commit 536258758a9192ce8985d5055edac600568120fc
Author: Winfried Donkers <winfrieddonkers at libreoffice.org>
Date:   Fri Oct 14 17:34:47 2016 +0200

    tdf#103186, make LOGINV ODFF1.2 compliant.
    
    (Also retain Excel-interoperability and backward compatibility with Calc.)
    
    Change-Id: Ibbe7224eabfb776cf6e7ecfeabae6d188178f4ed
    Reviewed-on: https://gerrit.libreoffice.org/29885
    Reviewed-by: Eike Rathke <erack at redhat.com>
    Tested-by: Eike Rathke <erack at redhat.com>

diff --git a/formula/source/core/api/token.cxx b/formula/source/core/api/token.cxx
index 7c85b15..409c417 100644
--- a/formula/source/core/api/token.cxx
+++ b/formula/source/core/api/token.cxx
@@ -1069,6 +1069,7 @@ inline bool MissingConventionODF::isRewriteNeeded( OpCode eOp ) const
         case ocGammaDist:
         case ocPoissonDist:
         case ocAddress:
+        case ocLogInv:
         case ocLogNormDist:
         case ocNormDist:
             return true;
@@ -1113,6 +1114,7 @@ inline bool MissingConventionOOXML::isRewriteNeeded( OpCode eOp )
         case ocFDist_LT:
         case ocPoissonDist:
         case ocNormDist:
+        case ocLogInv:
         case ocLogNormDist:
         case ocHypGeomDist:
 
@@ -1171,6 +1173,7 @@ void FormulaMissingContext::AddMoreArgs( FormulaTokenArray *pNewArr, const Missi
                             pNewArr->AddDouble( 1.0 );      // 4th, Cumulative=true()
                         }
                         break;
+                    case ocLogInv:
                     case ocLogNormDist:
                         if ( mnCurArg == 0 )
                         {
@@ -1236,6 +1239,7 @@ void FormulaMissingContext::AddMoreArgs( FormulaTokenArray *pNewArr, const Missi
                         }
                         break;
 
+                    case ocLogInv:
                     case ocLogNormDist:
                         if ( mnCurArg == 0 )
                         {
diff --git a/sc/source/core/tool/interpr3.cxx b/sc/source/core/tool/interpr3.cxx
index 04b0343..66ca35c 100644
--- a/sc/source/core/tool/interpr3.cxx
+++ b/sc/source/core/tool/interpr3.cxx
@@ -2147,15 +2147,16 @@ void ScInterpreter::ScSNormInv()
 
 void ScInterpreter::ScLogNormInv()
 {
-    if ( MustHaveParamCount( GetByte(), 3 ) )
+    sal_uInt8 nParamCount = GetByte();
+    if ( MustHaveParamCount( nParamCount, 1, 3 ) )
     {
-        double sigma = GetDouble();                 // Stdabw
-        double mue = GetDouble();                   // Mittelwert
-        double y = GetDouble();                     // y
-        if (sigma <= 0.0 || y <= 0.0 || y >= 1.0)
+        double fSigma = ( nParamCount == 3 ? GetDouble() : 1.0 );  // Stddev
+        double fMue = ( nParamCount >= 2 ? GetDouble() : 0.0 );    // Mean
+        double fP = GetDouble();                                   // p
+        if ( fSigma <= 0.0 || fP <= 0.0 || fP >= 1.0 )
             PushIllegalArgument();
         else
-            PushDouble(exp(mue+sigma*gaussinv(y)));
+            PushDouble( exp( fMue + fSigma * gaussinv( fP ) ) );
     }
 }
 
diff --git a/sc/source/filter/excel/xeformula.cxx b/sc/source/filter/excel/xeformula.cxx
index b810279..9326121 100644
--- a/sc/source/filter/excel/xeformula.cxx
+++ b/sc/source/filter/excel/xeformula.cxx
@@ -1736,6 +1736,7 @@ void XclExpFmlaCompImpl::AppendTrailingParam( XclExpFuncData& rFuncData )
         break;
 
         case ocLogNormDist:
+        case ocLogInv:
             switch( nParamCount )
              {
                 // LOGNORMDIST function needs 3 parameters in Excel
diff --git a/sc/source/ui/src/scfuncs.src b/sc/source/ui/src/scfuncs.src
index 84dcc9b..061e7a3 100644
--- a/sc/source/ui/src/scfuncs.src
+++ b/sc/source/ui/src/scfuncs.src
@@ -7600,7 +7600,7 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS2
             0;
             ID_FUNCTION_GRP_STATISTIC;
             HID_FUNC_LOGINV;
-            3;  0;  0;  0;
+            3;  0;  1;  1;
             0;
         };
         String 2 // Name of Parameter 1


More information about the Libreoffice-commits mailing list