You are here : cpp0atan2

atan2() - 0

The C library function double atan2(doubly y, double x) returns the arc tangent in radians of y/x based on the signs of both values to determine the correct quadrant.


Syntax

double atan2(double y, double x)


Example

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

#define PI 3.14159265

int main ()
{
   double x, y, ret, val;

   x = -7.0;
   y = 7.0;
   val = 180.0 / PI;

   ret = atan2 (y,x) * val;
   printf("The arc tangent of x = %lf, y = %lf ", x, y);
   printf("is %lf degrees\n", ret);
  
   return(0);
}


Output / Return Value

The arc tangent of x = -7.000000, y = 7.000000 is 135.000000 degrees


Limitations


Alternatives / See Also


Reference