acos
Arc cosine function
Interface
#include <math.h>
double | acos (double x) |
long double | acosl (long double x) |
float | acosf (float x) |
#include <complex.h>
complex | acos (complex x) |
double complex | cacos (double complex x) |
float complex | cacosf (float complex x) |
long double complex | cacosl (long double complex x) |
Description
The acos function computes the principal value of the arc cosine of x in the rangeExample:
Example - Arc cosine function
Problem
This is an example of finding arc cosine of x
Workings
#include <stdio.h> #include <math.h> int main() { double x = 0.5; double result = acos(x); printf("The arc cosine of %lf is %lf\n", x, result); return 0; }
Solution
Output:
The arc cosine of 0.500000 is 1.047198
Special Values
acos ( 1 ) returns +0.acos ( x ) returns a NaN and raises the invalid floating-point exception for |x| > 1.
Compatibility
DOS | UNIX | Windows | ANSI C | C++ only | |
---|---|---|---|---|---|
acosl | • | • | |||
Real acos | • | • | • | • | |
Complex acos | • | • | • | ||
Complex cacos | • | • |
Last Modified: 22 Feb 12 @ 22:43 Page Rendered: 2022-03-14 16:03:24