|
|
coherent
acos() Mathematics Function acos()
Calculate inverse cosine
#include <math.h>
ddoouubbllee aaccooss(_a_r_g) ddoouubbllee _a_r_g;
acos calculates the inverse cosine. 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.
***** Example *****
This example demonstrates the mathematics functions acos, asin,
atan, atan2, cabs, cos, hypot, sin, and tan.
#include <math.h>
#define display(x) dodisplay((double)(x), #x)
dodisplay(value, name)
double value; char *name;
{
if (errno)
perror(name);
else
printf("%10g %s\n", value, name);
errno = 0;
}
main()
{
extern char *gets();
double x;
char string[64];
for(;;) {
printf("Enter number: ");
if(gets(string) == NULL)
break;
COHERENT Lexicon Page 1
acos() Mathematics Function acos()
x = atof(string);
display(x);
display(cos(x));
display(sin(x));
display(tan(x));
display(acos(cos(x)));
display(asin(sin(x)));
display(atan(tan(x)));
display(atan2(sin(x),cos(x)));
display(hypot(sin(x),cos(x)));
display(cabs(sin(x),cos(x)));
}
}
***** See Also *****
errno, errno.h, mathematics library, perror()
COHERENT Lexicon Page 2
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.