OSDN Git Service

libm: fix C99_MATH on __NO_LONG_DOUBLE_MATH hosts
[uclinux-h8/uClibc.git] / libm / e_sinh.c
index e1e614c..972307e 100644 (file)
@@ -1,29 +1,24 @@
-/* @(#)e_sinh.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_sinh.c,v 1.7 1995/05/10 20:46:13 jtc Exp $";
-#endif
-
 /* __ieee754_sinh(x)
- * Method : 
+ * Method :
  * mathematically sinh(x) if defined to be (exp(x)-exp(-x))/2
- *     1. Replace x by |x| (sinh(-x) = -sinh(x)). 
- *     2. 
+ *     1. Replace x by |x| (sinh(-x) = -sinh(x)).
+ *     2.
  *                                                 E + E/(E+1)
  *         0        <= x <= 22     :  sinh(x) := --------------, E=expm1(x)
  *                                                     2
  *
- *         22       <= x <= lnovft :  sinh(x) := exp(x)/2 
+ *         22       <= x <= lnovft :  sinh(x) := exp(x)/2
  *         lnovft   <= x <= ln2ovft:  sinh(x) := exp(x/2)/2 * exp(x/2)
  *         ln2ovft  <  x           :  sinh(x) := x*shuge (overflow)
  *
@@ -35,19 +30,10 @@ static char rcsid[] = "$NetBSD: e_sinh.c,v 1.7 1995/05/10 20:46:13 jtc Exp $";
 #include "math.h"
 #include "math_private.h"
 
-#ifdef __STDC__
 static const double one = 1.0, shuge = 1.0e307;
-#else
-static double one = 1.0, shuge = 1.0e307;
-#endif
 
-#ifdef __STDC__
-       double __ieee754_sinh(double x)
-#else
-       double __ieee754_sinh(x)
-       double x;
-#endif
-{      
+double attribute_hidden __ieee754_sinh(double x)
+{
        double t,w,h;
        int32_t ix,jx;
        u_int32_t lx;
@@ -57,7 +43,7 @@ static double one = 1.0, shuge = 1.0e307;
        ix = jx&0x7fffffff;
 
     /* x is INF or NaN */
-       if(ix>=0x7ff00000) return x+x;  
+       if(ix>=0x7ff00000) return x+x;
 
        h = 0.5;
        if (jx<0) h = -h;
@@ -84,3 +70,21 @@ static double one = 1.0, shuge = 1.0e307;
     /* |x| > overflowthresold, sinh(x) overflow */
        return x*shuge;
 }
+
+/*
+ * wrapper sinh(x)
+ */
+#ifndef _IEEE_LIBM
+double sinh(double x)
+{
+       double z = __ieee754_sinh(x);
+       if (_LIB_VERSION == _IEEE_)
+               return z;
+       if (!isfinite(z) && isfinite(x))
+               return __kernel_standard(x, x, 25); /* sinh overflow */
+       return z;
+}
+#else
+strong_alias(__ieee754_sinh, sinh)
+#endif
+libm_hidden_def(sinh)