aaccooss() -- Mathematics Function (libm)

Calculate inverse cosine
#iinncclluuddee <mmaatthh.h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;

aaccooss() calculates the inverse cosine.  _a_r_g  should be in the range of -1.0,
1.0.   It returns the  result, which  is in  the range of  from zero  to pi
radians.

_E_x_a_m_p_l_e
This  example demonstrates  the mathematics  functions aaccooss(),  ccaabbss(), and
ttaann().

#include <errno.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.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;

        x = atof(string);
        display(x);
        display(acos(cos(x)));
        display(cabs(sin(x),cos(x)));
    }
}

_S_e_e _A_l_s_o
ccooss(), eerrrrnnoo, eerrrrnnoo.hh, lliibbmm, ppeerrrroorr()
ANSI Standard, section 7.5.2.1
POSIX Standard, section 8.1
