3 /* cosh(x) = (exp(x) + 1/exp(x))/2
4 * = 1 + 0.5*(exp(x)-1)*(exp(x)-1)/exp(x)
9 union {double f
; uint64_t i
;} u
= {.f
= x
};
14 u
.i
&= (uint64_t)-1/2;
20 if (w
< 0x3ff00000 - (26<<20)) {
21 /* raise inexact if x!=0 */
22 FORCE_EVAL(x
+ 0x1p
120f
);
26 return 1 + t
*t
/(2*(1+t
));
29 /* |x| < log(DBL_MAX) */
32 /* note: if x>log(0x1p26) then the 1/t is not needed */
36 /* |x| > log(DBL_MAX) or nan */
37 /* note: the result is stored to handle overflow */