Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

atan2, atan2f, atan2l - arc tangent of x/y

&pagelevel(4)&pagelevel


Description atan2() computes the arc tangent of x/y, using the signs of both arguments to determine

Syntax

#include <math.h>

double atan2(double x, double y);
C11
float atan2f(float x, float y);
long double atan2l(long double x, long double y);  (End)

Description

These functions compute the arc tangent of x/y, using the signs of both arguments to determine the quadrant of the return value.

x is the dividend of the expression for which the arc tangent is to the calculated.

y is the divisor of the expression for which the arc tangent is to the calculated.

Return val.

arc tangent(x/y)


if neither argument is 0.0.
A floating-point number of type double in the range [-pi/2, +pi/2] is returned.

-pi/2 or +pi/2

if the divisor is 0.0, depending on the sign of the dividend.

0

π/2

if the dividend is 0.0.

if both arguments are 0.0. errno is set to indicate the error.

Errors

atan2(), atan2f() and atan2l() will fail if:

EDOM        Both arguments are 0.0.

See also

acos(), asin(), atan(), cos(), sin(), tan(), math.h.