Atan2 / Atan2l Function >> Math.h >> Header Files in C
Atan2 :
- Interpret it as - A tan 2
- ‘2’ Means It Takes Two Parameters
- The atan2() function computes the arc tangent of Y/X
- Signs of the arguments is used to compute the quadrant of the return value .
- Header File : Math.h
Syntax :
double atan2(double y,double x);
- Return Value : Double [ Arc Tangent of Ratio Y/X ]
- No Of Parameters : 2
- Double X : Floating point value representing an X-Co-Ordinate
- Double Y : Floating point value representing an Y-Co-Ordinate
Live Example :
#include< stdio.h>
#include< math.h>
int main(void)
{
double res;
double x = 90.0, y = 45.0;
res = atan2(y, x);
printf("The arc tangent ratio of %lf is %lfn",(y/x),res);
return 0;
}Output :
The arc tangent ratio of 0.500000 is 0.463648How to Convert Number into Degree :
Using Following Statement -result = atan2(y,x)*180/M_PI;