Merged changes from newcore
diff --git a/scipy/base/setup.py b/scipy/base/setup.py
index a1455eb..b147d2e 100644
--- a/scipy/base/setup.py
+++ b/scipy/base/setup.py
@@ -62,6 +62,8 @@
moredefs.append('HAVE_INVERSE_HYPERBOLIC')
if config_cmd.check_func('atanhf', **kws_args):
moredefs.append('HAVE_INVERSE_HYPERBOLIC_FLOAT')
+ if config_cmd.check_func('atanhl', **kws_args):
+ moredefs.append('HAVE_INVERSE_HYPERBOLIC_LONGDOUBLE')
if config_cmd.check_func('isnan', **kws_args):
moredefs.append('HAVE_ISNAN')
diff --git a/scipy/base/src/umathmodule.c.src b/scipy/base/src/umathmodule.c.src
index fe4d8bb..67742fa 100644
--- a/scipy/base/src/umathmodule.c.src
+++ b/scipy/base/src/umathmodule.c.src
@@ -47,23 +47,6 @@
}
#endif
-#if !defined(HAVE_INVERSE_HYPERBOLIC_FLOAT)
-static float acoshf(float x)
-{
- return (float)acosh((double)(x));
-}
-
-static float asinhf(float x)
-{
- return (float)asinh((double)(x));
-}
-
-static float atanhf(float x)
-{
- return (float)atanh((double)(x));
-}
-#endif
-
#ifdef HAVE_HYPOT
#if !defined(NeXT) && !defined(_MSC_VER)
extern double hypot(double, double);
@@ -239,6 +222,97 @@
/**end repeat**/
+#if !defined(HAVE_INVERSE_HYPERBOLIC_FLOAT)
+#ifdef HAVE_FLOAT_FUNCS
+static float acoshf(float x)
+{
+ return logf(x + sqrtf((x-1.0)*(x+1.0)));
+}
+
+static float asinhf(float xx)
+{
+ float x;
+ int sign;
+ if (xx < 0.0) {
+ sign = -1;
+ x = -xx;
+ }
+ else {
+ sign = 1;
+ x = xx;
+ }
+ return sign*logf(x + sqrtf(x*x+1.0));
+}
+
+static float atanhf(float x)
+{
+ return 0.5*logf((1.0+x)/(1.0-x));
+}
+#else
+static float acoshf(float x)
+{
+ return (float)acosh((double)(x));
+}
+
+static float asinhf(float x)
+{
+ return (float)asinh((double)(x));
+}
+
+static float atanhf(float x)
+{
+ return (float)atanh((double)(x));
+}
+#endif
+#endif
+
+
+#if !defined(HAVE_INVERSE_HYPERBOLIC_LONGDOUBLE)
+#ifdef HAVE_LONGDOUBLE_FUNCS
+static longdouble acoshl(longdouble x)
+{
+ return logl(x + sqrtl((x-1.0)*(x+1.0)));
+}
+
+static longdouble asinhl(longdouble xx)
+{
+ longdouble x;
+ int sign;
+ if (xx < 0.0) {
+ sign = -1;
+ x = -xx;
+ }
+ else {
+ sign = 1;
+ x = xx;
+ }
+ return sign*logl(x + sqrtl(x*x+1.0));
+}
+
+static longdouble atanhl(longdouble x)
+{
+ return 0.5*logl((1.0+x)/(1.0-x));
+}
+#else
+static longdouble acoshl(longdouble x)
+{
+ return (longdouble)acosh((double)(x));
+}
+
+static longdouble asinhl(longdouble x)
+{
+ return (longdouble)asinh((double)(x));
+}
+
+static longdouble atanhl(longdouble x)
+{
+ return (longdouble)atanh((double)(x));
+}
+#endif
+#endif
+
+
+
/* Don't pass structures between functions (only pointers) because how
structures are passed is compiler dependent and could cause