3 /* asinh(x) = sign(x)*log(|x|+sqrt(x*x+1)) ~= x - x^3/6 + o(x^5) */
6 union {double f
; uint64_t i
;} u
= {.f
= x
};
7 unsigned e
= u
.i
>> 52 & 0x7ff;
8 unsigned s
= u
.i
>> 63;
11 u
.i
&= (uint64_t)-1/2;
14 if (e
>= 0x3ff + 26) {
15 /* |x| >= 0x1p26 or inf or nan */
16 x
= log(x
) + 0.693147180559945309417232121458176568;
17 } else if (e
>= 0x3ff + 1) {
19 x
= log(2*x
+ 1/(sqrt(x
*x
+1)+x
));
20 } else if (e
>= 0x3ff - 26) {
21 /* |x| >= 0x1p-26, up to 1.6ulp error in [0.125,0.5] */
22 x
= log1p(x
+ x
*x
/(sqrt(x
*x
+1)+1));
24 /* |x| < 0x1p-26, raise inexact if x != 0 */
25 FORCE_EVAL(x
+ 0x1p
120f
);