1cosh(3M) Mathematical Library Functions cosh(3M)
2
3
4
6 cosh, coshf, coshl - hyperbolic cosine function
7
9 c99 [ flag... ] file... -lm [ library... ]
10 #include <math.h>
11
12 double cosh(double x);
13
14
15 float coshf(float x);
16
17
18 long double coshl(long double x);
19
20
22 These functions compute the hyperbolic cosine of their argument x.
23
25 Upon successful completion, these functions return the hyperbolic
26 cosine of x.
27
28
29 If the correct value would cause overflow, a range error occurs and
30 cosh(), coshf(), and coshl() return the value of the macro HUGE_VAL,
31 HUGE_VALF, and HUGE_VALL, respectively.
32
33
34 If x is NaN, a NaN is returned.
35
36
37 If x is ±0, 1.0 is returned.
38
39
40 If x is ±Inf, ±Inf is returned.
41
42
43 For exceptional cases, matherr(3M) tabulates the values to be returned
44 by cosh() as specified by SVID3 and XPG3.
45
47 These functions will fail if:
48
49 Range Error The result would cause an overflow.
50
51 If the integer expression (math_errhandling &
52 MATH_ERREXCEPT) is non-zero, the overflow floating-point
53 exception is raised.
54
55 The cosh() function sets errno to ERANGE if the result
56 would cause an overflow.
57
58
60 An application wanting to check for exceptions should call feclearex‐
61 cept(FE_ALL_EXCEPT) before calling these functions. On return, if
62 fetestexcept(FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW) is
63 non-zero, an exception has been raised. An application should either
64 examine the return value or check the floating point exception flags to
65 detect exceptions.
66
67
68 An application can also set errno to 0 before calling cosh(). On
69 return, if errno is non-zero, an error has occurred. The coshf() and
70 coshl() functions do not set errno.
71
73 See attributes(5) for descriptions of the following attributes:
74
75
76
77
78 ┌─────────────────────────────┬─────────────────────────────┐
79 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
80 ├─────────────────────────────┼─────────────────────────────┤
81 │Interface Stability │Standard │
82 ├─────────────────────────────┼─────────────────────────────┤
83 │MT-Level │MT-Safe │
84 └─────────────────────────────┴─────────────────────────────┘
85
87 acosh(3M), feclearexcept(3M), fetestexcept(3M), isnan(3M),
88 math.h(3HEAD), matherr(3M), sinh(3M), tanh(3M), attributes(5), stan‐
89 dards(5)
90
91
92
93SunOS 5.11 12 Jul 2006 cosh(3M)