#include <math.h> double acos(double x);
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].
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.
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.
#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); }
asin
, atan
, _matherr
Copyright (c) 1998 SAS Institute Inc. Cary, NC, USA. All rights reserved.