acos, acosl
raw OCR
Calculates the arc cosine.
Defined in header <math.h>
Syntax
Real versions: Complex version:
#include <math.h> #include <complex.h>
double acos(double x); complex acos(complex x);
long double acosKlong double x);
Portability
| DOS | UNIX | Windows | ANSI C | C++ only | |
|---|---|---|---|---|---|
| acosi | ■ | ■ | |||
| Real acos | ■ | ■ | ■ | ■ | |
| Complex acos | ■ | ■ | ■ |
Remarks
acos returns the arc cosine of the input value, acosi is the long double version; it takes a long double argument and returns a long double result. Real arguments to acos and acosi must be in the range -1 to 1, or else acos and acosi return NAN and set the global variable errno to
EDOM Domain error
The complex inverse cosine is defined by
acos(z) = -/ log(z + i sqrtd - z^))
Return value
acos and acosi of a real argument between -1 and +1 returns a value in the range 0 to pi.
Error handling for these routines can be modified through the functions matiierr and _matlierri.
See also
Example
#include <stdio.h>
#include <inath.h>
int main(void)
{
double result, x .5;
result = acos(x);
printfC'The arc cosine of %lf is %lf\n", x, result)
return 0;
Differences from modern implementations
Nothing recorded yet.
Modern references
These are search links, not yet checked by hand.
Extraction notes
- heading `acos, acosi` read as `acos, acosl`
Stable link: /3.1/math.h/acos/
· short form /3.1/acos/