Debian Codegraph @

upstream/debian-unstable/man3/cosh.3

raw
1 '\" t
2 .\" Copyright 1993, David Metcalfe <[email protected]>
3 .\" Copyright, the authors of the Linux man-pages project
4 .\"
5 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
6 .\"
7 .TH cosh 3 2026-02-08 "Linux man-pages 6.18"
8 .SH NAME
9 cosh, coshf, coshl \- hyperbolic cosine function
10 .SH LIBRARY
11 Math library
12 .RI ( libm ,\~ \-lm )
13 .SH SYNOPSIS
14 .nf
15 .B #include <math.h>
16 .P
17 .BI "double cosh(double " x );
18 .BI "float coshf(float " x );
19 .BI "long double coshl(long double " x );
20 .fi
21 .P
22 .RS -4
23 Feature Test Macro Requirements for glibc (see
24 .BR feature_test_macros (7)):
25 .RE
26 .P
27 .BR coshf (),
28 .BR coshl ():
29 .nf
30 _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
31 || /* Since glibc 2.19: */ _DEFAULT_SOURCE
32 || /* glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
33 .fi
34 .SH DESCRIPTION
35 These functions return the hyperbolic cosine of
36 .IR x ,
37 which is defined mathematically as:
38 .P
39 .in +4n
40 .EX
41 cosh(x) = (exp(x) + exp(\-x)) / 2
42 .EE
43 .in
44 .SH RETURN VALUE
45 On success, these functions return the hyperbolic cosine of
46 .IR x .
47 .P
48 If
49 .I x
50 is a NaN, a NaN is returned.
51 .P
52 If
53 .I x
54 is +0 or \-0, 1 is returned.
55 .P
56 If
57 .I x
58 is positive infinity or negative infinity,
59 positive infinity is returned.
60 .P
61 If the result overflows,
62 a range error occurs,
63 and the functions return
64 .RB + HUGE_VAL ,
65 .RB + HUGE_VALF ,
66 or
67 .RB + HUGE_VALL ,
68 respectively.
69 .SH ERRORS
70 See
71 .BR math_error (7)
72 for information on how to determine whether an error has occurred
73 when calling these functions.
74 .P
75 The following errors can occur:
76 .TP
77 Range error: result overflow
78 .I errno
79 is set to
80 .BR ERANGE .
81 An overflow floating-point exception
82 .RB ( FE_OVERFLOW )
83 is raised.
84 .SH ATTRIBUTES
85 For an explanation of the terms used in this section, see
86 .BR attributes (7).
87 .TS
88 allbox;
89 lbx lb lb
90 l l l.
91 Interface Attribute Value
92 T{
93 .na
94 .nh
95 .BR cosh (),
96 .BR coshf (),
97 .BR coshl ()
98 T} Thread safety MT-Safe
99 .TE
100 .SH STANDARDS
101 C11, POSIX.1-2008.
102 .SH HISTORY
103 C99, POSIX.1-2001.
104 .P
105 The variant returning
106 .I double
107 also conforms to
108 SVr4, 4.3BSD.
109 .SH BUGS
110 In glibc 2.3.4 and earlier,
111 an overflow floating-point
112 .RB ( FE_OVERFLOW )
113 exception is not raised when an overflow occurs.
114 .SH SEE ALSO
115 .BR acosh (3),
116 .BR asinh (3),
117 .BR atanh (3),
118 .BR ccos (3),
119 .BR sinh (3),
120 .BR tanh (3)