[gnumeric] Use (hyperbolic) cotangent where appropriate



commit 6c717bd6c9126805c229f5b2970806205bfdaecd
Author: Morten Welinder <terra gnome org>
Date:   Sun Mar 6 19:09:45 2016 -0500

    Use (hyperbolic) cotangent where appropriate

 plugins/fn-complex/gsl-complex.c |    3 ++-
 src/mathfunc.c                   |    2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/plugins/fn-complex/gsl-complex.c b/plugins/fn-complex/gsl-complex.c
index 6a8dbf4..5377c8b 100644
--- a/plugins/fn-complex/gsl-complex.c
+++ b/plugins/fn-complex/gsl-complex.c
@@ -61,6 +61,7 @@
 #include <expr.h>
 #include <value.h>
 #include <mathfunc.h>
+#include <sf-trig.h>
 
 
 #define GSL_REAL(x) GNM_CRE(*(x))
@@ -389,7 +390,7 @@ gsl_complex_arctanh_real (gnm_float a, gnm_complex *res)
         if (a > -1.0 && a < 1.0) {
                *res = GNM_CMAKE (gnm_atanh (a), 0);
        } else {
-               *res = GNM_CMAKE (gnm_atanh (1 / a),
+               *res = GNM_CMAKE (gnm_acoth (a),
                              (a < 0) ? M_PI_2gnum : -M_PI_2gnum);
        }
 }
diff --git a/src/mathfunc.c b/src/mathfunc.c
index 50fabe8..0960245 100644
--- a/src/mathfunc.c
+++ b/src/mathfunc.c
@@ -2005,7 +2005,7 @@ gnm_float qt(gnm_float p, gnm_float ndf, gboolean lower_tail, gboolean log_p)
     }
     else if (ndf < 1 + eps) { /* df ~= 1  (df < 1 excluded above): Cauchy */
        if(P > 0)
-           q = 1/gnm_tan(P * M_PI_2gnum);
+           q = gnm_cotpi(P / 2);
 
        else { /* P = 0, but maybe p_ = gnm_exp(p) ! */
            if(log_p) q = M_1_PI * gnm_exp(-R_D_Lval(p));/* cot(e) ~ 1/e */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]