acosl Function

Calculates the trigonometric arc cosine function of a long double precision floating-point value.

Include

<math.h>

Prototype

long double acosl (long double x);

Argument

x
value between -1 and 1 for which to return the arc cosine

Return Value

Returns the arc cosine in radians in the range of 0 to pi (inclusive).

Remarks

A domain error occurs if x is less than -1 or greater than 1.

Example

#include <math.h>
#include <stdio.h>
#include <errno.h>

int main(void)
{
  long double x,y;

  errno = 0;
  x = -2.0;
  y = acosl(x);
  if (errno)
    perror("Error");
  printf("The arccosine of %Lf is %Lf\n", x, y);

  errno = 0;
  x = 0.10;
  y = acosl(x);
  if (errno)
    perror("Error");
  printf("The arccosine of %Lf is %Lf\n\n", x, y);
}

Example Output

Error: domain error
The arccosine of -2.000000 is nan
The arccosine of 0.100000 is 1.470629