Home >>C Math Functions >C math atan() function
The C library function double atan(double x) is used to return the arc tangent of x in radians. It takes a single argument as a double and returns the value in radians. This function is defined in <math.h> header file.
Syntax:double atan(double x);
x − It is the floating point value.
Here is an example of atan() function:
#include <stdio.h>
#include <math.h>
#define PI 3.14159265
int main ()
{
double x, ret, val;
x = 0.75;
val = 180.0 / PI;
ret = atan(x) * val;
printf("The arc tangent of %lf is %lf degrees", x, ret);
return(0);
}
#include <stdio.h>
#include <math.h>
#define PI 3.14159265
int main ()
{
double x, ret, val;
x = 0.555;
val = 180.0 / PI;
ret = atan(x) * val;
printf("The arc tangent of %lf is %lf degrees", x, ret);
return(0);
}