2 * ====================================================
3 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
5 * Developed at SunPro, a Sun Microsystems, Inc. business.
6 * Permission to use, copy, modify, and distribute this
7 * software is freely granted, provided that this notice
9 * ====================================================
14 * mathematically sinh(x) if defined to be (exp(x)-exp(-x))/2
15 * 1. Replace x by |x| (sinh(-x) = -sinh(x)).
18 * 0 <= x <= 22 : sinh(x) := --------------, E=expm1(x)
21 * 22 <= x <= lnovft : sinh(x) := exp(x)/2
22 * lnovft <= x <= ln2ovft: sinh(x) := exp(x/2)/2 * exp(x/2)
23 * ln2ovft < x : sinh(x) := x*shuge (overflow)
26 * sinh(x) is |x| if x is +INF, -INF, or NaN.
27 * only sinh(0)=0 is exact for finite x.
31 #include "math_private.h"
33 static const double one = 1.0, shuge = 1.0e307;
35 double __ieee754_sinh(double x)
41 /* High word of |x|. */
46 if(ix>=0x7ff00000) return x+x;
50 /* |x| in [0,22], return sign(x)*0.5*(E+E/(E+1))) */
51 if (ix < 0x40360000) { /* |x|<22 */
52 if (ix<0x3e300000) /* |x|<2**-28 */
53 if(shuge+x>one) return x;/* sinh(tiny) = tiny with inexact */
55 if(ix<0x3ff00000) return h*(2.0*t-t*t/(t+one));
56 return h*(t+t/(t+one));
59 /* |x| in [22, log(maxdouble)] return 0.5*exp(|x|) */
60 if (ix < 0x40862E42) return h*__ieee754_exp(fabs(x));
62 /* |x| in [log(maxdouble), overflowthresold] */
64 if (ix<0x408633CE || ((ix==0x408633ce)&&(lx<=(u_int32_t)0x8fb9f87d))) {
65 w = __ieee754_exp(0.5*fabs(x));
70 /* |x| > overflowthresold, sinh(x) overflow */
80 double z = __ieee754_sinh(x);
81 if (_LIB_VERSION == _IEEE_)
83 if (!isfinite(z) && isfinite(x))
84 return __kernel_standard(x, x, 25); /* sinh overflow */
88 strong_alias(__ieee754_sinh, sinh)