[gnumeric] IMARCCOSH: Return +0, not -0 for argument 1.



commit fc80ab81f7d4263722dc906bb785ea60c284a480
Author: Morten Welinder <terra gnome org>
Date:   Sat Mar 5 14:43:28 2016 -0500

    IMARCCOSH: Return +0, not -0 for argument 1.

 NEWS                             |    1 +
 plugins/fn-complex/ChangeLog     |    5 +++++
 plugins/fn-complex/gsl-complex.c |    8 ++++++--
 3 files changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/NEWS b/NEWS
index 175c66d..83fdf3a 100644
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,7 @@ Morten:
        * Fix problems with ssconvert to lp/cplex formats.
        * Add sensitivity report to solver.
        * Fix bounds problem with cplex exporter.
+       * Fix IMARCCOSH(1).
 
 --------------------------------------------------------------------------
 Gnumeric 1.12.27
diff --git a/plugins/fn-complex/ChangeLog b/plugins/fn-complex/ChangeLog
index 8807d91..ec8f409 100644
--- a/plugins/fn-complex/ChangeLog
+++ b/plugins/fn-complex/ChangeLog
@@ -1,3 +1,8 @@
+2016-03-05  Morten Welinder  <terra gnome org>
+
+       * gsl-complex.c (gsl_complex_arccosh): Return +0, not -0 for
+       argument 1.  Reported upstream.
+
 2016-02-06  Morten Welinder <terra gnome org>
 
        * Release 1.12.27
diff --git a/plugins/fn-complex/gsl-complex.c b/plugins/fn-complex/gsl-complex.c
index fb99f37..000ce61 100644
--- a/plugins/fn-complex/gsl-complex.c
+++ b/plugins/fn-complex/gsl-complex.c
@@ -375,8 +375,12 @@ gsl_complex_arcsinh (gnm_complex const *a, gnm_complex *res)
 void
 gsl_complex_arccosh (gnm_complex const *a, gnm_complex *res)
 {                               /* z = arccosh(a) */
-        gsl_complex_arccos (a, res);
-       gsl_complex_mul_imag (res, GSL_IMAG (res) > 0 ? -1.0 : 1.0, res);
+       if (GSL_IMAG (a) == 0 && GSL_REAL (a) == 1)
+               *res = GNM_C0;
+       else {
+               gsl_complex_arccos (a, res);
+               gsl_complex_mul_imag (res, GSL_IMAG (res) > 0 ? -1.0 : 1.0, res);
+       }
 }
 
 static void


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