1cos(3) Library Functions Manual cos(3)
2
3
4
6 cos, cosf, cosl - cosine function
7
9 Math library (libm, -lm)
10
12 #include <math.h>
13
14 double cos(double x);
15 float cosf(float x);
16 long double cosl(long double x);
17
18 Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
19
20 cosf(), cosl():
21 _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
22 || /* Since glibc 2.19: */ _DEFAULT_SOURCE
23 || /* glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
24
26 These functions return the cosine of x, where x is given in radians.
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 For an explanation of the terms used in this section, see at‐
48 tributes(7).
49
50 ┌────────────────────────────────────────────┬───────────────┬─────────┐
51 │Interface │ Attribute │ Value │
52 ├────────────────────────────────────────────┼───────────────┼─────────┤
53 │cos(), cosf(), cosl() │ Thread safety │ MT-Safe │
54 └────────────────────────────────────────────┴───────────────┴─────────┘
55
57 C11, POSIX.1-2008.
58
60 C89, POSIX.1-2001.
61
62 The variant returning double also conforms to SVr4, 4.3BSD.
63
65 Before glibc 2.10, the glibc implementation did not set errno to EDOM
66 when a domain error occurred.
67
69 acos(3), asin(3), atan(3), atan2(3), ccos(3), sin(3), sincos(3), tan(3)
70
71
72
73Linux man-pages 6.05 2023-07-20 cos(3)