diff options
author | Winfried Donkers <winfrieddonkers@libreoffice.org> | 2016-10-14 17:34:47 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2016-10-24 12:08:33 +0000 |
commit | 536258758a9192ce8985d5055edac600568120fc (patch) | |
tree | 09e142970d5b1c2e5791ff8f5a1b175e297cb200 | |
parent | 602274c77fa8134ca097f4d60b9fb75cea0eff78 (diff) |
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@redhat.com>
Tested-by: Eike Rathke <erack@redhat.com>
-rw-r--r-- | formula/source/core/api/token.cxx | 4 | ||||
-rw-r--r-- | sc/source/core/tool/interpr3.cxx | 13 | ||||
-rw-r--r-- | sc/source/filter/excel/xeformula.cxx | 1 | ||||
-rw-r--r-- | sc/source/ui/src/scfuncs.src | 2 |
4 files changed, 13 insertions, 7 deletions
diff --git a/formula/source/core/api/token.cxx b/formula/source/core/api/token.cxx index 7c85b15552e7..409c4179c704 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 04b0343ba8de..66ca35cb261b 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 b810279e19ca..93261215d9d9 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 84dcc9bd1d1d..061e7a3ac82a 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 |