1cos(3M) Mathematical Library Functions cos(3M)
2
3
4
6 cos, cosf, cosl - cosine function
7
9 c99 [ flag... ] file... -lm [ library... ]
10 #include <math.h>
11
12 double cos(double x);
13
14
15 float cosf(float x);
16
17
18 long double cosl(long double x);
19
20
22 These functions compute the cosine of x, measured in radians.
23
25 Upon successful completion, these functions return the cosine of x.
26
27
28 If x is NaN, NaN is returned.
29
30
31 If x is +0, 1.0 is returned.
32
33
34 If x is ±Inf, a domain error occurs and a NaN is returned.
35
37 These functions will fail if:
38
39 Domain Error The x argument is ±Inf.
40
41 If the integer expression (math_errhandling &
42 MATH_ERREXCEPT) is non-zero, the invalid floating-point
43 exception is raised.
44
45
47 An application wanting to check for exceptions should call feclearex‐
48 cept(FE_ALL_EXCEPT) before calling these functions. On return, if
49 fetestexcept(FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW) is
50 non-zero, an exception has been raised. An application should either
51 examine the return value or check the floating point exception flags to
52 detect exceptions.
53
55 See attributes(5) for descriptions of the following attributes:
56
57
58
59
60 ┌─────────────────────────────┬─────────────────────────────┐
61 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
62 ├─────────────────────────────┼─────────────────────────────┤
63 │Interface Stability │Standard │
64 ├─────────────────────────────┼─────────────────────────────┤
65 │MT-Level │MT-Safe │
66 └─────────────────────────────┴─────────────────────────────┘
67
69 acos(3M), feclearexcept(3M), fetestexcept(3M), isnan(3M),
70 math.h(3HEAD), sin(3M), tan(3M), attributes(5), standards(5)
71
72
73
74SunOS 5.11 12 Jul 2006 cos(3M)