# atan2 C Library Function

The function double atan2(double y, double x); returns the arc tangent of y/x, expressed in radians. Function atan2 takes into account the sign of both arguments in order to determine the quadrant.

## Function prototype of atan2

double atan2(double y, double x);
• y : A floating point value representing an Y-coordinate.
• x : A floating point value representing an X-coordinate.

## Return value of atan2

Function atan2 returns the principal arc tangent of y/x, in the interval [-Pi, +Pi] radians.

## C program using atan2 function

The following program shows the use of atan2 function to calculate inverse tangent of y/x.

```#include <stdio.h>
#include <math.h>

#define PI 3.14159

int main(){
double Y, X, radian, degree;
printf("Enter value of Y and X\n");
scanf("%lf %lf", &Y, &X);

radian = atan2(Y, X);
/*
*  Radian to degree conversion
*  One radian is equal to 180/PI degrees.
*/
degree = radian * (180.0/PI);

printf("The arc tan2 of %0.4lf and %0.4lf is %0.4lf radian\n",
```Enter value of Y and X