Synopsis
double atan2(double y,
             double x);
Description

atan2 returns the value, in radians, of the inverse circular tangent of y divided by x using the signs of x and y to compute the quadrant of the return value. The principal value lies in the interval [−π, +π] radians. If x = y = 0, errno is set to EDOM and atan2 returns HUGE_VAL.

atan2(x, NaN) is NaN.
atan2(NaN, x) is NaN.
atan2(±0, +(anything but NaN)) is ±0.
atan2(±0, −(anything but NaN)) is ±π.
atan2(±(anything but 0 and NaN), 0) is ±½π.
atan2(±(anything but ∞ and NaN), +∞) is ±0.
atan2(±(anything but ∞ and NaN), −∞) is ±π.
atan2(±∞, +∞) is ±¼π.
atan2(±∞, −∞) is ±¾π.
atan2(±∞, (anything but 0, NaN, and ∞)) is ±½π.