Allow 2 insns from sched group to issue in same cycle, if no stalls needed.
[official-gcc.git] / libquadmath / math / asinhq.c
blobf3644939b3a888b20185d83d366b267a0d76e7e6
1 /* asinhq.c -- __float128 version of s_asinh.c.
2 * Conversion to long double by Ulrich Drepper,
3 * Cygnus Support, drepper@cygnus.com.
4 */
6 /*
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
13 * is preserved.
14 * ====================================================
17 /* asinhl(x)
18 * Method :
19 * Based on
20 * asinhl(x) = signl(x) * logl [ |x| + sqrtl(x*x+1) ]
21 * we have
22 * asinhl(x) := x if 1+x*x=1,
23 * := signl(x)*(logl(x)+ln2)) for large |x|, else
24 * := signl(x)*logl(2|x|+1/(|x|+sqrtl(x*x+1))) if|x|>2, else
25 * := signl(x)*log1pl(|x| + x^2/(1 + sqrtl(1+x^2)))
28 #include "quadmath-imp.h"
30 static const __float128
31 one = 1.0Q,
32 ln2 = 6.931471805599453094172321214581765681e-1Q,
33 huge = 1.0e+4900Q;
35 __float128
36 asinhq (__float128 x)
38 __float128 t, w;
39 int32_t ix, sign;
40 ieee854_float128 u;
42 u.value = x;
43 sign = u.words32.w0;
44 ix = sign & 0x7fffffff;
45 if (ix == 0x7fff0000)
46 return x + x; /* x is inf or NaN */
47 if (ix < 0x3fc70000)
48 { /* |x| < 2^ -56 */
49 math_check_force_underflow (x);
50 if (huge + x > one)
51 return x; /* return x inexact except 0 */
53 u.words32.w0 = ix;
54 if (ix > 0x40350000)
55 { /* |x| > 2 ^ 54 */
56 w = logq (u.value) + ln2;
58 else if (ix >0x40000000)
59 { /* 2^ 54 > |x| > 2.0 */
60 t = u.value;
61 w = logq (2.0 * t + one / (sqrtq (x * x + one) + t));
63 else
64 { /* 2.0 > |x| > 2 ^ -56 */
65 t = x * x;
66 w = log1pq (u.value + t / (one + sqrtq (one + t)));
68 if (sign & 0x80000000)
69 return -w;
70 else
71 return w;