[gnumeric] COTH, ACOTH: Implement for completeness.
- From: Morten Welinder <mortenw src gnome org>
- To: svn-commits-list gnome org
- Subject: [gnumeric] COTH, ACOTH: Implement for completeness.
- Date: Wed, 17 Jun 2009 21:40:23 -0400 (EDT)
commit 976d2e9bfd81495dd960be3fa6220bb8fa147b64
Author: Morten Welinder <terra gnome org>
Date: Wed Jun 17 21:39:13 2009 -0400
COTH, ACOTH: Implement for completeness.
ChangeLog | 4 +++
plugins/fn-math/ChangeLog | 4 +++
plugins/fn-math/functions.c | 46 +++++++++++++++++++++++++++++++++++++++++
plugins/fn-math/plugin.xml.in | 2 +
src/mathfunc.c | 13 +++++++++++
src/mathfunc.h | 2 +
6 files changed, 71 insertions(+), 0 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 3374563..91decc3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2009-06-17 Morten Welinder <terra gnome org>
+
+ * src/mathfunc.c (gnm_coth, gnm_acoth): New functions.
+
2009-06-17 Andreas J. Guelzow <aguelzow pyrshep ca>
* src/expr.h (gnm_expr_list_as_string): new
diff --git a/plugins/fn-math/ChangeLog b/plugins/fn-math/ChangeLog
index f281786..a7e03ab 100644
--- a/plugins/fn-math/ChangeLog
+++ b/plugins/fn-math/ChangeLog
@@ -1,3 +1,7 @@
+2009-06-17 Morten Welinder <terra gnome org>
+
+ * functions.c (gnumeric_coth, gnumeric_acoth): New functions.
+
2009-06-16 Morten Welinder <terra gnome org>
* functions.c: Start adding external references to a few
diff --git a/plugins/fn-math/functions.c b/plugins/fn-math/functions.c
index 932d02b..1367d22 100644
--- a/plugins/fn-math/functions.c
+++ b/plugins/fn-math/functions.c
@@ -340,6 +340,8 @@ static GnmFuncHelp const help_acot[] = {
{ GNM_FUNC_HELP_ARG, F_("x:value")},
{ GNM_FUNC_HELP_EXAMPLES, F_("ACOT(0.2) equals 1.3734") },
{ GNM_FUNC_HELP_SEEALSO, "COT,TAN"},
+ { GNM_FUNC_HELP_EXTREF, F_("wolfram:InverseCotangent.html") },
+ { GNM_FUNC_HELP_EXTREF, F_("wiki:en:Trigonometric_functions") },
{ GNM_FUNC_HELP_END }
};
@@ -351,6 +353,24 @@ gnumeric_acot (GnmFuncEvalInfo *ei, GnmValue const * const *argv)
/***************************************************************************/
+static GnmFuncHelp const help_acoth[] = {
+ { GNM_FUNC_HELP_NAME, F_("ACOTH:inverse hyperbolic cotangent of a value")},
+ { GNM_FUNC_HELP_ARG, F_("x:value")},
+ { GNM_FUNC_HELP_EXAMPLES, F_("ACOTH(2.2) equals 0.4904") },
+ { GNM_FUNC_HELP_SEEALSO, "COTH,TANH"},
+ { GNM_FUNC_HELP_EXTREF, F_("wolfram:InverseHyperbolicCotangent.html") },
+ { GNM_FUNC_HELP_EXTREF, F_("wiki:en:Inverse_hyperbolic_function") },
+ { GNM_FUNC_HELP_END }
+};
+
+static GnmValue *
+gnumeric_acoth (GnmFuncEvalInfo *ei, GnmValue const * const *argv)
+{
+ return value_new_float (gnm_acoth (value_get_as_float (argv[0])));
+}
+
+/***************************************************************************/
+
static GnmFuncHelp const help_asin[] = {
{ GNM_FUNC_HELP_OLD,
F_("@FUNCTION=ASIN\n"
@@ -839,6 +859,8 @@ static GnmFuncHelp const help_cot[] = {
{ GNM_FUNC_HELP_ARG, F_("x:value")},
{ GNM_FUNC_HELP_EXAMPLES, F_("COT(0.12) equals 8.293") },
{ GNM_FUNC_HELP_SEEALSO, "TAN,ACOT"},
+ { GNM_FUNC_HELP_EXTREF, F_("wolfram:Cotangent.html") },
+ { GNM_FUNC_HELP_EXTREF, F_("wiki:en:Trigonometric_functions") },
{ GNM_FUNC_HELP_END }
};
@@ -850,6 +872,24 @@ gnumeric_cot (GnmFuncEvalInfo *ei, GnmValue const * const *argv)
/***************************************************************************/
+static GnmFuncHelp const help_coth[] = {
+ { GNM_FUNC_HELP_NAME, F_("COT:hyperbolic cotangent of a value")},
+ { GNM_FUNC_HELP_ARG, F_("x:value")},
+ { GNM_FUNC_HELP_EXAMPLES, F_("COTH(0.12) equals 8.373") },
+ { GNM_FUNC_HELP_SEEALSO, "TANH,ACOTH"},
+ { GNM_FUNC_HELP_EXTREF, F_("wolfram:HyperbolicCotangent.html") },
+ { GNM_FUNC_HELP_EXTREF, F_("wiki:en:Hyperbolic_function") },
+ { GNM_FUNC_HELP_END }
+};
+
+static GnmValue *
+gnumeric_coth (GnmFuncEvalInfo *ei, GnmValue const * const *argv)
+{
+ return value_new_float (gnm_coth (value_get_as_float (argv[0])));
+}
+
+/***************************************************************************/
+
static GnmFuncHelp const help_degrees[] = {
{ GNM_FUNC_HELP_OLD,
F_("@FUNCTION=DEGREES\n"
@@ -3150,6 +3190,9 @@ GnmFuncDescriptor const math_functions[] = {
{ "acot", "f", N_("number"), help_acot,
gnumeric_acot, NULL, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_COMPLETE, GNM_FUNC_TEST_STATUS_NO_TESTSUITE },
+ { "acoth", "f", N_("number"), help_acoth,
+ gnumeric_acoth, NULL, NULL, NULL, NULL,
+ GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_COMPLETE, GNM_FUNC_TEST_STATUS_NO_TESTSUITE },
{ "asin", "f", N_("number"), help_asin,
gnumeric_asin, NULL, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_COMPLETE, GNM_FUNC_TEST_STATUS_EXHAUSTIVE },
@@ -3180,6 +3223,9 @@ GnmFuncDescriptor const math_functions[] = {
{ "cot", "f", N_("number"), help_cot,
gnumeric_cot, NULL, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_COMPLETE, GNM_FUNC_TEST_STATUS_NO_TESTSUITE },
+ { "coth", "f", N_("number"), help_coth,
+ gnumeric_coth, NULL, NULL, NULL, NULL,
+ GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_COMPLETE, GNM_FUNC_TEST_STATUS_NO_TESTSUITE },
/* MS Excel puts this in statistical */
{ "countif", "rS", N_("range,criteria"), help_countif,
diff --git a/plugins/fn-math/plugin.xml.in b/plugins/fn-math/plugin.xml.in
index 2e3a518..0e1cc74 100644
--- a/plugins/fn-math/plugin.xml.in
+++ b/plugins/fn-math/plugin.xml.in
@@ -15,6 +15,7 @@
<function name="acos"/>
<function name="acosh"/>
<function name="acot"/>
+ <function name="acoth"/>
<function name="asin"/>
<function name="asinh"/>
<function name="atan"/>
@@ -25,6 +26,7 @@
<function name="cos"/>
<function name="cosh"/>
<function name="cot"/>
+ <function name="coth"/>
<function name="countif"/>
<function name="ceil"/>
<function name="ceiling"/>
diff --git a/src/mathfunc.c b/src/mathfunc.c
index 56caf84..d1b0a07 100644
--- a/src/mathfunc.c
+++ b/src/mathfunc.c
@@ -132,6 +132,19 @@ gnm_acot (gnm_float x)
}
}
+gnm_float
+gnm_coth (gnm_float x)
+{
+ return 1 / gnm_tanh (x);
+}
+
+gnm_float
+gnm_acoth (gnm_float x)
+{
+ return gnm_atanh (1 / x);
+}
+
+
/* ------------------------------------------------------------------------- */
/* --- BEGIN MAGIC R SOURCE MARKER --- */
diff --git a/src/mathfunc.h b/src/mathfunc.h
index 0c8d644..5179221 100644
--- a/src/mathfunc.h
+++ b/src/mathfunc.h
@@ -36,6 +36,8 @@ gnm_float logspace_sub (gnm_float logx, gnm_float logy);
gnm_float gnm_cot (gnm_float x);
gnm_float gnm_acot (gnm_float x);
+gnm_float gnm_coth (gnm_float x);
+gnm_float gnm_acoth (gnm_float x);
gnm_float beta (gnm_float a, gnm_float b);
gnm_float lbeta3 (gnm_float a, gnm_float b, int *sign);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]