]>
Commit | Line | Data |
---|---|---|
fea681da | 1 | .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk) |
9b3a8137 MK |
2 | .\" and Copyright 2008, Linux Foundation, written by Michael Kerrisk |
3 | .\" <mtk.manpages@gmail.com> | |
fea681da | 4 | .\" |
5fbde956 | 5 | .\" SPDX-License-Identifier: Linux-man-pages-copyleft |
fea681da MK |
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 2002-07-27 by Walter Harms | |
13 | .\" (walter.harms@informatik.uni-oldenburg.de) | |
1ae6b2c7 | 14 | .TH COS 3 2021-03-22 GNU "Linux Programmer's Manual" |
fea681da MK |
15 | .SH NAME |
16 | cos, cosf, cosl \- cosine function | |
2af19291 AC |
17 | .SH LIBRARY |
18 | Math library | |
8fc3b2cf | 19 | .RI ( libm ", " \-lm ) |
fea681da MK |
20 | .SH SYNOPSIS |
21 | .nf | |
22 | .B #include <math.h> | |
68e4db0a | 23 | .PP |
fea681da | 24 | .BI "double cos(double " x ); |
fea681da | 25 | .BI "float cosf(float " x ); |
fea681da MK |
26 | .BI "long double cosl(long double " x ); |
27 | .fi | |
68e4db0a | 28 | .PP |
d39ad78f | 29 | .RS -4 |
9b3a8137 MK |
30 | Feature Test Macro Requirements for glibc (see |
31 | .BR feature_test_macros (7)): | |
d39ad78f | 32 | .RE |
68e4db0a | 33 | .PP |
9b3a8137 MK |
34 | .BR cosf (), |
35 | .BR cosl (): | |
9d2adbae | 36 | .nf |
5c10d2c5 | 37 | _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L |
9d2adbae MK |
38 | || /* Since glibc 2.19: */ _DEFAULT_SOURCE |
39 | || /* Glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE | |
40 | .fi | |
fea681da | 41 | .SH DESCRIPTION |
5600f73a | 42 | These functions return the cosine of |
022671eb MK |
43 | .IR x , |
44 | where | |
45 | .I x | |
46 | is | |
fea681da | 47 | given in radians. |
9b3a8137 MK |
48 | .SH RETURN VALUE |
49 | On success, these functions return the cosine of | |
50 | .IR x . | |
847e0d88 | 51 | .PP |
9b3a8137 MK |
52 | If |
53 | .I x | |
54 | is a NaN, a NaN is returned. | |
847e0d88 | 55 | .PP |
9b3a8137 MK |
56 | If |
57 | .I x | |
58 | is positive infinity or negative infinity, | |
efe294cb | 59 | a domain error occurs, |
9b3a8137 MK |
60 | and a NaN is returned. |
61 | .SH ERRORS | |
62 | See | |
63 | .BR math_error (7) | |
64 | for information on how to determine whether an error has occurred | |
65 | when calling these functions. | |
66 | .PP | |
67 | The following errors can occur: | |
68 | .TP | |
69 | Domain error: \fIx\fP is an infinity | |
3e723689 MK |
70 | .I errno |
71 | is set to | |
1ae6b2c7 | 72 | .B EDOM |
3e723689 | 73 | (but see BUGS). |
9b3a8137 MK |
74 | An invalid floating-point exception |
75 | .RB ( FE_INVALID ) | |
76 | is raised. | |
ad6be0a4 | 77 | .SH ATTRIBUTES |
5926b7f9 MK |
78 | For an explanation of the terms used in this section, see |
79 | .BR attributes (7). | |
c466875e MK |
80 | .ad l |
81 | .nh | |
5926b7f9 MK |
82 | .TS |
83 | allbox; | |
c466875e | 84 | lbx lb lb |
5926b7f9 MK |
85 | l l l. |
86 | Interface Attribute Value | |
87 | T{ | |
ad6be0a4 PH |
88 | .BR cos (), |
89 | .BR cosf (), | |
ad6be0a4 | 90 | .BR cosl () |
5926b7f9 MK |
91 | T} Thread safety MT-Safe |
92 | .TE | |
c466875e MK |
93 | .hy |
94 | .ad | |
95 | .sp 1 | |
47297adb | 96 | .SH CONFORMING TO |
9a74e018 | 97 | C99, POSIX.1-2001, POSIX.1-2008. |
847e0d88 | 98 | .PP |
9b3a8137 MK |
99 | The variant returning |
100 | .I double | |
101 | also conforms to | |
102 | SVr4, 4.3BSD. | |
3e723689 MK |
103 | .SH BUGS |
104 | Before version 2.10, the glibc implementation did not set | |
105 | .\" http://sources.redhat.com/bugzilla/show_bug.cgi?id=6780 | |
106 | .I errno | |
107 | to | |
108 | .B EDOM | |
109 | when a domain error occurred. | |
47297adb | 110 | .SH SEE ALSO |
fea681da MK |
111 | .BR acos (3), |
112 | .BR asin (3), | |
113 | .BR atan (3), | |
114 | .BR atan2 (3), | |
36268806 | 115 | .BR ccos (3), |
fea681da | 116 | .BR sin (3), |
63a6644b | 117 | .BR sincos (3), |
fea681da | 118 | .BR tan (3) |