2 /* @(#)w_cosh.c 5.1 93/09/24 */
4 * ====================================================
5 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
7 * Developed at SunPro, a Sun Microsystems, Inc. business.
8 * Permission to use, copy, modify, and distribute this
9 * software is freely granted, provided that this notice
11 * ====================================================
17 <<cosh>>, <<coshf>>---hyperbolic cosine
21 double cosh(double <[x]>);
22 float coshf(float <[x]>)
34 <<cosh>> computes the hyperbolic cosine of the argument <[x]>.
35 <<cosh(<[x]>)>> is defined as
37 . (exp(x) + exp(-x))/2
40 $${(e^x + e^{-x})} \over 2$$
43 Angles are specified in radians.
45 <<coshf>> is identical, save that it takes and returns <<float>>.
48 The computed value is returned. When the correct value would create
49 an overflow, <<cosh>> returns the value <<HUGE_VAL>> with the
50 appropriate sign, and the global value <<errno>> is set to <<ERANGE>>.
52 You can modify error handling for these functions using the
57 <<coshf>> is an extension.
71 #ifndef _DOUBLE_IS_32BITS
74 double cosh(double x
) /* wrapper cosh */
76 double cosh(x
) /* wrapper cosh */
81 return __ieee754_cosh(x
);
85 z
= __ieee754_cosh(x
);
86 if(_LIB_VERSION
== _IEEE_
|| isnan(x
)) return z
;
87 if(fabs(x
)>7.10475860073943863426e+02) {
88 /* cosh(finite) overflow */
93 SET_HIGH_WORD(inf
,0x7ff00000); /* set inf to infinite */
98 exc
.arg1
= exc
.arg2
= x
;
99 if (_LIB_VERSION
== _SVID_
)
102 exc
.retval
= HUGE_VAL
;
103 if (_LIB_VERSION
== _POSIX_
)
105 else if (!matherr(&exc
)) {
116 #endif /* defined(_DOUBLE_IS_32BITS) */