Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

acos, acosf, acosl - Arc cosine

&pagelevel(4)&pagelevel

Definition  

#include <math.h>

double acos(double x);
float acosf(float x); (C11)
long double acosl(long double x); (C11)

These functions are the inverse function of the corresponding  cos-functions.
hey return the principal value (i.e. corresponding angle in radians) of the arc cosine of a floating-point number x  in the range [-1.0, +1.0].

Return val.

arc cosine(x)



a floating-point number of type double from [0, pi] for values x in the interval
[-1.0, +1.0].


0

for values outside the interval [-1.0, +1.0].
In addition, errno is set to EDOM (domain error, i.e. argument too large).

Example

The following program prints the corresponding arc cosine values for input values in the interval [0.0, 1.0]:

#include <math.h>
#include <stdio.h>
int main(void)
{
  double x;
  for(x = 0.0; x < 1.0; x = x + 0.1)
  printf("x = %g : acos(%g) = %g\n", x, x, acos(x));
  return 0;
}

See also

cos, sin, tan, asin, atan, atan2