### Synopsis

`#include <math.h>`

`double atan2(double y, double x);`
`float atan2f(float y, float x);`
`long double atan2l(long double y, long double x);`

### Description

The function computes the principal value of the arc tangent of y/x , using the signs of both arguments to determine the quadrant of the return value.

Arguments
y - first argument of `atan2` (the ordinate of the point)
x - second argument of `atan2` (the abscissa of the point)

### Return value

Upon successful completion, the functions returns the arc tangent of y/x in the range [-π, π] radians.

If y is `±0` and x is < `0`, ±π is returned.

If y is `±0` and x is > `0`, `±0` is returned.

If y is < `0` and x is `±0`, -π/2 is returned.

If y is > `0` and x is `±0`, π/2 is returned.

If x is `0`, a pole error does not occur.

If either x or y is `NaN`, a `NaN` is returned.

If the IEC 60559 Floating-Point option is supported, y/ x is returned.

If y is `±0` and x is `-0`, ±π is returned.

If y is `±0` and x is `+0`, `±0` is returned.

For finite values of ± y > `0`, if x is -`Inf`, ±π is returned.

For finite values of ± y > `0`, if x is +`Inf`, `±0` is returned.

For finite values of x, if y is ±Inf, ±π/2 is returned.

If y is ±`Inf` and x is -`Inf`, ±3π/4 is returned.

If y is ±`Inf` and x is +`Inf`, ±π/4 is returned.

If both arguments are `0`, the domain error does not occur.

### Errors

`[ERANGE]` The result underflows.

If the integer expression (`math_errhandling` & `MATH_ERRNO`) is non-zero, then `errno` is set to `[ERANGE]`. If the integer expression (`math_errhandling` & `MATH_ERREXCEPT`) is non-zero, then the underflow floating-point exception is raised.

On error, the expressions (`math_errhandling` & `MATH_ERRNO`) and (`math_errhandling` & `MATH_ERREXCEPT`) are independent of each other, but at least one of them is non-zero.