1 /* @(#)e_sinh.c 5.1 93/09/24 */
3 * ====================================================
4 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
6 * Developed at SunPro, a Sun Microsystems, Inc. business.
7 * Permission to use, copy, modify, and distribute this
8 * software is freely granted, provided that this notice
10 * ====================================================
12 * $FreeBSD: src/lib/msun/src/e_sinh.c,v 1.6 1999/08/28 00:06:39 peter Exp $
13 * $DragonFly: src/lib/msun/src/Attic/e_sinh.c,v 1.2 2003/06/17 04:26:53 dillon Exp $
18 * mathematically sinh(x) if defined to be (exp(x)-exp(-x))/2
19 * 1. Replace x by |x| (sinh(-x) = -sinh(x)).
22 * 0 <= x <= 22 : sinh(x) := --------------, E=expm1(x)
25 * 22 <= x <= lnovft : sinh(x) := exp(x)/2
26 * lnovft <= x <= ln2ovft: sinh(x) := exp(x/2)/2 * exp(x/2)
27 * ln2ovft < x : sinh(x) := x*shuge (overflow)
30 * sinh(x) is |x| if x is +INF, -INF, or NaN.
31 * only sinh(0)=0 is exact for finite x.
35 #include "math_private.h"
38 static const double one = 1.0, shuge = 1.0e307;
40 static double one = 1.0, shuge = 1.0e307;
44 double __ieee754_sinh(double x)
46 double __ieee754_sinh(x)
54 /* High word of |x|. */
59 if(ix>=0x7ff00000) return x+x;
63 /* |x| in [0,22], return sign(x)*0.5*(E+E/(E+1))) */
64 if (ix < 0x40360000) { /* |x|<22 */
65 if (ix<0x3e300000) /* |x|<2**-28 */
66 if(shuge+x>one) return x;/* sinh(tiny) = tiny with inexact */
68 if(ix<0x3ff00000) return h*(2.0*t-t*t/(t+one));
69 return h*(t+t/(t+one));
72 /* |x| in [22, log(maxdouble)] return 0.5*exp(|x|) */
73 if (ix < 0x40862E42) return h*__ieee754_exp(fabs(x));
75 /* |x| in [log(maxdouble), overflowthresold] */
77 if (ix<0x408633CE || ((ix==0x408633ce)&&(lx<=(u_int32_t)0x8fb9f87d))) {
78 w = __ieee754_exp(0.5*fabs(x));
83 /* |x| > overflowthresold, sinh(x) overflow */