How to compute arc tangent in C

3 Answers

0 votes
#include <stdio.h>
#include <math.h>

int main(void)
{
    double d = atan(1);

    printf("%lf", d);
}




/*
run:

0.785398

*/

 



answered Jan 26, 2023 by avibootz
0 votes
#include <stdio.h>
#include <math.h>

int main(void)
{
    float f = atanf(0.5);

    printf("%f", f);
}



/*
run:

0.463648

*/

 



answered Jan 26, 2023 by avibootz
0 votes
#include <stdio.h>
#include <math.h>

int main(void)
{
    long double ld = atan(-1.0);

    printf("%Lf", ld);
}



/*
run:

-0.785398

*/

 



answered Jan 26, 2023 by avibootz
...