### acos -- Calculate Arccosine

Format

>     #include <math.h>
>     double acos(double x);

Language Level: ANSI, POSIX, XPG4
acos calculates the arccosine of x, expressed in radians, in the range 0 to PI.

Return Value
acos returns the arccosine of x. The value of x must be between -1 and 1 inclusive. If x is less than -1 or greater than 1, acos sets errno to EDOM and returns 0.

Example
This example prompts for a value for x. It prints an error message if x is greater than 1 or less than -1; otherwise, it assigns the arccosine of x to y.

    #include <stdlib.h>
    #include <math.h>

    #define MAX  1.0
    #define MIN -1.0

    int main(void)
    {
      double x, y;

      printf( "Enter x\n" );
      scanf( "%lf", &x );

      /* Output error if not in range */
      if ( x > MAX )
        printf( "Error: %lf too large for acos\n", x );
      else
        if ( x < MIN )
           printf("Error: %If too small for acos\n",x);
        else {
           y = acos(x);
           printf("acos(%If) = %If\n", x, y);
        }
      return 0;

      /************************************************
         For the following input: 0.4
         The output should be:

         Enter x
         acos(0.400000) = 1.159279
      ************************************************/
    }

asin -- Calculate Arcsine
atan - atan2 -- Calculate Arctangent
cos -- Calculate Cosine
cosh -- Calculate Hyperbolic Cosine
_facos -- Calculate Arccosine
_fcos -- Calculate Cosine
_fcossin -- Calculate Cosine and Sine
_fsincos -- Calculate Sine and Cosine
sin -- Calculate Sine
sinh -- Calculate Hyperbolic Sine
tan -- Calculate Tangent
tanh -- Calculate Hyperbolic Tangent
<math.h>