Next: , Previous: , Up: Math   [Contents][Index]


1.8 atan2, atan2f—arc tangent of y/x

Synopsis

#include <math.h>
double atan2(double y,double x);
float atan2f(float y,float x);

Description

atan2 computes the inverse tangent (arc tangent) of y/x. atan2 produces the correct result even for angles near pi/2 or -pi/2 (that is, when x is near 0).

atan2f is identical to atan2, save that it takes and returns float.


Returns
atan2 and atan2f return a value in radians, in the range of -pi to pi.


Portability
atan2 is ANSI C. atan2f is an extension.