More strict check of AVX512 support in assembler.
[glibc.git] / sysdeps / ieee754 / ldbl-128ibm / e_sinhl.c
blob1790bef87eafe63bfade9228de266312731f086e
1 /*
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
8 * is preserved.
9 * ====================================================
13 /* __ieee754_sinh(x)
14 * Method :
15 * mathematically sinh(x) if defined to be (exp(x)-exp(-x))/2
16 * 1. Replace x by |x| (sinh(-x) = -sinh(x)).
17 * 2.
18 * E + E/(E+1)
19 * 0 <= x <= 40 : sinh(x) := --------------, E=expm1(x)
20 * 2
22 * 40 <= x <= lnovft : sinh(x) := exp(x)/2
23 * lnovft <= x <= ln2ovft: sinh(x) := exp(x/2)/2 * exp(x/2)
24 * ln2ovft < x : sinh(x) := x*shuge (overflow)
26 * Special cases:
27 * sinh(x) is |x| if x is +INF, -INF, or NaN.
28 * only sinh(0)=0 is exact for finite x.
31 #include <math.h>
32 #include <math_private.h>
34 static const long double one = 1.0, shuge = 1.0e307;
36 long double
37 __ieee754_sinhl(long double x)
39 long double t,w,h;
40 int64_t ix,jx;
41 double xhi;
43 /* High word of |x|. */
44 xhi = ldbl_high (x);
45 EXTRACT_WORDS64 (jx, xhi);
46 ix = jx&0x7fffffffffffffffLL;
48 /* x is INF or NaN */
49 if(ix>=0x7ff0000000000000LL) return x+x;
51 h = 0.5;
52 if (jx<0) h = -h;
53 /* |x| in [0,40], return sign(x)*0.5*(E+E/(E+1))) */
54 if (ix < 0x4044000000000000LL) { /* |x|<40 */
55 if (ix<0x3e20000000000000LL) /* |x|<2**-29 */
56 if(shuge+x>one) return x;/* sinhl(tiny) = tiny with inexact */
57 t = __expm1l(fabsl(x));
58 if(ix<0x3ff0000000000000LL) return h*(2.0*t-t*t/(t+one));
59 w = t/(t+one);
60 return h*(t+w);
63 /* |x| in [40, log(maxdouble)] return 0.5*exp(|x|) */
64 if (ix < 0x40862e42fefa39efLL) return h*__ieee754_expl(fabsl(x));
66 /* |x| in [log(maxdouble), overflowthresold] */
67 if (ix <= 0x408633ce8fb9f87dLL) {
68 w = __ieee754_expl(0.5*fabsl(x));
69 t = h*w;
70 return t*w;
73 /* |x| > overflowthresold, sinh(x) overflow */
74 return x*shuge;
76 strong_alias (__ieee754_sinhl, __sinhl_finite)