1 /* e_sinhl.c -- long double version of e_sinh.c.
2 * Conversion to long double by Ulrich Drepper,
3 * Cygnus Support, drepper@cygnus.com.
7 * ====================================================
8 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
10 * Developed at SunPro, a Sun Microsystems, Inc. business.
11 * Permission to use, copy, modify, and distribute this
12 * software is freely granted, provided that this notice
14 * ====================================================
17 /* Changes for 128-bit long double contributed by
18 Stephen L. Moshier <moshier@na-net.ornl.gov> */
22 * mathematically sinh(x) if defined to be (exp(x)-exp(-x))/2
23 * 1. Replace x by |x| (sinhl(-x) = -sinhl(x)).
26 * 0 <= x <= 25 : sinhl(x) := --------------, E=expm1l(x)
29 * 25 <= x <= lnovft : sinhl(x) := expl(x)/2
30 * lnovft <= x <= ln2ovft: sinhl(x) := expl(x/2)/2 * expl(x/2)
31 * ln2ovft < x : sinhl(x) := x*shuge (overflow)
34 * sinhl(x) is |x| if x is +INF, -INF, or NaN.
35 * only sinhl(0)=0 is exact for finite x.
39 #include "math_private.h"
42 static const long double one = 1.0, shuge = 1.0e4931L,
43 ovf_thresh = 1.1357216553474703894801348310092223067821E4L;
45 static long double one = 1.0, shuge = 1.0e4931L,
46 ovf_thresh = 1.1357216553474703894801348310092223067821E4L;
51 __ieee754_sinhl (long double x)
60 ieee854_long_double_shape_type u;
75 /* Absolute value of x. */
78 /* |x| in [0,40], return sign(x)*0.5*(E+E/(E+1))) */
81 if (ix < 0x3fc60000) /* |x| < 2^-57 */
83 return x; /* sinh(tiny) = tiny with inexact */
84 t = __expm1l (u.value);
86 return h * (2.0 * t - t * t / (t + one));
87 return h * (t + t / (t + one));
90 /* |x| in [40, log(maxdouble)] return 0.5*exp(|x|) */
91 if (ix <= 0x400c62e3) /* 11356.375 */
92 return h * __ieee754_expl (u.value);
94 /* |x| in [log(maxdouble), overflowthreshold]
95 Overflow threshold is log(2 * maxdouble). */
96 if (u.value <= ovf_thresh)
98 w = __ieee754_expl (0.5 * u.value);
103 /* |x| > overflowthreshold, sinhl(x) overflow */