3 /* sinh(x) = (exp(x) - 1/exp(x))/2
4 * = (exp(x)-1 + (exp(x)-1)/exp(x))/2
9 union {double f
; uint64_t i
;} u
= {.f
= x
};
17 u
.i
&= (uint64_t)-1/2;
21 /* |x| < log(DBL_MAX) */
25 if (w
< 0x3ff00000 - (26<<20))
26 /* note: inexact and underflow are raised by expm1 */
27 /* note: this branch avoids spurious underflow */
29 return h
*(2*t
- t
*t
/(t
+1));
31 /* note: |x|>log(0x1p26)+eps could be just h*exp(x) */
32 return h
*(t
+ t
/(t
+1));
35 /* |x| > log(DBL_MAX) or nan */
36 /* note: the result is stored to handle overflow */
37 t
= __expo2(absx
, 2*h
);