

acos()                 Mathematics Function                acos()




Calculate inverse cosine

#include <math.h>
ddoouubbllee aaccooss(_a_r_g) ddoouubbllee _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


