diff options
-rw-r--r-- | formula/source/core/resource/core_resource.src | 21 | ||||
-rw-r--r-- | include/formula/compiler.hrc | 7 | ||||
-rw-r--r-- | include/formula/opcode.hxx | 3 | ||||
-rw-r--r-- | sc/inc/helpids.h | 3 | ||||
-rw-r--r-- | sc/qa/unit/subsequent_filters-test.cxx | 6 | ||||
-rw-r--r-- | sc/qa/unit/ucalc.cxx | 3 | ||||
-rw-r--r-- | sc/source/core/inc/interpre.hxx | 2 | ||||
-rw-r--r-- | sc/source/core/tool/interpr3.cxx | 4 | ||||
-rw-r--r-- | sc/source/core/tool/interpr4.cxx | 9 | ||||
-rw-r--r-- | sc/source/filter/excel/xlformula.cxx | 5 | ||||
-rw-r--r-- | sc/source/filter/oox/formulabase.cxx | 5 | ||||
-rw-r--r-- | sc/source/ui/src/scfuncs.src | 112 |
12 files changed, 167 insertions, 13 deletions
diff --git a/formula/source/core/resource/core_resource.src b/formula/source/core/resource/core_resource.src index afb1d15f31b8..868a31a84b7e 100644 --- a/formula/source/core/resource/core_resource.src +++ b/formula/source/core/resource/core_resource.src @@ -141,6 +141,7 @@ Resource RID_STRLIST_FUNCTION_NAMES_ENGLISH_ODFF String SC_OPCODE_FISHER_INV { Text = "FISHERINV" ; }; String SC_OPCODE_S_NORM_INV { Text = "LEGACY.NORMSINV" ; }; String SC_OPCODE_GAMMA_LN { Text = "GAMMALN" ; }; + String SC_OPCODE_GAMMA_LN_MS { Text = "COM.MICROSOFT.GAMMALN.PRECISE" ; }; String SC_OPCODE_ERROR_TYPE { Text = "ORG.OPENOFFICE.ERRORTYPE" ; }; String SC_OPCODE_ERR_CELL { Text = "ZellError" ; }; // TODO: ancient legacy only, remove? String SC_OPCODE_FORMULA { Text = "FORMULA"; }; @@ -340,7 +341,9 @@ Resource RID_STRLIST_FUNCTION_NAMES_ENGLISH_ODFF String SC_OPCODE_CHI_INV { Text = "LEGACY.CHIINV" ; }; String SC_OPCODE_CHI_INV_MS { Text = "COM.MICROSOFT.CHISQ.INV.RT" ; }; String SC_OPCODE_GAMMA_DIST { Text = "GAMMADIST" ; }; + String SC_OPCODE_GAMMA_DIST_MS { Text = "COM.MICROSOFT.GAMMA.DIST" ; }; String SC_OPCODE_GAMMA_INV { Text = "GAMMAINV" ; }; + String SC_OPCODE_GAMMA_INV_MS { Text = "COM.MICROSOFT.GAMMA.INV" ; }; String SC_OPCODE_T_INV { Text = "TINV" ; }; String SC_OPCODE_F_INV { Text = "LEGACY.FINV" ; }; String SC_OPCODE_F_INV_LT { Text = "COM.MICROSOFT.F.INV" ; }; @@ -513,6 +516,7 @@ Resource RID_STRLIST_FUNCTION_NAMES_ENGLISH_OOXML String SC_OPCODE_FISHER_INV { Text = "FISHERINV" ; }; String SC_OPCODE_S_NORM_INV { Text = "NORMSINV" ; }; String SC_OPCODE_GAMMA_LN { Text = "GAMMALN" ; }; + String SC_OPCODE_GAMMA_LN_MS { Text = "_xlfn.GAMMALN.PRECISE" ; }; String SC_OPCODE_ERROR_TYPE { Text = "ERRORTYPE" ; }; String SC_OPCODE_ERR_CELL { Text = "ZellError" ; }; // TODO: ancient legacy only, remove? String SC_OPCODE_FORMULA { Text = "_xlfn.FORMULATEXT"; }; @@ -712,7 +716,9 @@ Resource RID_STRLIST_FUNCTION_NAMES_ENGLISH_OOXML String SC_OPCODE_CHI_INV { Text = "CHIINV" ; }; String SC_OPCODE_CHI_INV_MS { Text = "_xlfn.CHISQ.INV.RT" ; }; String SC_OPCODE_GAMMA_DIST { Text = "GAMMADIST" ; }; + String SC_OPCODE_GAMMA_DIST_MS { Text = "_xlfn.GAMMA.DIST" ; }; String SC_OPCODE_GAMMA_INV { Text = "GAMMAINV" ; }; + String SC_OPCODE_GAMMA_INV_MS { Text = "_xlfn.GAMMA.INV" ; }; String SC_OPCODE_T_INV { Text = "TINV" ; }; String SC_OPCODE_F_INV { Text = "FINV" ; }; String SC_OPCODE_F_INV_LT { Text = "_xlfn.F.INV" ; }; @@ -887,6 +893,7 @@ Resource RID_STRLIST_FUNCTION_NAMES_ENGLISH String SC_OPCODE_FISHER_INV { Text = "FISHERINV" ; }; String SC_OPCODE_S_NORM_INV { Text = "NORMSINV" ; }; String SC_OPCODE_GAMMA_LN { Text = "GAMMALN" ; }; + String SC_OPCODE_GAMMA_LN_MS { Text = "GAMMALN.PRECISE" ; }; String SC_OPCODE_ERROR_TYPE { Text = "ERRORTYPE" ; }; String SC_OPCODE_ERR_CELL { Text = "ZellError" ; }; // TODO: ancient legacy only, remove? String SC_OPCODE_FORMULA { Text = "FORMULA"; }; @@ -1086,7 +1093,9 @@ Resource RID_STRLIST_FUNCTION_NAMES_ENGLISH String SC_OPCODE_CHI_INV { Text = "CHIINV" ; }; String SC_OPCODE_CHI_INV_MS { Text = "CHISQ.INV.RT" ; }; String SC_OPCODE_GAMMA_DIST { Text = "GAMMADIST" ; }; + String SC_OPCODE_GAMMA_DIST_MS { Text = "GAMMA.DIST" ; }; String SC_OPCODE_GAMMA_INV { Text = "GAMMAINV" ; }; + String SC_OPCODE_GAMMA_INV_MS { Text = "GAMMA.INV" ; }; String SC_OPCODE_T_INV { Text = "TINV" ; }; String SC_OPCODE_F_INV { Text = "FINV" ; }; String SC_OPCODE_F_INV_LT { Text = "F.INV" ; }; @@ -1538,6 +1547,10 @@ Resource RID_STRLIST_FUNCTION_NAMES { Text [ en-US ] = "GAMMALN" ; }; + String SC_OPCODE_GAMMA_LN_MS + { + Text [ en-US ] = "GAMMALN.PRECISE" ; + }; String SC_OPCODE_ERROR_TYPE { Text [ en-US ] = "ERRORTYPE" ; @@ -2336,10 +2349,18 @@ Resource RID_STRLIST_FUNCTION_NAMES { Text [ en-US ] = "GAMMADIST" ; }; + String SC_OPCODE_GAMMA_DIST_MS + { + Text [ en-US ] = "GAMMA.DIST" ; + }; String SC_OPCODE_GAMMA_INV { Text [ en-US ] = "GAMMAINV" ; }; + String SC_OPCODE_GAMMA_INV_MS + { + Text [ en-US ] = "GAMMA.INV" ; + }; String SC_OPCODE_T_INV { Text [ en-US ] = "TINV" ; diff --git a/include/formula/compiler.hrc b/include/formula/compiler.hrc index 9bda945bae51..b71c74655eda 100644 --- a/include/formula/compiler.hrc +++ b/include/formula/compiler.hrc @@ -192,7 +192,8 @@ #define SC_OPCODE_UNICODE 159 #define SC_OPCODE_UNICHAR 160 #define SC_OPCODE_GAMMA 161 -#define SC_OPCODE_STOP_1_PAR 162 +#define SC_OPCODE_GAMMA_LN_MS 162 +#define SC_OPCODE_STOP_1_PAR 163 /*** Functions with more than one parameters ***/ #define SC_OPCODE_START_2_PAR 201 @@ -434,8 +435,10 @@ #define SC_OPCODE_HYP_GEOM_DIST_MS 436 #define SC_OPCODE_POISSON_DIST_MS 437 #define SC_OPCODE_WEIBULL_MS 438 +#define SC_OPCODE_GAMMA_DIST_MS 439 +#define SC_OPCODE_GAMMA_INV_MS 440 -#define SC_OPCODE_STOP_2_PAR 439 /* last function with two or more parameters' OpCode + 1 */ +#define SC_OPCODE_STOP_2_PAR 441 /* last function with two or more parameters' OpCode + 1 */ #define SC_OPCODE_STOP_FUNCTION SC_OPCODE_STOP_2_PAR /* last function's OpCode + 1 */ #define SC_OPCODE_LAST_OPCODE_ID (SC_OPCODE_STOP_FUNCTION - 1) /* last OpCode */ diff --git a/include/formula/opcode.hxx b/include/formula/opcode.hxx index 58f3d4188ba5..18e2a34212ef 100644 --- a/include/formula/opcode.hxx +++ b/include/formula/opcode.hxx @@ -173,6 +173,7 @@ enum OpCodeEnum ocFisherInv = SC_OPCODE_FISHER_INV, ocSNormInv = SC_OPCODE_S_NORM_INV, ocGammaLn = SC_OPCODE_GAMMA_LN, + ocGammaLn_MS = SC_OPCODE_GAMMA_LN_MS, ocGamma = SC_OPCODE_GAMMA, ocErrorType = SC_OPCODE_ERROR_TYPE, ocErrCell = SC_OPCODE_ERR_CELL, @@ -385,7 +386,9 @@ enum OpCodeEnum ocChiInv = SC_OPCODE_CHI_INV, ocChiInv_MS = SC_OPCODE_CHI_INV_MS, ocGammaDist = SC_OPCODE_GAMMA_DIST, + ocGammaDist_MS = SC_OPCODE_GAMMA_DIST_MS, ocGammaInv = SC_OPCODE_GAMMA_INV, + ocGammaInv_MS = SC_OPCODE_GAMMA_INV_MS, ocTInv = SC_OPCODE_T_INV, ocFInv = SC_OPCODE_F_INV, ocFInv_LT = SC_OPCODE_F_INV_LT, diff --git a/sc/inc/helpids.h b/sc/inc/helpids.h index e1c2dac2e18c..05e66e56b6df 100644 --- a/sc/inc/helpids.h +++ b/sc/inc/helpids.h @@ -704,5 +704,8 @@ #define HID_FUNC_HYP_GEOM_DIST_MS "SC_HID_FUNC_HYP_GEOM_DIST_MS" #define HID_FUNC_POISSON_DIST_MS "SC_HID_FUNC_POISSON_DIST_MS" #define HID_FUNC_WEIBULL_DIST_MS "SC_HID_FUNC_WEIBULL_DIST_MS" +#define HID_FUNC_GAMMADIST_MS "SC_HID_FUNC_GAMMADIST_MS" +#define HID_FUNC_GAMMAINV_MS "SC_HID_FUNC_GAMMAINV_MS" +#define HID_FUNC_GAMMALN_MS "SC_HID_FUNC_GAMMALN_MS" /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index 581734beac4e..a05b161fc716 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -415,9 +415,9 @@ void ScFiltersTest::testFunctionsExcel2010() { 28, true }, { 29, true }, { 30, false }, - { 31, false }, - { 32, false }, - { 33, false }, + { 31, true }, + { 32, true }, + { 33, true }, { 34, true }, { 35, true }, { 36, false }, diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index 12b4ac7df201..809b4c6b7311 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -2403,9 +2403,12 @@ void Test::testFunctionLists() "FORECAST", "FTEST", "GAMMA", + "GAMMA.DIST", + "GAMMA.INV", "GAMMADIST", "GAMMAINV", "GAMMALN", + "GAMMALN.PRECISE", "GAUSS", "GEOMEAN", "HARMEAN", diff --git a/sc/source/core/inc/interpre.hxx b/sc/source/core/inc/interpre.hxx index e8eefa33bb68..4f60718b7e77 100644 --- a/sc/source/core/inc/interpre.hxx +++ b/sc/source/core/inc/interpre.hxx @@ -735,7 +735,7 @@ void ScFisher(); void ScFisherInv(); void ScFact(); void ScNormDist(); -void ScGammaDist(); +void ScGammaDist( int nMinParamCount ); void ScGammaInv(); void ScExpDist(); void ScBinomDist(); diff --git a/sc/source/core/tool/interpr3.cxx b/sc/source/core/tool/interpr3.cxx index 0cb0cc8b902a..9f5aa000d6d3 100644 --- a/sc/source/core/tool/interpr3.cxx +++ b/sc/source/core/tool/interpr3.cxx @@ -2011,10 +2011,10 @@ double ScInterpreter::GetHypGeomDist( double x, double n, double M, double N ) return fFactor; } -void ScInterpreter::ScGammaDist() +void ScInterpreter::ScGammaDist( int nMinParamCount ) { sal_uInt8 nParamCount = GetByte(); - if ( !MustHaveParamCount( nParamCount, 3, 4 ) ) + if ( !MustHaveParamCount( nParamCount, nMinParamCount, 4 ) ) return; double bCumulative; if (nParamCount == 4) diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx index d230ac896872..2a92252bbc12 100644 --- a/sc/source/core/tool/interpr4.cxx +++ b/sc/source/core/tool/interpr4.cxx @@ -4169,10 +4169,13 @@ StackVar ScInterpreter::Interpret() case ocRGP : ScRGP(); break; case ocRKP : ScRKP(); break; case ocForecast : ScForecast(); break; - case ocGammaLn : ScLogGamma(); break; + case ocGammaLn : + case ocGammaLn_MS : ScLogGamma(); break; case ocGamma : ScGamma(); break; - case ocGammaDist : ScGammaDist(); break; - case ocGammaInv : ScGammaInv(); break; + case ocGammaDist : ScGammaDist( 3 ); break; + case ocGammaDist_MS : ScGammaDist( 4 ); break; + case ocGammaInv : + case ocGammaInv_MS : ScGammaInv(); break; case ocChiTest : case ocChiTest_MS : ScChiTest(); break; case ocChiInv : diff --git a/sc/source/filter/excel/xlformula.cxx b/sc/source/filter/excel/xlformula.cxx index 67d21ee0f313..45db3ca6634e 100644 --- a/sc/source/filter/excel/xlformula.cxx +++ b/sc/source/filter/excel/xlformula.cxx @@ -454,7 +454,10 @@ static const XclFunctionInfo saFuncTable_2010[] = EXC_FUNCENTRY_V_VR( ocExpDist_MS, 3, 3, 0, "EXPON.DIST" ), EXC_FUNCENTRY_V_VR( ocHypGeomDist_MS, 5, 5, 0, "HYPGEOM.DIST" ), EXC_FUNCENTRY_V_VR( ocPoissonDist_MS, 3, 3, 0, "POISSON.DIST" ), - EXC_FUNCENTRY_V_VR( ocWeibull_MS, 4, 4, 0, "WEIBULL.DIST" ) + EXC_FUNCENTRY_V_VR( ocWeibull_MS, 4, 4, 0, "WEIBULL.DIST" ), + EXC_FUNCENTRY_V_VR( ocGammaDist_MS, 4, 4, 0, "GAMMA.DIST" ), + EXC_FUNCENTRY_V_VR( ocGammaInv_MS, 3, 3, 0, "GAMMA.INV" ), + EXC_FUNCENTRY_V_VR( ocGammaLn_MS, 1, 1, 0, "GAMMALN.PRECISE" ) }; /** Functions new in Excel 2013. diff --git a/sc/source/filter/oox/formulabase.cxx b/sc/source/filter/oox/formulabase.cxx index ef8c92622562..30abf6728ca4 100644 --- a/sc/source/filter/oox/formulabase.cxx +++ b/sc/source/filter/oox/formulabase.cxx @@ -772,7 +772,10 @@ static const FunctionData saFuncTable2010[] = { "COM.MICROSOFT.EXPON.DIST", "EXPON.DIST", NOID, NOID, 3, 3, V, { VR }, FUNCFLAG_MACROCALL_NEW }, { "COM.MICROSOFT.HYPGEOM.DIST", "HYPGEOM.DIST", NOID, NOID, 5, 5, V, { VR }, FUNCFLAG_MACROCALL_NEW }, { "COM.MICROSOFT.POISSON.DIST", "POISSON.DIST", NOID, NOID, 3, 3, V, { VR }, FUNCFLAG_MACROCALL_NEW }, - { "COM.MICROSOFT.WEIBULL.DIST", "WEIBULL.DIST", NOID, NOID, 4, 4, V, { VR }, FUNCFLAG_MACROCALL_NEW } + { "COM.MICROSOFT.WEIBULL.DIST", "WEIBULL.DIST", NOID, NOID, 4, 4, V, { VR }, FUNCFLAG_MACROCALL_NEW }, + { "COM.MICROSOFT.GAMMA.DIST", "GAMMA.DIST", NOID, NOID, 4, 4, V, { VR }, FUNCFLAG_MACROCALL_NEW }, + { "COM.MICROSOFT.GAMMA.INV", "GAMMA.INV", NOID, NOID, 3, 3, V, { VR }, FUNCFLAG_MACROCALL_NEW }, + { "COM.MICROSOFT.GAMMALN.PRECISE", "GAMMALN.PRECISE", NOID, NOID, 1, 1, V, { VR }, FUNCFLAG_MACROCALL_NEW } }; /** Functions new in Excel 2013. diff --git a/sc/source/ui/src/scfuncs.src b/sc/source/ui/src/scfuncs.src index ba670a40e15a..d761adec9810 100644 --- a/sc/source/ui/src/scfuncs.src +++ b/sc/source/ui/src/scfuncs.src @@ -6687,6 +6687,54 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS2 Text [ en-US ] = "0 or FALSE calculates the probability density function. Any other value or TRUE or omitted calculates the cumulative distribution function." ; }; }; + // -=*# Resource for function GAMMA.DIST #*=- + Resource SC_OPCODE_GAMMA_DIST_MS + { + String 1 // Description + { + Text [ en-US ] = "Returns the value of the probability density function or the cumulative distribution function for the Gamma distribution." ; + }; + ExtraData = + { + 0; + ID_FUNCTION_GRP_STATISTIC; + U2S( HID_FUNC_GAMMADIST_MS ); + 4; 0; 0; 0; 0; + 0; + }; + String 2 // Name of Parameter 1 + { + Text [ en-US ] = "Number" ; + }; + String 3 // Description of Parameter 1 + { + Text [ en-US ] = "The value for which the gamma distribution is to be calculated." ; + }; + String 4 // Name of Parameter 2 + { + Text [ en-US ] = "alpha" ; + }; + String 5 // Description of Parameter 2 + { + Text [ en-US ] = "The Alpha parameter of the Gamma distribution." ; + }; + String 6 // Name of Parameter 3 + { + Text [ en-US ] = "beta" ; + }; + String 7 // Description of Parameter 3 + { + Text [ en-US ] = "The Beta parameter of the Gamma distribution." ; + }; + String 8 // Name of Parameter 4 + { + Text [ en-US ] = "Cumulative" ; + }; + String 9 // Description of Parameter 4 + { + Text [ en-US ] = "0 or FALSE calculates the probability density function. Any other value or TRUE calculates the cumulative distribution function." ; + }; + }; // -=*# Resource for function GAMMAINV #*=- Resource SC_OPCODE_GAMMA_INV { @@ -6727,6 +6775,46 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS2 Text [ en-US ] = "The Beta (scale) parameter of the Gamma distribution." ; }; }; + // -=*# Resource for function GAMMA.INV #*=- + Resource SC_OPCODE_GAMMA_INV_MS + { + String 1 // Description + { + Text [ en-US ] = "Values of the inverse gamma distribution." ; + }; + ExtraData = + { + 0; + ID_FUNCTION_GRP_STATISTIC; + U2S( HID_FUNC_GAMMAINV_MS ); + 3; 0; 0; 0; + 0; + }; + String 2 // Name of Parameter 1 + { + Text [ en-US ] = "Number" ; + }; + String 3 // Description of Parameter 1 + { + Text [ en-US ] = "The probability value for which the inverse gamma distribution is to be calculated." ; + }; + String 4 // Name of Parameter 2 + { + Text [ en-US ] = "alpha" ; + }; + String 5 // Description of Parameter 2 + { + Text [ en-US ] = "The Alpha (shape) parameter of the Gamma distribution." ; + }; + String 6 // Name of Parameter 3 + { + Text [ en-US ] = "beta" ; + }; + String 7 // Description of Parameter 3 + { + Text [ en-US ] = "The Beta (scale) parameter of the Gamma distribution." ; + }; + }; // -=*# Resource for function GAMMALN #*=- Resource SC_OPCODE_GAMMA_LN { @@ -6751,6 +6839,30 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS2 Text [ en-US ] = "The value for which the natural logarithm of the gamma function is to be calculated." ; }; }; + // -=*# Resource for function GAMMALN.PRECISE #*=- + Resource SC_OPCODE_GAMMA_LN_MS + { + String 1 // Description + { + Text [ en-US ] = "Returns the natural logarithm of the gamma function." ; + }; + ExtraData = + { + 0; + ID_FUNCTION_GRP_STATISTIC; + U2S( HID_FUNC_GAMMALN_MS ); + 1; 0; + 0; + }; + String 2 // Name of Parameter 1 + { + Text [ en-US ] = "Number" ; + }; + String 3 // Description of Parameter 1 + { + Text [ en-US ] = "The value for which the natural logarithm of the gamma function is to be calculated." ; + }; + }; // -=*# Resource for function GAMMA #*=- Resource SC_OPCODE_GAMMA |