1COS(3) Linux Programmer's Manual COS(3)
2
3
4
6 cos, cosf, cosl - cosine function
7
9 #include <math.h>
10
11 double cos(double x);
12 float cosf(float x);
13 long double cosl(long double x);
14
15 Link with -lm.
16
17 Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
18
19 cosf(), cosl():
20 _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
21 || /* Since glibc 2.19: */ _DEFAULT_SOURCE
22 || /* Glibc versions <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
23
25 These functions return the cosine of x, where x is given in radians.
26
28 On success, these functions return the cosine of x.
29
30 If x is a NaN, a NaN is returned.
31
32 If x is positive infinity or negative infinity, a domain error occurs,
33 and a NaN is returned.
34
36 See math_error(7) for information on how to determine whether an error
37 has occurred when calling these functions.
38
39 The following errors can occur:
40
41 Domain error: x is an infinity
42 errno is set to EDOM (but see BUGS). An invalid floating-point
43 exception (FE_INVALID) is raised.
44
46 For an explanation of the terms used in this section, see
47 attributes(7).
48
49 ┌──────────────────────┬───────────────┬─────────┐
50 │Interface │ Attribute │ Value │
51 ├──────────────────────┼───────────────┼─────────┤
52 │cos(), cosf(), cosl() │ Thread safety │ MT-Safe │
53 └──────────────────────┴───────────────┴─────────┘
55 C99, POSIX.1-2001, POSIX.1-2008.
56
57 The variant returning double also conforms to SVr4, 4.3BSD.
58
60 Before version 2.10, the glibc implementation did not set errno to EDOM
61 when a domain error occurred.
62
64 acos(3), asin(3), atan(3), atan2(3), ccos(3), sin(3), sincos(3), tan(3)
65
67 This page is part of release 5.02 of the Linux man-pages project. A
68 description of the project, information about reporting bugs, and the
69 latest version of this page, can be found at
70 https://www.kernel.org/doc/man-pages/.
71
72
73
74 2017-09-15 COS(3)