1 /* s_asinhl.c -- long double version of s_asinh.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 #if defined(LIBM_SCCS) && !defined(lint)
18 static char rcsid
[] = "$NetBSD: $";
24 * asinhq(x) = signl(x) * logq [ |x| + sqrtq(x*x+1) ]
26 * asinhq(x) := x if 1+x*x=1,
27 * := signl(x)*(logq(x)+ln2)) for large |x|, else
28 * := signl(x)*logq(2|x|+1/(|x|+sqrtq(x*x+1))) if|x|>2, else
29 * := signl(x)*log1pq(|x| + x^2/(1 + sqrtq(1+x^2)))
32 #include "quadmath-imp.h"
34 static const __float128
36 ln2
= 6.931471805599453094172321214581765681e-1Q
,
48 ix
= sign
& 0x7fffffff;
50 return x
+ x
; /* x is inf or NaN */
53 math_check_force_underflow (x
);
55 return x
; /* return x inexact except 0 */
60 w
= logq (u
.value
) + ln2
;
62 else if (ix
>0x40000000)
63 { /* 2^ 54 > |x| > 2.0 */
65 w
= logq (2.0 * t
+ one
/ (sqrtq (x
* x
+ one
) + t
));
68 { /* 2.0 > |x| > 2 ^ -56 */
70 w
= log1pq (u
.value
+ t
/ (one
+ sqrtq (one
+ t
)));
72 if (sign
& 0x80000000)