acos -- Compute the Trigonometric Arc Cosine

SYNOPSIS

 #include <math.h>

 double acos(double x);
 

DESCRIPTION

acos computes the trigonometric arc cosine of the argument x. The arc cosine function is the inverse of the trigonometric cosine function and is expressed by the following relation:
 r = arccos (x)
 
x is in the closed interval [ - 1.0,1.0].

RETURN VALUE

acos returns the principal value of the arc cosine of the argument x, provided that this value is defined and computable. The return value is a double precision floating-point number in the closed interval [0, pi ] radians.

DIAGNOSTICS

An error message is written to the standard error file (stderr) by the run-time library if x is not in the domain [ - 1.0,1.0]. In this case, the function returns 0.0.

If an error occurs in acos, the _matherr routine is called. You can supply your own version of _matherr to suppress the diagnostic message or modify the value returned.

EXAMPLE

This example computes the value of pi:
  #include <math.h>
  #include <stdio.h>

  main()
  {
     double pi;

     /* pi is equal to the arc cosine of .5 times 3. */
     pi = 3 * acos(.5);

     printf("3 * acos(%f) = %fn", .5, pi);
  }

 

RELATED FUNCTIONS

asin, atan, _matherr

SEE ALSO

Mathematical Functions

Copyright (c) 1998 SAS Institute Inc. Cary, NC, USA. All rights reserved.