.TH acos() "" "" "Mathematics Function (libm)"
.PC "Calculate inverse cosine"
.B "#include <math.h>"
\fBdouble acos(\fIarg\^\fB) double \fIarg\^\fB;\fR
.PP
.B acos()
calculates the inverse cosine.
.I arg
should be in the range of \-1.0, 1.0.
It returns
the result, which is in the range of from zero to \(*p radians.
.SH Example
This example demonstrates the mathematics functions
.BR acos() ,
.BR cabs() ,
and
.BR tan() .
.DM
#include <errno.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#define display(x) dodisplay((double)(x), #x)
.DE
.DM
dodisplay(value, name)
double value; char *name;
.DE
.DM
{
	if (errno)
		perror(name);
	else
		printf("%10g %s\en", value, name);
	errno = 0;
}
.DE
.DM
main()
{
	extern char *gets();
	double x;
	char string[64];
.DE
.DM
	for(;;) {
		printf("Enter number: ");
		if(gets(string) == NULL)
			break;
.DE
.DM
		x = atof(string);
		display(x);
		display(acos(cos(x)));
		display(cabs(sin(x),cos(x)));
	}
}
.DE
.SH "See Also"
.Xr cos(), cos
.Xr errno, errno
.Xr errno.h, errno.h
.Xr libm, libm
.Xr perror() perror
.br
\*(AS, \(sc7.5.2.1
.br
\*(PX Standard, \(sc8.1
