Calculates the arc tangent of the division of two floating-point numbers.
double atan2 (double y, double x);
float atan2f (float y, float x);
long double atan2l (long double y, long double x);
Normal: Arc tangent value when y is divided by x
Abnormal: Domain error: Returns not-a-number.
A domain error occurs if the values of both x and y are 0.0.
The atan2 function returns the arc tangent in the range (–π, +π) by the radian. The meaning of the atan2 function is illustrated in Figure 7.1. As shown in the figure, the result of the atan2 function is the angle between the X-axis and a straight line passing through the origin and point (x, y).
If y = 0.0 and x is negative, the result is π. If x = 0.0, the result is ±π/2, depending on whether y is positive or negative. However, a divide-by-zero exception might occur depending on the microcomputer settings.