summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWinfried Donkers <winfrieddonkers@libreoffice.org>2013-10-20 09:38:19 +0200
committerEike Rathke <erack@redhat.com>2013-10-25 13:07:32 +0000
commit4a122d1e61278debe7e386e3d9f442e68eddba9b (patch)
tree32847e55a1516cdbc4253604c40217f0b2b7870d
parentb5efef87efdce56c2491e6de1370ad42b998a8df (diff)
fdo#44134 adding Excel 2010 functions STDEV.P and STDEV.S
Change-Id: If7b2767a69285ac72fa7120b1149a66f118cce8f Reviewed-on: https://gerrit.libreoffice.org/6354 Tested-by: Eike Rathke <erack@redhat.com> Reviewed-by: Eike Rathke <erack@redhat.com>
-rw-r--r--formula/source/core/resource/core_resource.src12
-rw-r--r--include/formula/compiler.hrc4
-rw-r--r--include/formula/opcode.hxx2
-rw-r--r--sc/qa/unit/ucalc.cxx2
-rw-r--r--sc/source/core/tool/interpr4.cxx6
-rw-r--r--sc/source/filter/excel/xlformula.cxx4
-rw-r--r--sc/source/filter/oox/formulabase.cxx4
-rw-r--r--sc/source/ui/src/scfuncs.src48
8 files changed, 77 insertions, 5 deletions
diff --git a/formula/source/core/resource/core_resource.src b/formula/source/core/resource/core_resource.src
index d1eb878e87e6..c6aec3ac6c26 100644
--- a/formula/source/core/resource/core_resource.src
+++ b/formula/source/core/resource/core_resource.src
@@ -188,6 +188,8 @@ Resource RID_STRLIST_FUNCTION_NAMES_ENGLISH_ODFF
String SC_OPCODE_ST_DEV_A { Text = "STDEVA" ; };
String SC_OPCODE_ST_DEV_P { Text = "STDEVP" ; };
String SC_OPCODE_ST_DEV_P_A { Text = "STDEVPA" ; };
+ String SC_OPCODE_ST_DEV_P_MS { Text = "COM.MICROSOFT.STDEV.P" ; };
+ 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_EXP_DIST { Text = "EXPONDIST" ; };
@@ -538,6 +540,8 @@ Resource RID_STRLIST_FUNCTION_NAMES_ENGLISH
String SC_OPCODE_ST_DEV_A { Text = "STDEVA" ; };
String SC_OPCODE_ST_DEV_P { Text = "STDEVP" ; };
String SC_OPCODE_ST_DEV_P_A { Text = "STDEVPA" ; };
+ String SC_OPCODE_ST_DEV_P_MS { Text = "STDEV.P" ; };
+ 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_EXP_DIST { Text = "EXPONDIST" ; };
@@ -1307,6 +1311,14 @@ Resource RID_STRLIST_FUNCTION_NAMES
{
Text [ en-US ] = "STDEVPA" ;
};
+ String SC_OPCODE_ST_DEV_P_MS
+ {
+ Text [ en-US ] = "STDEV.P" ;
+ };
+ String SC_OPCODE_ST_DEV_S
+ {
+ Text [ en-US ] = "STDEV.S" ;
+ };
String SC_OPCODE_B
{
Text [ en-US ] = "B";
diff --git a/include/formula/compiler.hrc b/include/formula/compiler.hrc
index 21449b536302..bb8090007a8a 100644
--- a/include/formula/compiler.hrc
+++ b/include/formula/compiler.hrc
@@ -410,8 +410,10 @@
#define SC_OPCODE_WEBSERVICE 412
#define SC_OPCODE_COVARIANCE_S 413
#define SC_OPCODE_COVARIANCE_P 414
+#define SC_OPCODE_ST_DEV_P_MS 415
+#define SC_OPCODE_ST_DEV_S 416
-#define SC_OPCODE_STOP_2_PAR 415 /* last function with two or more parameters' OpCode + 1 */
+#define SC_OPCODE_STOP_2_PAR 417 /* 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 9ebd9d57db1a..79b229c70755 100644
--- a/include/formula/opcode.hxx
+++ b/include/formula/opcode.hxx
@@ -222,6 +222,8 @@ enum OpCodeEnum
ocVarP = SC_OPCODE_VAR_P,
ocStDev = SC_OPCODE_ST_DEV,
ocStDevP = SC_OPCODE_ST_DEV_P,
+ ocStDevP_MS = SC_OPCODE_ST_DEV_P_MS,
+ ocStDevS = SC_OPCODE_ST_DEV_S,
ocB = SC_OPCODE_B,
ocNormDist = SC_OPCODE_NORM_DIST,
ocExpDist = SC_OPCODE_EXP_DIST,
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 8e5557304efd..db82ac470c43 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -2425,6 +2425,8 @@ void Test::testFunctionLists()
"SMALL",
"STANDARDIZE",
"STDEV",
+ "STDEV.P",
+ "STDEV.S",
"STDEVA",
"STDEVP",
"STDEVPA",
diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index af6424c01289..1a3e13110f1b 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -4013,9 +4013,11 @@ StackVar ScInterpreter::Interpret()
case ocVarA : ScVar( true ); break;
case ocVarP : ScVarP( false ); break;
case ocVarPA : ScVarP( true ); break;
- case ocStDev : ScStDev( false ); break;
+ case ocStDev :
+ case ocStDevS : ScStDev( false ); break;
case ocStDevA : ScStDev( true ); break;
- case ocStDevP : ScStDevP( false ); break;
+ case ocStDevP :
+ case ocStDevP_MS : ScStDevP( false ); break;
case ocStDevPA : ScStDevP( true ); break;
case ocBW : ScBW(); break;
case ocDIA : ScDIA(); break;
diff --git a/sc/source/filter/excel/xlformula.cxx b/sc/source/filter/excel/xlformula.cxx
index f293230c4885..dc87d74403f7 100644
--- a/sc/source/filter/excel/xlformula.cxx
+++ b/sc/source/filter/excel/xlformula.cxx
@@ -408,7 +408,9 @@ static const XclFunctionInfo saFuncTable_Oox[] =
static const XclFunctionInfo saFuncTable_2010[] =
{
EXC_FUNCENTRY_V_VA( ocCovarianceP, 2, 2, 0, "COVARIANCE.P" ),
- EXC_FUNCENTRY_V_VA( ocCovarianceS, 2, 2, 0, "COVARIANCE.S" )
+ EXC_FUNCENTRY_V_VA( ocCovarianceS, 2, 2, 0, "COVARIANCE.S" ),
+ EXC_FUNCENTRY_V_RX( ocStDevP_MS, 1, MX, 0, "STDEV.P" ),
+ EXC_FUNCENTRY_V_RX( ocStDevS, 1, MX, 0, "STDEV.S" )
};
/** Functions new in Excel 2013.
diff --git a/sc/source/filter/oox/formulabase.cxx b/sc/source/filter/oox/formulabase.cxx
index d119a88142fc..09ac0668280f 100644
--- a/sc/source/filter/oox/formulabase.cxx
+++ b/sc/source/filter/oox/formulabase.cxx
@@ -747,7 +747,9 @@ static const FunctionData saFuncTableOox[] =
static const FunctionData saFuncTable2010[] =
{
{ "COM.MICROSOFT.COVARIANCE.P", "COVARIANCE.P", NOID, NOID, 2, 2, V, { VA }, FUNCFLAG_MACROCALL_NEW },
- { "COM.MICROSOFT.COVARIANCE.S", "COVARIANCE.S", NOID, NOID, 2, 2, V, { VA }, FUNCFLAG_MACROCALL_NEW }
+ { "COM.MICROSOFT.COVARIANCE.S", "COVARIANCE.S", NOID, NOID, 2, 2, V, { VA }, FUNCFLAG_MACROCALL_NEW },
+ { "COM.MICROSOFT.STDEV.P", "STDEV.P", NOID, NOID, 1, MX, V, { RX }, FUNCFLAG_MACROCALL_NEW },
+ { "COM.MICROSOFT.STDEV.S", "STDEV.S", NOID, NOID, 1, MX, V, { RX }, 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 93ea5c345e60..11fdecb450e7 100644
--- a/sc/source/ui/src/scfuncs.src
+++ b/sc/source/ui/src/scfuncs.src
@@ -5183,6 +5183,30 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS2
Text [ en-US ] = "Number 1, number 2, ... are 1 to 30 numerical arguments which portray a sample of a population." ;
};
};
+ // -=*# Resource for function STDEV.S #*=-
+ Resource SC_OPCODE_ST_DEV_S
+ {
+ String 1 // Description
+ {
+ Text [ en-US ] = "Calculates the standard deviation based on a sample." ;
+ };
+ ExtraData =
+ {
+ 0;
+ ID_FUNCTION_GRP_STATISTIC;
+ U2S( HID_FUNC_STABW );
+ VAR_ARGS; 0;
+ 0;
+ };
+ String 2 // Name of Parameter 1
+ {
+ Text [ en-US ] = "number " ;
+ };
+ String 3 // Description of Parameter 1
+ {
+ Text [ en-US ] = "Number 1, number 2, ... are 1 to 30 numerical arguments which portray a sample of a population." ;
+ };
+ };
// -=*# Resource for function STABWA #*=-
Resource SC_OPCODE_ST_DEV_A
{
@@ -5231,6 +5255,30 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS2
Text [ en-US ] = "Number 1, number 2, ... are 1 to 30 numerical arguments which portray a sample of a population." ;
};
};
+ // -=*# Resource for function STDEV.P #*=-
+ Resource SC_OPCODE_ST_DEV_P_MS
+ {
+ String 1 // Description
+ {
+ Text [ en-US ] = "Calculates the standard deviation based on the entire population." ;
+ };
+ ExtraData =
+ {
+ 0;
+ ID_FUNCTION_GRP_STATISTIC;
+ U2S( HID_FUNC_STABWN );
+ VAR_ARGS; 0;
+ 0;
+ };
+ String 2 // Name of Parameter 1
+ {
+ Text [ en-US ] = "number " ;
+ };
+ String 3 // Description of Parameter 1
+ {
+ Text [ en-US ] = "Number 1, number 2, ... are 1 to 30 numerical arguments which portray a sample of a population." ;
+ };
+ };
// -=*# Resource for function STABWNA #*=-
Resource SC_OPCODE_ST_DEV_P_A
{