summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWinfried Donkers <winfrieddonkers@libreoffice.org>2014-04-11 09:46:51 +0200
committerEike Rathke <erack@redhat.com>2014-04-11 13:43:14 +0000
commit56deaabb32346e0cc9c6946d7d53ba251f4450b2 (patch)
tree46f837503ca80406f53946db0bea3c33d1f52b1f
parentba1452c2615604fd1d446dd0f1f55b5501f1b76d (diff)
fdo#73149 add Excel 2010 functions ERF.PRECISE and ERFC.PRECISE
Change-Id: I3199470ec92923e8cc12156f21dd397d870cc1e0 Reviewed-on: https://gerrit.libreoffice.org/8930 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Eike Rathke <erack@redhat.com>
-rw-r--r--formula/source/core/resource/core_resource.src14
-rw-r--r--include/formula/compiler.hrc4
-rw-r--r--include/formula/opcode.hxx2
-rw-r--r--sc/inc/helpids.h2
-rw-r--r--sc/qa/unit/subsequent_filters-test.cxx4
-rw-r--r--sc/qa/unit/ucalc.cxx2
-rw-r--r--sc/source/core/inc/interpre.hxx2
-rw-r--r--sc/source/core/tool/interpr4.cxx2
-rw-r--r--sc/source/core/tool/interpr7.cxx20
-rw-r--r--sc/source/filter/excel/xlformula.cxx2
-rw-r--r--sc/source/filter/oox/formulabase.cxx2
-rw-r--r--sc/source/ui/src/scfuncs.src46
12 files changed, 99 insertions, 3 deletions
diff --git a/formula/source/core/resource/core_resource.src b/formula/source/core/resource/core_resource.src
index 4f5b91dd4a99..90544a41f2b9 100644
--- a/formula/source/core/resource/core_resource.src
+++ b/formula/source/core/resource/core_resource.src
@@ -422,6 +422,8 @@ Resource RID_STRLIST_FUNCTION_NAMES_ENGLISH_ODFF
/* END defined ERROR.TYPE() values. */
String SC_OPCODE_FILTERXML { Text = "COM.MICROSOFT.FILTERXML";};
String SC_OPCODE_WEBSERVICE { Text = "COM.MICROSOFT.WEBSERVICE"; };
+ String SC_OPCODE_ERF_MS { Text = "COM.MICROSOFT.ERF.PRECISE" ; };
+ String SC_OPCODE_ERFC_MS { Text = "COM.MICROSOFT.ERFC.PRECISE" ; };
};
/** These function names are used only in the XLSX import. */
@@ -825,6 +827,8 @@ Resource RID_STRLIST_FUNCTION_NAMES_ENGLISH_OOXML
/* END defined ERROR.TYPE() values. */
String SC_OPCODE_FILTERXML { Text = "_xlfn.FILTERXML";};
String SC_OPCODE_WEBSERVICE { Text = "_xlfn.WEBSERVICE"; };
+ String SC_OPCODE_ERF_MS { Text = "_xlfn.ERF.PRECISE" ; };
+ String SC_OPCODE_ERFC_MS { Text = "_xlfn.ERFC.PRECISE" ; };
};
// DO NOT CHANGE NAMES! Only add functions.
@@ -1230,6 +1234,8 @@ Resource RID_STRLIST_FUNCTION_NAMES_ENGLISH
/* END defined ERROR.TYPE() values. */
String SC_OPCODE_FILTERXML { Text = "FILTERXML";};
String SC_OPCODE_WEBSERVICE { Text = "WEBSERVICE"; };
+ String SC_OPCODE_ERF_MS { Text = "ERF.PRECISE" ; };
+ String SC_OPCODE_ERFC_MS { Text = "ERFC.PRECISE" ; };
};
Resource RID_STRLIST_FUNCTION_NAMES
@@ -2758,6 +2764,14 @@ Resource RID_STRLIST_FUNCTION_NAMES
{
Text [ en-US ] = "WEBSERVICE";
};
+ String SC_OPCODE_ERF_MS
+ {
+ Text [en-US ] = "ERF.PRECISE" ;
+ };
+ String SC_OPCODE_ERFC_MS
+ {
+ Text [en-US ] = "ERFC.PRECISE" ;
+ };
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/formula/compiler.hrc b/include/formula/compiler.hrc
index 47d22aab3d1c..96ea885d4b8f 100644
--- a/include/formula/compiler.hrc
+++ b/include/formula/compiler.hrc
@@ -192,7 +192,9 @@
#define SC_OPCODE_UNICHAR 160
#define SC_OPCODE_GAMMA 161
#define SC_OPCODE_GAMMA_LN_MS 162
-#define SC_OPCODE_STOP_1_PAR 163
+#define SC_OPCODE_ERF_MS 163
+#define SC_OPCODE_ERFC_MS 164
+#define SC_OPCODE_STOP_1_PAR 165
/*** Functions with more than one parameters ***/
#define SC_OPCODE_START_2_PAR 201
diff --git a/include/formula/opcode.hxx b/include/formula/opcode.hxx
index 4239c538bcd2..f5afa19abca3 100644
--- a/include/formula/opcode.hxx
+++ b/include/formula/opcode.hxx
@@ -460,6 +460,8 @@ enum OpCodeEnum
ocEuroConvert = SC_OPCODE_EUROCONVERT,
ocFilterXML = SC_OPCODE_FILTERXML,
ocWebservice = SC_OPCODE_WEBSERVICE,
+ ocErf_MS = SC_OPCODE_ERF_MS,
+ ocErfc_MS = SC_OPCODE_ERFC_MS,
// internal stuff
ocInternalBegin = SC_OPCODE_INTERNAL_BEGIN,
ocTTT = SC_OPCODE_TTT,
diff --git a/sc/inc/helpids.h b/sc/inc/helpids.h
index 2aa8e6090a51..2f73f3fbd12c 100644
--- a/sc/inc/helpids.h
+++ b/sc/inc/helpids.h
@@ -704,5 +704,7 @@
#define HID_FUNC_FLOOR_MS "SC_HID_FUNC_FLOOR_MS"
#define HID_FUNC_NETWORKDAYS_MS "SC_HID_FUNC_NETWORKDAYS_MS"
#define HID_FUNC_WORKDAY_MS "SC_HID_FUNC_WORKDAY_MS"
+#define HID_FUNC_ERF_MS "SC_HID_FUNC_EFR_MS"
+#define HID_FUNC_ERFC_MS "SC_HID_FUNC_ERFC_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 866998881791..4411d329d930 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -450,8 +450,8 @@ void ScFiltersTest::testFunctionsExcel2010()
{ 17, true },
{ 18, true },
{ 19, true },
- { 20, false },
- { 21, false },
+ { 20, true },
+ { 21, true },
{ 22, true },
{ 23, true },
{ 24, true },
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 6ee5a4eac0ff..09b3880e8be0 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -2577,6 +2577,8 @@ void Test::testFunctionLists()
"COVARIANCE.S",
"CRITBINOM",
"DEVSQ",
+ "ERF.PRECISE",
+ "ERFC.PRECISE",
"EXPON.DIST",
"EXPONDIST",
"F.DIST",
diff --git a/sc/source/core/inc/interpre.hxx b/sc/source/core/inc/interpre.hxx
index 7f2eb64ae737..e604e67ac8db 100644
--- a/sc/source/core/inc/interpre.hxx
+++ b/sc/source/core/inc/interpre.hxx
@@ -832,6 +832,8 @@ void ScMidB();
void ScFilterXML();
void ScWebservice();
+void ScErf();
+void ScErfc();
static const double fMaxGammaArgument;
diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index f2ff1d63e810..038c64966752 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -4086,6 +4086,8 @@ StackVar ScInterpreter::Interpret()
case ocZins : ScZins(); break;
case ocFilterXML : ScFilterXML(); break;
case ocWebservice : ScWebservice(); break;
+ case ocErf_MS : ScErf(); break;
+ case ocErfc_MS : ScErfc(); break;
case ocZinsZ : ScZinsZ(); break;
case ocKapz : ScKapz(); break;
case ocKumZinsZ : ScKumZinsZ(); break;
diff --git a/sc/source/core/tool/interpr7.cxx b/sc/source/core/tool/interpr7.cxx
index a683f150cab0..5a266f2d6084 100644
--- a/sc/source/core/tool/interpr7.cxx
+++ b/sc/source/core/tool/interpr7.cxx
@@ -265,4 +265,24 @@ void ScInterpreter::ScDebugVar()
PushIllegalParameter();
}
+void ScInterpreter::ScErf()
+{
+ sal_uInt8 nParamCount = GetByte();
+ if (MustHaveParamCount( nParamCount, 1 ) )
+ {
+ double x = GetDouble();
+ PushDouble( ::rtl::math::erf( x ) );
+ }
+}
+
+void ScInterpreter::ScErfc()
+{
+ sal_uInt8 nParamCount = GetByte();
+ if (MustHaveParamCount( nParamCount, 1 ) )
+ {
+ double x = GetDouble();
+ PushDouble( ::rtl::math::erfc( x ) );
+ }
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/filter/excel/xlformula.cxx b/sc/source/filter/excel/xlformula.cxx
index b15cb426a586..9e20985eb782 100644
--- a/sc/source/filter/excel/xlformula.cxx
+++ b/sc/source/filter/excel/xlformula.cxx
@@ -490,6 +490,8 @@ static const XclFunctionInfo saFuncTable_2010[] =
EXC_FUNCENTRY_V_VR( ocZTest_MS, 2, 3, 0, "Z.TEST" ),
EXC_FUNCENTRY_V_VR( ocCeil_MS, 2, 2, 0, "CEILING.PRECISE" ),
EXC_FUNCENTRY_V_VR( ocFloor_MS, 2, 2, 0, "FLOOR.PRECISE" ),
+ EXC_FUNCENTRY_V_VR( ocErf_MS, 1, 1, 0, "ERF.PRECISE" ),
+ EXC_FUNCENTRY_V_VR( ocErfc_MS, 1, 1, 0, "ERFC.PRECISE" ),
};
/** Functions new in Excel 2013.
diff --git a/sc/source/filter/oox/formulabase.cxx b/sc/source/filter/oox/formulabase.cxx
index 64270d226e99..bb38d621f2d4 100644
--- a/sc/source/filter/oox/formulabase.cxx
+++ b/sc/source/filter/oox/formulabase.cxx
@@ -801,6 +801,8 @@ static const FunctionData saFuncTable2010[] =
{ "COM.MICROSOFT.Z.TEST", "Z.TEST", NOID, NOID, 2, 3, V, { RX, VR }, FUNCFLAG_MACROCALL_NEW },
{ "COM.MICROSOFT.CEILING.PRECISE", "CEILING.PRECISE", NOID, NOID, 2, 2, V, { VR }, FUNCFLAG_MACROCALL_NEW },
{ "COM.MICROSOFT.FLOOR.PRECISE", "FLOOR.PRECISE", NOID, NOID, 2, 2, V, { VR }, FUNCFLAG_MACROCALL_NEW },
+ { "COM.MICROSOFT.ERF.PRECISE", "ERF.PRECISE", NOID, NOID, 1, 1, V, { VR }, FUNCFLAG_MACROCALL_NEW },
+ { "COM.MICROSOFT.ERFC.PRECISE", "ERFC.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 3e35e7933448..a248d72e2836 100644
--- a/sc/source/ui/src/scfuncs.src
+++ b/sc/source/ui/src/scfuncs.src
@@ -11974,6 +11974,52 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS2
Text [ en-US ] = "URI of the webservice";
};
};
+ Resource SC_OPCODE_ERF_MS
+ {
+ String 1 // Description
+ {
+ Text [ en-US] = "Returns the error function.";
+ };
+ ExtraData =
+ {
+ 0;
+ ID_FUNCTION_GRP_STATISTIC;
+ U2S( HID_FUNC_ERF_MS );
+ 1; 0;
+ 0;
+ };
+ String 2 // Name of Parameter 1
+ {
+ Text [ en-US ] = "Lower Limit";
+ };
+ String 3 // Description of Parameter 1
+ {
+ Text [ en-US ] = "The lower limit for integration";
+ };
+ };
+ Resource SC_OPCODE_ERFC_MS
+ {
+ String 1 // Description
+ {
+ Text [ en-US] = "Returns the complementary error function.";
+ };
+ ExtraData =
+ {
+ 0;
+ ID_FUNCTION_GRP_STATISTIC;
+ U2S( HID_FUNC_ERFC_MS );
+ 1; 0;
+ 0;
+ };
+ String 2 // Name of Parameter 1
+ {
+ Text [ en-US ] = "Lower Limit";
+ };
+ String 3 // Description of Parameter 1
+ {
+ Text [ en-US ] = "The lower limit for integration";
+ };
+ };
};
#if defined(U2S)