<< Previous | Next >>

atan2

float atan2( float y, float x );

Description

Computes the arctangent of real float value y/x to find the angle in radians between the x-axis and the ray through (0,0) and (x,y).

NOTE The Dynamic C functions deg and rad convert radians and degrees.

Parameters

y
The point corresponding to the y-axis

x
The point corresponding to the x-axis

Return value

If both y and x are zero, the function returns 0 and signals a domain error. Otherwise the arctangent of y/x is returned as follows:

Returned Value (in Radians)

Parameter Values

angle

x 0, y 0

PI/2

x = 0, y > 0

-PI/2

x = 0, y <

0

x > 0, y = 0

PI

x < 0, y = 0

Library

MATH.LIB

See also

acos, asin, atan, cos, sin, tan


Dynamic C Functions << Previous | Next >> rabbit.com