Home >>C Math Functions >C math atan() function

C math atan() function

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);

Parameters:-

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); 
}

Output:
The arc tangent of 0.750000 is 36.869898 degrees
Example-2

#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); 
}

Output:
The arc tangent of 0.555000 is 29.030275 degrees

No Sidebar ads