double atan2(double y, double x);
Returns the arc tangent (arctangent) of y / x. The returned value is in radian and in a range of -π to π.
atan2 returns a NaN and sets macro EDOM to global variable errno if both x and y are 0.0.
atan2 returns a NaN and sets macro EDOM to global variable errno if both x and y are +∞.
If the solution vanished approaching zero, atan2 returns +0 and sets macro ERANGE to global variable errno. If the solution is a denormal number, atan2 sets macro ERANGE to global variable errno.
This function calculates the arc tangent of y / x. atan2 calculates the correct result even if the angle is in the vicinity of π / 2 or - π / 2 (if x is close to 0).