OSDN Git Service

- scalb{,f,l} depend on UCLIBC_SUSV3_LEGACY
[uclinux-h8/uClibc.git] / libm / e_atanh.c
index 559e8f1..5cf4da3 100644 (file)
@@ -1,19 +1,14 @@
-/* @(#)e_atanh.c 5.1 93/09/24 */
 /*
  * ====================================================
  * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
  *
  * Developed at SunPro, a Sun Microsystems, Inc. business.
  * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice 
+ * software is freely granted, provided that this notice
  * is preserved.
  * ====================================================
  */
 
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: e_atanh.c,v 1.8 1995/05/10 20:44:55 jtc Exp $";
-#endif
-
 /* __ieee754_atanh(x)
  * Method :
  *    1.Reduced x to positive by atanh(-x) = -atanh(x)
@@ -21,7 +16,7 @@ static char rcsid[] = "$NetBSD: e_atanh.c,v 1.8 1995/05/10 20:44:55 jtc Exp $";
  *                  1              2x                          x
  *     atanh(x) = --- * log(1 + -------) = 0.5 * log1p(2 * --------)
  *                  2             1 - x                      1 - x
- *     
+ *
  *     For x<0.5
  *     atanh(x) = 0.5*log1p(2x+2x*x/(1-x))
  *
@@ -35,24 +30,11 @@ static char rcsid[] = "$NetBSD: e_atanh.c,v 1.8 1995/05/10 20:44:55 jtc Exp $";
 #include "math.h"
 #include "math_private.h"
 
-#ifdef __STDC__
 static const double one = 1.0, huge = 1e300;
-#else
-static double one = 1.0, huge = 1e300;
-#endif
 
-#ifdef __STDC__
 static const double zero = 0.0;
-#else
-static double zero = 0.0;
-#endif
 
-#ifdef __STDC__
-       double __ieee754_atanh(double x)
-#else
-       double __ieee754_atanh(x)
-       double x;
-#endif
+double attribute_hidden __ieee754_atanh(double x)
 {
        double t;
        int32_t hx,ix;
@@ -61,14 +43,37 @@ static double zero = 0.0;
        ix = hx&0x7fffffff;
        if ((ix|((lx|(-lx))>>31))>0x3ff00000) /* |x|>1 */
            return (x-x)/(x-x);
-       if(ix==0x3ff00000) 
+       if(ix==0x3ff00000)
            return x/zero;
        if(ix<0x3e300000&&(huge+x)>zero) return x;      /* x<2**-28 */
        SET_HIGH_WORD(x,ix);
        if(ix<0x3fe00000) {             /* x < 0.5 */
            t = x+x;
            t = 0.5*log1p(t+t*x/(one-x));
-       } else 
+       } else
            t = 0.5*log1p((x+x)/(one-x));
        if(hx>=0) return t; else return -t;
 }
+
+/*
+ * wrapper atanh(x)
+ */
+#ifndef _IEEE_LIBM
+double atanh(double x)
+{
+       double z, y;
+       z = __ieee754_atanh(x);
+       if (_LIB_VERSION == _IEEE_ || isnan(x))
+               return z;
+       y = fabs(x);
+       if (y >= 1.0) {
+               if (y > 1.0)
+                       return __kernel_standard(x, x, 30); /* atanh(|x|>1) */
+               return __kernel_standard(x, x, 31); /* atanh(|x|==1) */
+       }
+       return z;
+}
+#else
+strong_alias(__ieee754_atanh, atanh)
+#endif
+libm_hidden_def(atanh)