- NAME
-
acos - arc cosine function.
- SYNOPSIS
#include <math.h>
double acos(double x);
- DESCRIPTION
-
The acos() function calculates the arc cosine of x; that is the value whose cosine is x. If x falls outside the range -1 to 1, acos() fails and errno is set.
Warning
|
You’ll also need to link the program against the math library (see example below) using the -lm compile/link option.
|
- RETURN VALUE
-
The acos() function returns the arc cosine in radians and the value is mathematically defined to be between 0 and PI (inclusive).
- ERRORS
-
EDOM - x is out of range [-1, 1].
- SEE ALSO
-
asin, atan, atan2, cos, sin, tan
- EXAMPLE
link:src/acos.c[role=include]
- OUTPUT
$ gcc -Wall -lm acos.c $ ./a.out ACOS(-1.000000) = 3.141593 ACOS(-0.900000) = 2.690566 ACOS(-0.800000) = 2.498091 ACOS(-0.700000) = 2.346194 ACOS(-0.600000) = 2.214297 ACOS(-0.500000) = 2.094395 ACOS(-0.400000) = 1.982313 ACOS(-0.300000) = 1.875489 ACOS(-0.200000) = 1.772154 ACOS(-0.100000) = 1.670964 ACOS(0.000000) = 1.570796 ACOS(0.100000) = 1.470629 ACOS(0.200000) = 1.369438 ACOS(0.300000) = 1.266104 ACOS(0.400000) = 1.159279 ACOS(0.500000) = 1.047197 ACOS(0.600000) = 0.927295 ACOS(0.700000) = 0.795399 ACOS(0.800000) = 0.643501 ACOS(0.900000) = 0.451026