diff options
author | Winfried Donkers <winfrieddonkers@libreoffice.org> | 2013-12-01 12:40:41 +0100 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2013-12-16 20:25:45 +0000 |
commit | 924f9d7ea89899848dba512a428e5f64e44ee534 (patch) | |
tree | 0ca63f18f14a266910227448e1be6a0bac0f4748 | |
parent | 70ce8987feeb06255eaeb7663bb076a8f4e0593f (diff) |
fdo#72158 Add Excel 2010 functions
LOGNORM.DIST, LOGNORM.INV, NORM.DIST, NORM.INV, NORM.S.DIST, NORM.S.INV
Change-Id: I695e0645642af1757a1dd7d7f0f15c9515e21309
Reviewed-on: https://gerrit.libreoffice.org/6883
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Eike Rathke <erack@redhat.com>
-rw-r--r-- | formula/source/core/resource/core_resource.src | 42 | ||||
-rw-r--r-- | include/formula/compiler.hrc | 8 | ||||
-rw-r--r-- | include/formula/opcode.hxx | 6 | ||||
-rw-r--r-- | sc/inc/helpids.h | 6 | ||||
-rw-r--r-- | sc/qa/unit/subsequent_filters-test.cxx | 18 | ||||
-rw-r--r-- | sc/qa/unit/ucalc.cxx | 6 | ||||
-rw-r--r-- | sc/source/core/inc/interpre.hxx | 5 | ||||
-rw-r--r-- | sc/source/core/tool/interpr3.cxx | 22 | ||||
-rw-r--r-- | sc/source/core/tool/interpr4.cxx | 16 | ||||
-rw-r--r-- | sc/source/filter/excel/xlformula.cxx | 8 | ||||
-rw-r--r-- | sc/source/filter/oox/formulabase.cxx | 8 | ||||
-rw-r--r-- | sc/source/ui/src/scfuncs.src | 232 |
12 files changed, 354 insertions, 23 deletions
diff --git a/formula/source/core/resource/core_resource.src b/formula/source/core/resource/core_resource.src index 84faa58d96c0..fbd35034ddd0 100644 --- a/formula/source/core/resource/core_resource.src +++ b/formula/source/core/resource/core_resource.src @@ -137,9 +137,11 @@ Resource RID_STRLIST_FUNCTION_NAMES_ENGLISH_ODFF String SC_OPCODE_EVEN { Text = "EVEN" ; }; String SC_OPCODE_ODD { Text = "ODD" ; }; String SC_OPCODE_STD_NORM_DIST { Text = "LEGACY.NORMSDIST" ; }; + String SC_OPCODE_STD_NORM_DIST_MS { Text = "COM.MICROSOFT.NORM.S.DIST" ; }; String SC_OPCODE_FISHER { Text = "FISHER" ; }; String SC_OPCODE_FISHER_INV { Text = "FISHERINV" ; }; String SC_OPCODE_S_NORM_INV { Text = "LEGACY.NORMSINV" ; }; + String SC_OPCODE_S_NORM_INV_MS { Text = "COM.MICROSOFT.NORM.S.INV" ; }; 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" ; }; @@ -194,6 +196,7 @@ Resource RID_STRLIST_FUNCTION_NAMES_ENGLISH_ODFF String SC_OPCODE_ST_DEV_S { Text = "COM.MICROSOFT.STDEV.S" ; }; String SC_OPCODE_B { Text = "BINOM.DIST.RANGE" ; }; String SC_OPCODE_NORM_DIST { Text = "NORMDIST" ; }; + String SC_OPCODE_NORM_DIST_MS { Text = "COM.MICROSOFT.NORM.DIST" ; }; String SC_OPCODE_EXP_DIST { Text = "EXPONDIST" ; }; String SC_OPCODE_EXP_DIST_MS { Text = "COM.MICROSOFT.EXPON.DIST" ; }; String SC_OPCODE_BINOM_DIST { Text = "BINOMDIST" ; }; @@ -285,6 +288,7 @@ Resource RID_STRLIST_FUNCTION_NAMES_ENGLISH_ODFF String SC_OPCODE_HYP_GEOM_DIST { Text = "HYPGEOMDIST" ; }; String SC_OPCODE_HYP_GEOM_DIST_MS { Text = "COM.MICROSOFT.HYPGEOM.DIST" ; }; String SC_OPCODE_LOG_NORM_DIST { Text = "LOGNORMDIST" ; }; + String SC_OPCODE_LOG_NORM_DIST_MS { Text = "COM.MICROSOFT.LOGNORM.DIST" ; }; String SC_OPCODE_T_DIST { Text = "LEGACY.TDIST" ; }; String SC_OPCODE_F_DIST { Text = "LEGACY.FDIST" ; }; String SC_OPCODE_F_DIST_LT { Text = "COM.MICROSOFT.F.DIST" ; }; @@ -316,6 +320,7 @@ Resource RID_STRLIST_FUNCTION_NAMES_ENGLISH_ODFF String SC_OPCODE_FREQUENCY { Text = "FREQUENCY" ; }; String SC_OPCODE_QUARTILE { Text = "QUARTILE" ; }; String SC_OPCODE_NORM_INV { Text = "NORMINV" ; }; + String SC_OPCODE_NORM_INV_MS { Text = "COM.MICROSOFT.NORM.INV" ; }; String SC_OPCODE_CONFIDENCE { Text = "CONFIDENCE" ; }; String SC_OPCODE_CONFIDENCE_N { Text = "COM.MICROSOFT.CONFIDENCE.NORM" ; }; String SC_OPCODE_CONFIDENCE_T { Text = "COM.MICROSOFT.CONFIDENCE.T" ; }; @@ -350,6 +355,7 @@ Resource RID_STRLIST_FUNCTION_NAMES_ENGLISH_ODFF String SC_OPCODE_CHI_TEST { Text = "LEGACY.CHITEST" ; }; String SC_OPCODE_CHI_TEST_MS { Text = "COM.MICROSOFT.CHISQ.TEST" ; }; String SC_OPCODE_LOG_INV { Text = "LOGINV" ; }; + String SC_OPCODE_LOG_INV_MS { Text = "COM.MICROSOFT.LOGNORM.INV" ; }; String SC_OPCODE_TABLE_OP { Text = "MULTIPLE.OPERATIONS" ; }; String SC_OPCODE_BETA_DIST { Text = "BETADIST" ; }; String SC_OPCODE_BETA_INV { Text = "BETAINV" ; }; @@ -511,9 +517,11 @@ Resource RID_STRLIST_FUNCTION_NAMES_ENGLISH_OOXML String SC_OPCODE_EVEN { Text = "EVEN" ; }; String SC_OPCODE_ODD { Text = "ODD" ; }; String SC_OPCODE_STD_NORM_DIST { Text = "NORMSDIST" ; }; + String SC_OPCODE_STD_NORM_DIST_MS { Text = "_xlfn.NORM.S.DIST" ; }; String SC_OPCODE_FISHER { Text = "FISHER" ; }; String SC_OPCODE_FISHER_INV { Text = "FISHERINV" ; }; String SC_OPCODE_S_NORM_INV { Text = "NORMSINV" ; }; + String SC_OPCODE_S_NORM_INV_MS { Text = "_xlfn.NORM.S.INV" ; }; String SC_OPCODE_GAMMA_LN { Text = "GAMMALN" ; }; String SC_OPCODE_GAMMA_LN_MS { Text = "_xlfn.GAMMALN.PRECISE" ; }; String SC_OPCODE_ERROR_TYPE { Text = "ERRORTYPE" ; }; @@ -568,6 +576,7 @@ Resource RID_STRLIST_FUNCTION_NAMES_ENGLISH_OOXML String SC_OPCODE_ST_DEV_S { Text = "_xlfn.STDEV.S" ; }; String SC_OPCODE_B { Text = "B" ; }; String SC_OPCODE_NORM_DIST { Text = "NORMDIST" ; }; + String SC_OPCODE_NORM_DIST_MS { Text = "_xlfn.NORM.DIST" ; }; String SC_OPCODE_EXP_DIST { Text = "EXPONDIST" ; }; String SC_OPCODE_EXP_DIST_MS { Text = "_xlfn.EXPON.DIST" ; }; String SC_OPCODE_BINOM_DIST { Text = "BINOMDIST" ; }; @@ -659,6 +668,7 @@ Resource RID_STRLIST_FUNCTION_NAMES_ENGLISH_OOXML String SC_OPCODE_HYP_GEOM_DIST { Text = "HYPGEOMDIST" ; }; String SC_OPCODE_HYP_GEOM_DIST_MS { Text = "_xlfn.HYPGEOM.DIST" ; }; String SC_OPCODE_LOG_NORM_DIST { Text = "LOGNORMDIST" ; }; + String SC_OPCODE_LOG_NORM_DIST_MS { Text = "_xlfn.LOGNORM.DIST" ; }; String SC_OPCODE_T_DIST { Text = "TDIST" ; }; String SC_OPCODE_F_DIST { Text = "FDIST" ; }; String SC_OPCODE_F_DIST_LT { Text = "_xlfn.F.DIST" ; }; @@ -690,6 +700,7 @@ Resource RID_STRLIST_FUNCTION_NAMES_ENGLISH_OOXML String SC_OPCODE_FREQUENCY { Text = "FREQUENCY" ; }; String SC_OPCODE_QUARTILE { Text = "QUARTILE" ; }; String SC_OPCODE_NORM_INV { Text = "NORMINV" ; }; + String SC_OPCODE_NORM_INV_MS { Text = "_xlfn.NORM.INV" ; }; String SC_OPCODE_CONFIDENCE { Text = "CONFIDENCE" ; }; String SC_OPCODE_CONFIDENCE_N { Text = "_xlfn.CONFIDENCE.NORM" ; }; String SC_OPCODE_CONFIDENCE_T { Text = "_xlfn.CONFIDENCE.T" ; }; @@ -724,6 +735,7 @@ Resource RID_STRLIST_FUNCTION_NAMES_ENGLISH_OOXML String SC_OPCODE_CHI_TEST { Text = "CHITEST" ; }; String SC_OPCODE_CHI_TEST_MS { Text = "_xlfn.CHISQ.TEST" ; }; String SC_OPCODE_LOG_INV { Text = "LOGINV" ; }; + String SC_OPCODE_LOG_INV_MS { Text = "_xlfn.LOGNORM.INV" ; }; String SC_OPCODE_TABLE_OP { Text = "TABLE" ; }; String SC_OPCODE_BETA_DIST { Text = "BETADIST" ; }; String SC_OPCODE_BETA_INV { Text = "BETAINV" ; }; @@ -887,9 +899,11 @@ Resource RID_STRLIST_FUNCTION_NAMES_ENGLISH String SC_OPCODE_EVEN { Text = "EVEN" ; }; String SC_OPCODE_ODD { Text = "ODD" ; }; String SC_OPCODE_STD_NORM_DIST { Text = "NORMSDIST" ; }; + String SC_OPCODE_STD_NORM_DIST_MS { Text = "NORM.S.DIST" ; }; String SC_OPCODE_FISHER { Text = "FISHER" ; }; String SC_OPCODE_FISHER_INV { Text = "FISHERINV" ; }; String SC_OPCODE_S_NORM_INV { Text = "NORMSINV" ; }; + String SC_OPCODE_S_NORM_INV_MS { Text = "NORM.S.INV" ; }; String SC_OPCODE_GAMMA_LN { Text = "GAMMALN" ; }; String SC_OPCODE_GAMMA_LN_MS { Text = "GAMMALN.PRECISE" ; }; String SC_OPCODE_ERROR_TYPE { Text = "ERRORTYPE" ; }; @@ -944,6 +958,7 @@ Resource RID_STRLIST_FUNCTION_NAMES_ENGLISH String SC_OPCODE_ST_DEV_S { Text = "STDEV.S" ; }; String SC_OPCODE_B { Text = "B" ; }; String SC_OPCODE_NORM_DIST { Text = "NORMDIST" ; }; + String SC_OPCODE_NORM_DIST_MS { Text = "NORM.DIST" ; }; String SC_OPCODE_EXP_DIST { Text = "EXPONDIST" ; }; String SC_OPCODE_EXP_DIST_MS { Text = "EXPON.DIST" ; }; String SC_OPCODE_BINOM_DIST { Text = "BINOMDIST" ; }; @@ -1035,6 +1050,7 @@ Resource RID_STRLIST_FUNCTION_NAMES_ENGLISH String SC_OPCODE_HYP_GEOM_DIST { Text = "HYPGEOMDIST" ; }; String SC_OPCODE_HYP_GEOM_DIST_MS { Text = "HYPGEOM.DIST" ; }; String SC_OPCODE_LOG_NORM_DIST { Text = "LOGNORMDIST" ; }; + String SC_OPCODE_LOG_NORM_DIST_MS { Text = "LOGNORM.DIST" ; }; String SC_OPCODE_T_DIST { Text = "TDIST" ; }; String SC_OPCODE_F_DIST { Text = "FDIST" ; }; String SC_OPCODE_F_DIST_LT { Text = "F.DIST" ; }; @@ -1066,6 +1082,7 @@ Resource RID_STRLIST_FUNCTION_NAMES_ENGLISH String SC_OPCODE_FREQUENCY { Text = "FREQUENCY" ; }; String SC_OPCODE_QUARTILE { Text = "QUARTILE" ; }; String SC_OPCODE_NORM_INV { Text = "NORMINV" ; }; + String SC_OPCODE_NORM_INV_MS { Text = "NORM.INV" ; }; String SC_OPCODE_CONFIDENCE { Text = "CONFIDENCE" ; }; String SC_OPCODE_CONFIDENCE_N { Text = "CONFIDENCE.NORM" ; }; String SC_OPCODE_CONFIDENCE_T { Text = "CONFIDENCE.T" ; }; @@ -1100,6 +1117,7 @@ Resource RID_STRLIST_FUNCTION_NAMES_ENGLISH String SC_OPCODE_CHI_TEST { Text = "CHITEST" ; }; String SC_OPCODE_CHI_TEST_MS { Text = "CHISQ.TEST" ; }; String SC_OPCODE_LOG_INV { Text = "LOGINV" ; }; + String SC_OPCODE_LOG_INV_MS { Text = "LOGNORM.INV" ; }; String SC_OPCODE_TABLE_OP { Text = "TABLE" ; }; String SC_OPCODE_BETA_DIST { Text = "BETADIST" ; }; String SC_OPCODE_BETA_INV { Text = "BETAINV" ; }; @@ -1528,6 +1546,10 @@ Resource RID_STRLIST_FUNCTION_NAMES { Text [ en-US ] = "NORMSDIST" ; }; + String SC_OPCODE_STD_NORM_DIST_MS + { + Text = "NORM.S.DIST" ; + }; String SC_OPCODE_FISHER { Text [ en-US ] = "FISHER"; @@ -1540,6 +1562,10 @@ Resource RID_STRLIST_FUNCTION_NAMES { Text [ en-US ] = "NORMSINV" ; }; + String SC_OPCODE_S_NORM_INV_MS + { + Text = "NORM.S.INV" ; + }; String SC_OPCODE_GAMMA_LN { Text [ en-US ] = "GAMMALN" ; @@ -1760,6 +1786,10 @@ Resource RID_STRLIST_FUNCTION_NAMES { Text [ en-US ] = "NORMDIST" ; }; + String SC_OPCODE_NORM_DIST_MS + { + Text = "NORM.DIST" ; + }; String SC_OPCODE_EXP_DIST { Text [ en-US ] = "EXPONDIST" ; @@ -2125,6 +2155,10 @@ Resource RID_STRLIST_FUNCTION_NAMES { Text [ en-US ] = "LOGNORMDIST" ; }; + String SC_OPCODE_LOG_NORM_DIST_MS + { + Text [ en-US ] = "LOGNORM.DIST" ; + }; String SC_OPCODE_T_DIST { Text [ en-US ] = "TDIST" ; @@ -2249,6 +2283,10 @@ Resource RID_STRLIST_FUNCTION_NAMES { Text [ en-US ] = "NORMINV" ; }; + String SC_OPCODE_NORM_INV_MS + { + Text = "NORM.INV" ; + }; String SC_OPCODE_CONFIDENCE { Text [ en-US ] = "CONFIDENCE" ; @@ -2385,6 +2423,10 @@ Resource RID_STRLIST_FUNCTION_NAMES { Text [ en-US ] = "LOGINV" ; }; + String SC_OPCODE_LOG_INV_MS + { + Text = "LOGNORM.INV" ; + }; String SC_OPCODE_TABLE_OP { Text [ en-US ] = "MULTIPLE.OPERATIONS" ; diff --git a/include/formula/compiler.hrc b/include/formula/compiler.hrc index 7dacf30739a6..3b7207c5883d 100644 --- a/include/formula/compiler.hrc +++ b/include/formula/compiler.hrc @@ -436,8 +436,14 @@ #define SC_OPCODE_WEIBULL_MS 438 #define SC_OPCODE_GAMMA_DIST_MS 439 #define SC_OPCODE_GAMMA_INV_MS 440 +#define SC_OPCODE_LOG_NORM_DIST_MS 441 +#define SC_OPCODE_LOG_INV_MS 442 +#define SC_OPCODE_NORM_DIST_MS 443 +#define SC_OPCODE_NORM_INV_MS 444 +#define SC_OPCODE_STD_NORM_DIST_MS 445 +#define SC_OPCODE_S_NORM_INV_MS 446 -#define SC_OPCODE_STOP_2_PAR 441 /* last function with two or more parameters' OpCode + 1 */ +#define SC_OPCODE_STOP_2_PAR 447 /* 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 0b08532ae439..d978a2654834 100644 --- a/include/formula/opcode.hxx +++ b/include/formula/opcode.hxx @@ -169,9 +169,11 @@ enum OpCodeEnum ocEven = SC_OPCODE_EVEN, ocOdd = SC_OPCODE_ODD, ocStdNormDist = SC_OPCODE_STD_NORM_DIST, + ocStdNormDist_MS = SC_OPCODE_STD_NORM_DIST_MS, ocFisher = SC_OPCODE_FISHER, ocFisherInv = SC_OPCODE_FISHER_INV, ocSNormInv = SC_OPCODE_S_NORM_INV, + ocSNormInv_MS = SC_OPCODE_S_NORM_INV_MS, ocGammaLn = SC_OPCODE_GAMMA_LN, ocGammaLn_MS = SC_OPCODE_GAMMA_LN_MS, ocGamma = SC_OPCODE_GAMMA, @@ -228,6 +230,7 @@ enum OpCodeEnum ocStDevS = SC_OPCODE_ST_DEV_S, ocB = SC_OPCODE_B, ocNormDist = SC_OPCODE_NORM_DIST, + ocNormDist_MS = SC_OPCODE_NORM_DIST_MS, ocExpDist = SC_OPCODE_EXP_DIST, ocExpDist_MS = SC_OPCODE_EXP_DIST_MS, ocBinomDist = SC_OPCODE_BINOM_DIST, @@ -327,6 +330,7 @@ enum OpCodeEnum ocHypGeomDist = SC_OPCODE_HYP_GEOM_DIST, ocHypGeomDist_MS = SC_OPCODE_HYP_GEOM_DIST_MS, ocLogNormDist = SC_OPCODE_LOG_NORM_DIST, + ocLogNormDist_MS = SC_OPCODE_LOG_NORM_DIST_MS, ocTDist = SC_OPCODE_T_DIST, ocFDist = SC_OPCODE_F_DIST, ocFDist_LT = SC_OPCODE_F_DIST_LT, @@ -361,6 +365,7 @@ enum OpCodeEnum ocFrequency = SC_OPCODE_FREQUENCY, ocQuartile = SC_OPCODE_QUARTILE, ocNormInv = SC_OPCODE_NORM_INV, + ocNormInv_MS = SC_OPCODE_NORM_INV_MS, ocConfidence = SC_OPCODE_CONFIDENCE, ocConfidence_N = SC_OPCODE_CONFIDENCE_N, ocConfidence_T = SC_OPCODE_CONFIDENCE_T, @@ -395,6 +400,7 @@ enum OpCodeEnum ocChiTest = SC_OPCODE_CHI_TEST, ocChiTest_MS = SC_OPCODE_CHI_TEST_MS, ocLogInv = SC_OPCODE_LOG_INV, + ocLogInv_MS = SC_OPCODE_LOG_INV_MS, ocTableOp = SC_OPCODE_TABLE_OP, ocBetaDist = SC_OPCODE_BETA_DIST, ocBetaInv = SC_OPCODE_BETA_INV, diff --git a/sc/inc/helpids.h b/sc/inc/helpids.h index 05e66e56b6df..51f973bbb03e 100644 --- a/sc/inc/helpids.h +++ b/sc/inc/helpids.h @@ -707,5 +707,11 @@ #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" +#define HID_FUNC_LOGNORMDIST_MS "SC_HID_FUNC_LOGNORMDIST_MS" +#define HID_FUNC_LOGINV_MS "SC_HID_FUNC_LOGINV_MS" +#define HID_FUNC_NORMDIST_MS "SC_HID_FUNC_NORMDIST_MS" +#define HID_FUNC_NORMINV_MS "SC_HID_FUNC_NORMINV_MS" +#define HID_FUNC_STD_NORMDIST_MS "SC_HID_FUNC_STD_NORMDIST_MS" +#define HID_FUNC_STD_NORMINV_MS "SC_HID_FUNC_STD_NORMINV_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 13e97855ee0c..c036318bda16 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -424,20 +424,20 @@ void ScFiltersTest::testFunctionsExcel2010() { 33, true }, { 34, true }, { 35, true }, - { 36, false }, - { 37, false }, - { 38, false }, + { 36, true }, + { 37, true }, + { 38, true }, { 39, false }, { 40, false }, { 41, false }, { 42, false }, { 43, false }, - { 44, false }, - { 45, false }, - { 46, false }, - { 47, false }, - { 48, false }, - { 49, false }, + { 44, true }, + { 45, true }, + { 46, true }, + { 47, true }, + { 48, true }, + { 49, true }, { 50, false }, { 51, false }, { 52, false }, diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index 1ba3db188cc6..2f7e52c03834 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -2418,6 +2418,8 @@ void Test::testFunctionLists() "KURT", "LARGE", "LOGINV", + "LOGNORM.DIST", + "LOGNORM.INV", "LOGNORMDIST", "MAX", "MAXA", @@ -2426,6 +2428,10 @@ void Test::testFunctionLists() "MINA", "MODE", "NEGBINOMDIST", + "NORM.DIST", + "NORM.INV", + "NORM.S.DIST", + "NORM.S.INV", "NORMDIST", "NORMINV", "NORMSDIST", diff --git a/sc/source/core/inc/interpre.hxx b/sc/source/core/inc/interpre.hxx index c2a82f3596ee..c6aa5ad28d64 100644 --- a/sc/source/core/inc/interpre.hxx +++ b/sc/source/core/inc/interpre.hxx @@ -729,10 +729,11 @@ void ScGamma(); void ScPhi(); void ScGauss(); void ScStdNormDist(); +void ScStdNormDist_MS(); void ScFisher(); void ScFisherInv(); void ScFact(); -void ScNormDist(); +void ScNormDist( int nMinParamCount ); void ScGammaDist( int nMinParamCount ); void ScGammaInv(); void ScExpDist(); @@ -745,7 +746,7 @@ void ScVariationen2(); void ScB(); void ScHypGeomDist(); void ScHypGeomDist_MS(); -void ScLogNormDist(); +void ScLogNormDist( int nMinParamCount ); void ScLogNormInv(); void ScTDist(); void ScFDist(); diff --git a/sc/source/core/tool/interpr3.cxx b/sc/source/core/tool/interpr3.cxx index 79934e63cc45..946fb7b2e3b2 100644 --- a/sc/source/core/tool/interpr3.cxx +++ b/sc/source/core/tool/interpr3.cxx @@ -1506,10 +1506,10 @@ void ScInterpreter::ScNegBinomDist() } } -void ScInterpreter::ScNormDist() +void ScInterpreter::ScNormDist( int nMinParamCount ) { sal_uInt8 nParamCount = GetByte(); - if ( !MustHaveParamCount( nParamCount, 3, 4)) + if ( !MustHaveParamCount( nParamCount, nMinParamCount, 4 ) ) return; bool bCumulative = nParamCount == 4 ? GetBool() : true; double sigma = GetDouble(); // standard deviation @@ -1526,10 +1526,10 @@ void ScInterpreter::ScNormDist() PushDouble(phi((x-mue)/sigma)/sigma); } -void ScInterpreter::ScLogNormDist() //expanded, see #i100119# +void ScInterpreter::ScLogNormDist( int nMinParamCount ) //expanded, see #i100119# and fdo72158 { sal_uInt8 nParamCount = GetByte(); - if ( !MustHaveParamCount( nParamCount, 1, 4)) + if ( !MustHaveParamCount( nParamCount, nMinParamCount, 4 ) ) return; bool bCumulative = nParamCount == 4 ? GetBool() : true; // cumulative double sigma = nParamCount >= 3 ? GetDouble() : 1.0; // standard deviation @@ -1561,6 +1561,20 @@ void ScInterpreter::ScStdNormDist() PushDouble(integralPhi(GetDouble())); } +void ScInterpreter::ScStdNormDist_MS() +{ + sal_uInt8 nParamCount = GetByte(); + if ( !MustHaveParamCount( nParamCount, 2 ) ) + return; + bool bCumulative = GetBool(); // cumulative + double x = GetDouble(); // x + + if ( bCumulative ) + PushDouble( integralPhi( x ) ); + else + PushDouble( exp( - pow( x, 2 ) / 2 ) / sqrt( 2 * F_PI ) ); +} + void ScInterpreter::ScExpDist() { if ( MustHaveParamCount( GetByte(), 3 ) ) diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx index 13c6b1133df8..ed0f34ae9b88 100644 --- a/sc/source/core/tool/interpr4.cxx +++ b/sc/source/core/tool/interpr4.cxx @@ -3942,6 +3942,7 @@ StackVar ScInterpreter::Interpret() case ocPhi : ScPhi(); break; case ocGauss : ScGauss(); break; case ocStdNormDist : ScStdNormDist(); break; + case ocStdNormDist_MS : ScStdNormDist_MS(); break; case ocFisher : ScFisher(); break; case ocFisherInv : ScFisherInv(); break; case ocIsEmpty : ScIsEmpty(); break; @@ -4098,7 +4099,8 @@ StackVar ScInterpreter::Interpret() case ocMatTrans : ScMatTrans(); break; case ocMatRef : ScMatRef(); break; case ocB : ScB(); break; - case ocNormDist : ScNormDist(); break; + case ocNormDist : ScNormDist( 3 ); break; + case ocNormDist_MS : ScNormDist( 4 ); break; case ocExpDist : case ocExpDist_MS : ScExpDist(); break; case ocBinomDist : @@ -4111,7 +4113,8 @@ StackVar ScInterpreter::Interpret() case ocVariationen2 : ScVariationen2(); break; case ocHypGeomDist : ScHypGeomDist(); break; case ocHypGeomDist_MS : ScHypGeomDist_MS(); break; - case ocLogNormDist : ScLogNormDist(); break; + case ocLogNormDist : ScLogNormDist( 1 ); break; + case ocLogNormDist_MS : ScLogNormDist( 4 ); break; case ocTDist : ScTDist(); break; case ocFDist : case ocFDist_RT : ScFDist(); break; @@ -4148,8 +4151,10 @@ StackVar ScInterpreter::Interpret() case ocSmall : ScSmall(); break; case ocFrequency : ScFrequency(); break; case ocQuartile : ScQuartile(); break; - case ocNormInv : ScNormInv(); break; - case ocSNormInv : ScSNormInv(); break; + case ocNormInv : + case ocNormInv_MS : ScNormInv(); break; + case ocSNormInv : + case ocSNormInv_MS : ScSNormInv(); break; case ocConfidence : case ocConfidence_N : ScConfidence(); break; case ocConfidence_T : ScConfidenceT(); break; @@ -4186,7 +4191,8 @@ StackVar ScInterpreter::Interpret() case ocFInv : case ocFInv_RT : ScFInv(); break; case ocFInv_LT : ScFInv_LT(); break; - case ocLogInv : ScLogNormInv(); break; + case ocLogInv : + case ocLogInv_MS : ScLogNormInv(); break; case ocBetaDist : ScBetaDist(); break; case ocBetaDist_MS : ScBetaDist_MS(); break; case ocBetaInv : diff --git a/sc/source/filter/excel/xlformula.cxx b/sc/source/filter/excel/xlformula.cxx index fb6c39dba9af..bf335a7be149 100644 --- a/sc/source/filter/excel/xlformula.cxx +++ b/sc/source/filter/excel/xlformula.cxx @@ -457,7 +457,13 @@ static const XclFunctionInfo saFuncTable_2010[] = 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" ) + EXC_FUNCENTRY_V_VR( ocGammaLn_MS, 1, 1, 0, "GAMMALN.PRECISE" ), + EXC_FUNCENTRY_V_VR( ocLogNormDist_MS, 4, 4, 0, "LOGNORM.DIST" ), + EXC_FUNCENTRY_V_VR( ocLogInv_MS, 3, 3, 0, "LOGNORM.INV" ), + EXC_FUNCENTRY_V_VR( ocNormDist_MS, 4, 4, 0, "NORM.DIST" ), + EXC_FUNCENTRY_V_VR( ocNormInv_MS, 3, 3, 0, "NORM.INV" ), + EXC_FUNCENTRY_V_VR( ocStdNormDist_MS, 2, 2, 0, "NORM.S.DIST" ), + EXC_FUNCENTRY_V_VR( ocSNormInv_MS, 1, 1, 0, "NORM.S.INV" ) }; /** Functions new in Excel 2013. diff --git a/sc/source/filter/oox/formulabase.cxx b/sc/source/filter/oox/formulabase.cxx index 6589ed8be33e..63d5006467be 100644 --- a/sc/source/filter/oox/formulabase.cxx +++ b/sc/source/filter/oox/formulabase.cxx @@ -775,7 +775,13 @@ static const FunctionData saFuncTable2010[] = { "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 } + { "COM.MICROSOFT.GAMMALN.PRECISE", "GAMMALN.PRECISE", NOID, NOID, 1, 1, V, { VR }, FUNCFLAG_MACROCALL_NEW }, + { "COM.MICROSOFT.LOGNORM.DIST", "LOGNORM.DIST", NOID, NOID, 4, 4, V, { VR }, FUNCFLAG_MACROCALL_NEW }, + { "COM.MICROSOFT.LOGNORM.INV", "LOGNORM.INV", NOID, NOID, 3, 3, V, { VR }, FUNCFLAG_MACROCALL_NEW }, + { "COM.MICROSOFT.NORM.DIST", "NORM.DIST", NOID, NOID, 4, 4, V, { VR }, FUNCFLAG_MACROCALL_NEW }, + { "COM.MICROSOFT.NORM.INV", "NORM.INV", NOID, NOID, 3, 3, V, { VR }, FUNCFLAG_MACROCALL_NEW }, + { "COM.MICROSOFT.NORM.S.DIST", "NORM.S.DIST", NOID, NOID, 2, 2, V, { VR }, FUNCFLAG_MACROCALL_NEW }, + { "COM.MICROSOFT.NORM.S.INV", "NORM.S.INV", 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 bc48a1411396..3f36020bc1ff 100644 --- a/sc/source/ui/src/scfuncs.src +++ b/sc/source/ui/src/scfuncs.src @@ -6383,6 +6383,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 NORM.DIST #*=- + Resource SC_OPCODE_NORM_DIST_MS + { + String 1 // Description + { + Text [ en-US ] = "Values of the normal distribution." ; + }; + ExtraData = + { + 0; + ID_FUNCTION_GRP_STATISTIC; + U2S( HID_FUNC_NORMDIST_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 normal distribution is to be calculated." ; + }; + String 4 // Name of Parameter 2 + { + Text [ en-US ] = "Mean" ; + }; + String 5 // Description of Parameter 2 + { + Text [ en-US ] = "The mean value. The mean value of the normal distribution." ; + }; + String 6 // Name of Parameter 3 + { + Text [ en-US ] = "STDEV" ; + }; + String 7 // Description of Parameter 3 + { + Text [ en-US ] = "Standard deviation. The standard deviation of the normal distribution." ; + }; + String 8 // Name of Parameter 4 + { + Text [ en-US ] = "C" ; + }; + 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 NORMINV #*=- Resource SC_OPCODE_NORM_INV { @@ -6423,6 +6471,46 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS2 Text [ en-US ] = "Standard deviation. The standard deviation of the normal distribution." ; }; }; + // -=*# Resource for function NORM.INV #*=- + Resource SC_OPCODE_NORM_INV_MS + { + String 1 // Description + { + Text [ en-US ] = "Values of the inverse normal distribution." ; + }; + ExtraData = + { + 0; + ID_FUNCTION_GRP_STATISTIC; + U2S( HID_FUNC_NORMINV_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 normal distribution is to be calculated." ; + }; + String 4 // Name of Parameter 2 + { + Text [ en-US ] = "mean" ; + }; + String 5 // Description of Parameter 2 + { + Text [ en-US ] = "The mean value. The mean value of the normal distribution." ; + }; + String 6 // Name of Parameter 3 + { + Text [ en-US ] = "STDEV" ; + }; + String 7 // Description of Parameter 3 + { + Text [ en-US ] = "Standard deviation. The standard deviation of the normal distribution." ; + }; + }; // -=*# Resource for function STANDNORMVERT #*=- Resource SC_OPCODE_STD_NORM_DIST { @@ -6447,6 +6535,38 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS2 Text [ en-US ] = "The value for which the standard normal distribution is to be calculated." ; }; }; + // -=*# Resource for function NORM.S.DIST #*=- + Resource SC_OPCODE_STD_NORM_DIST_MS + { + String 1 // Description + { + Text [ en-US ] = "The values of the standard normal cumulative distribution." ; + }; + ExtraData = + { + 0; + ID_FUNCTION_GRP_STATISTIC; + U2S( HID_FUNC_STD_NORMDIST_MS ); + 2; 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 standard normal distribution is to be calculated." ; + }; + String 4 // Name of Parameter 2 + { + Text [ en-US ] = "Cumulative" ; + }; + String 5 // Description of Parameter 2 + { + Text [ en-US ] = "0 or FALSE calculates the probability density function. Any other value or TRUE calculates the cumulative distribution function." ; + }; + }; // -=*# Resource for function STANDNORMINV #*=- Resource SC_OPCODE_S_NORM_INV { @@ -6471,6 +6591,30 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS2 Text [ en-US ] = "The probability value for which the inverse standard normal distribution is to be calculated." ; }; }; + // -=*# Resource for function NORM.S.INV #*=- + Resource SC_OPCODE_S_NORM_INV_MS + { + String 1 // Description + { + Text [ en-US ] = "Values of the inverse standard normal distribution." ; + }; + ExtraData = + { + 0; + ID_FUNCTION_GRP_STATISTIC; + U2S( HID_FUNC_STD_NORMINV_MS ); + 1; 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 standard normal distribution is to be calculated." ; + }; + }; // -=*# Resource for function LOGNORMVERT #*=- Resource SC_OPCODE_LOG_NORM_DIST { @@ -6519,6 +6663,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 LOGNORM.DIST #*=- + Resource SC_OPCODE_LOG_NORM_DIST_MS + { + String 1 // Description + { + Text [ en-US ] = "Values of the log normal distribution." ; + }; + ExtraData = + { + 0; + ID_FUNCTION_GRP_STATISTIC; + U2S( HID_FUNC_LOGNORMDIST_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 log normal distribution is to be calculated." ; + }; + String 4 // Name of Parameter 2 + { + Text [ en-US ] = "mean" ; + }; + String 5 // Description of Parameter 2 + { + Text [ en-US ] = "The mean value of the log normal distribution." ; + }; + String 6 // Name of Parameter 3 + { + Text [ en-US ] = "STDEV" ; + }; + String 7 // Description of Parameter 3 + { + Text [ en-US ] = "The standard deviation of the log normal 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 LOGINV #*=- Resource SC_OPCODE_LOG_INV { @@ -6559,6 +6751,46 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS2 Text [ en-US ] = "Standard deviation. The standard deviation of the log normal distribution." ; }; }; + // -=*# Resource for function LOGNORM.INV #*=- + Resource SC_OPCODE_LOG_INV_MS + { + String 1 // Description + { + Text [ en-US ] = "Values of the inverse of the lognormal distribution." ; + }; + ExtraData = + { + 0; + ID_FUNCTION_GRP_STATISTIC; + U2S( HID_FUNC_LOGINV ); + 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 log normal distribution is to be calculated." ; + }; + String 4 // Name of Parameter 2 + { + Text [ en-US ] = "mean" ; + }; + String 5 // Description of Parameter 2 + { + Text [ en-US ] = "Mean value. The mean value of the log normal distribution." ; + }; + String 6 // Name of Parameter 3 + { + Text [ en-US ] = "STDEV" ; + }; + String 7 // Description of Parameter 3 + { + Text [ en-US ] = "Standard deviation. The standard deviation of the log normal distribution." ; + }; + }; // -=*# Resource for function EXPONVERT #*=- Resource SC_OPCODE_EXP_DIST { |