Everything

atan2f


Calculates the arc tangent of the division of two floating-point numbers.

[Format]

#include <mathf.h>

float atan2f (float y, float x);

[Parameters]

x Divisor

y Dividend

[Return values]

Normal: Arc tangent value when y is divided by x

Abnormal: Domain error: Returns not-a-number.

Error conditions: A domain error occurs if the values of both x and y are 0.0.

[Remarks]

A domain error occurs if the values of both x and y are 0.0.

The atan2f function returns the arc tangent in the range (–π, +π) by the radian. The meaning of the atan2f function is illustrated in Figure 7.2. As shown in the figure, the result of the atan2f 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.

Figure 7.2

Meaning of atan2f Function