atan2f


Arc tangent (y / x)

[Classification]

Mathematical library

[Syntax]

#include <mathf.h>

float atan2f(float y, float x);

[Return value]

Returns the arc tangent (arctangent) of y / x. The returned value is in radian and in a range of -π to π.

atan2f returns a NaN and sets macro EDOM to global variable errno if both x and y are 0.0. If the solution vanished approaching zero, atan2f returns +0 and sets macro ERANGE to global variable errno. If the solution is a denormal number, atan2f sets macro ERANGE to global variable errno.

[Description]

This function calculates the arc tangent of y / x. atan2f calculates the correct result even if the angle is in the vicinity of π / 2 or - π / 2 (if x is close to 0).