atan2


Arc tangent (y / x)

[Classification]

Mathematical library

[Syntax]

#include <math.h>

double atan2(double y, double 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 Not a Nuber(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).