]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man3/cosh.3
4aed8cc3ad6885be9d19fde50982ea7012471449
[thirdparty/man-pages.git] / man3 / cosh.3
1 .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
2 .\" and Copyright 2008, Linux Foundation, written by Michael Kerrisk
3 .\" <mtk.manpages@gmail.com>
4 .\"
5 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
6 .\"
7 .\" References consulted:
8 .\" Linux libc source code
9 .\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
10 .\" 386BSD man pages
11 .\" Modified 1993-07-24 by Rik Faith (faith@cs.unc.edu)
12 .\" Modified 1996-06-08 by aeb
13 .\" Modified 2002-07-27 by Walter Harms
14 .\" (walter.harms@informatik.uni-oldenburg.de)
15 .\"
16 .TH COSH 3 2021-03-22 "" "Linux Programmer's Manual"
17 .SH NAME
18 cosh, coshf, coshl \- hyperbolic cosine function
19 .SH LIBRARY
20 Math library
21 .RI ( libm ", " \-lm )
22 .SH SYNOPSIS
23 .nf
24 .B #include <math.h>
25 .PP
26 .BI "double cosh(double " x );
27 .BI "float coshf(float " x );
28 .BI "long double coshl(long double " x );
29 .fi
30 .PP
31 .RS -4
32 Feature Test Macro Requirements for glibc (see
33 .BR feature_test_macros (7)):
34 .RE
35 .PP
36 .BR coshf (),
37 .BR coshl ():
38 .nf
39 _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
40 || /* Since glibc 2.19: */ _DEFAULT_SOURCE
41 || /* Glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
42 .fi
43 .SH DESCRIPTION
44 These functions return the hyperbolic cosine of
45 .IR x ,
46 which is defined mathematically as:
47 .PP
48 .nf
49 cosh(x) = (exp(x) + exp(\-x)) / 2
50 .fi
51 .SH RETURN VALUE
52 On success, these functions return the hyperbolic cosine of
53 .IR x .
54 .PP
55 If
56 .I x
57 is a NaN, a NaN is returned.
58 .PP
59 If
60 .I x
61 is +0 or \-0, 1 is returned.
62 .PP
63 If
64 .I x
65 is positive infinity or negative infinity,
66 positive infinity is returned.
67 .PP
68 If the result overflows,
69 a range error occurs,
70 and the functions return
71 .RB + HUGE_VAL ,
72 .RB + HUGE_VALF ,
73 or
74 .RB + HUGE_VALL ,
75 respectively.
76 .SH ERRORS
77 See
78 .BR math_error (7)
79 for information on how to determine whether an error has occurred
80 when calling these functions.
81 .PP
82 The following errors can occur:
83 .TP
84 Range error: result overflow
85 .I errno
86 is set to
87 .BR ERANGE .
88 An overflow floating-point exception
89 .RB ( FE_OVERFLOW )
90 is raised.
91 .SH ATTRIBUTES
92 For an explanation of the terms used in this section, see
93 .BR attributes (7).
94 .ad l
95 .nh
96 .TS
97 allbox;
98 lbx lb lb
99 l l l.
100 Interface Attribute Value
101 T{
102 .BR cosh (),
103 .BR coshf (),
104 .BR coshl ()
105 T} Thread safety MT-Safe
106 .TE
107 .hy
108 .ad
109 .sp 1
110 .SH CONFORMING TO
111 C99, POSIX.1-2001, POSIX.1-2008.
112 .PP
113 The variant returning
114 .I double
115 also conforms to
116 SVr4, 4.3BSD.
117 .SH BUGS
118 In glibc version 2.3.4 and earlier,
119 an overflow floating-point
120 .RB ( FE_OVERFLOW )
121 exception is not raised when an overflow occurs.
122 .SH SEE ALSO
123 .BR acosh (3),
124 .BR asinh (3),
125 .BR atanh (3),
126 .BR ccos (3),
127 .BR sinh (3),
128 .BR tanh (3)