1acos(3M) Mathematical Library Functions acos(3M)
2
3
4
6 acos, acosf, acosl - arc cosine functions
7
9 c99 [ flag... ] file... -lm [ library... ]
10 #include <math.h>
11
12 double acos(double x);
13
14
15 float acosf(float x);
16
17
18 long double acosl(long double x);
19
20
22 These functions compute the principal value of the arc cosine of x. The
23 value of x should be in the range [−1,1].
24
26 Upon successful completion, these functions return the arc cosine of x
27 in the range [0, pi] radians.
28
29
30 For finite values of x not in the range [−1,1], a domain error occurs
31 and NaN is returned.
32
33
34 If x is NaN, NaN is returned.
35
36
37 If x is +1, +0 is returned.
38
39
40 If x is ±Inf, a domain error occurs and NaN is returned.
41
42
43 For exceptional cases, matherr(3M) tabulates the values to be returned
44 by acos() as specified by SVID3 and XPG3.
45
47 These functions will fail if:
48
49 Domain Error The x argument is finite and not in the range [-1,1],
50 or is ±Inf.
51
52 If the integer expression (math_errhandling &
53 MATH_ERREXCEPT) is non-zero, the invalid floating-point
54 exception is raised.
55
56 The acos() function sets errno to EDOM if x is not ±Inf
57 or NaN and is not in the range [−1,1].
58
59
61 An application wanting to check for exceptions should call feclearex‐
62 cept(FE_ALL_EXCEPT) before calling these functions. On return, if
63 fetestexcept(FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW) is
64 non-zero, an exception has been raised. An application should either
65 examine the return value or check the floating point exception flags to
66 detect exceptions.
67
68
69 An application can also set errno to 0 before calling acos(). On
70 return, if errno is non-zero, an error has occurred. The acosf() and
71 acosl() functions do not set errno.
72
74 See attributes(5) for descriptions of the following attributes:
75
76
77
78
79 ┌─────────────────────────────┬─────────────────────────────┐
80 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
81 ├─────────────────────────────┼─────────────────────────────┤
82 │Interface Stability │Standard │
83 ├─────────────────────────────┼─────────────────────────────┤
84 │MT-Level │MT-Safe │
85 └─────────────────────────────┴─────────────────────────────┘
86
88 cos(3M), feclearexcept(3M), fetestexcept(3M), isnan(3M), math.h(3HEAD),
89 matherr(3M), attributes(5), standards(5)
90
91
92
93SunOS 5.11 12 Jul 2006 acos(3M)