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 _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE >= 600 ||
21 _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L;
22 or cc -std=c99
23
25 The cos() function returns the cosine of x, where x is given in radi‐
26 ans.
27
29 On success, these functions return the cosine of x.
30
31 If x is a NaN, a NaN is returned.
32
33 If x is positive infinity or negative infinity, a domain error occurs,
34 and a NaN is returned.
35
37 See math_error(7) for information on how to determine whether an error
38 has occurred when calling these functions.
39
40 The following errors can occur:
41
42 Domain error: x is an infinity
43 errno is set to EDOM (but see BUGS). An invalid floating-point
44 exception (FE_INVALID) is raised.
45
47 C99, POSIX.1-2001. The variant returning double also conforms to SVr4,
48 4.3BSD.
49
51 Before version 2.10, the glibc implementation did not set errno to EDOM
52 when a domain error occurred.
53
55 acos(3), asin(3), atan(3), atan2(3), ccos(3), sin(3), sincos(3), tan(3)
56
58 This page is part of release 3.53 of the Linux man-pages project. A
59 description of the project, and information about reporting bugs, can
60 be found at http://www.kernel.org/doc/man-pages/.
61
62
63
64 2010-09-11 COS(3)