The ATAN function returns the angle, expressed in radians, whose tangent is X (i.e., the arc-tangent). If two parameters are supplied, the angle whose tangent is equal to Y/X is returned. The range of ATAN is between - p /2 and p /2 for the single argument case, and between - p and p if two arguments are given.

Calling Sequence

Result = ATAN( X )


Result = ATAN( Y, X )



The tangent of the desired angle.


An optional argument. If this argument is supplied, ATAN returns the angle whose tangent is equal to Y/X . If both arguments are zero, the result is undefined.


To find the arc-tangent of 0.707 and store the result in the variable B, enter:

B = ATAN(0.707)

The following code defines a function that converts Cartesian coordinates to polar coordinates. It returns "r" and "theta" given an "x" and "y" position:

FUNCTION TO_POLAR, X, Y ; Define function TO_POLAR that accepts X and Y as arguments.

RETURN, [SQRT(X^2 + Y^2), ATAN(Y, X)]
; Return the distance and angle as a two-element array.

END ; End of function.

See Also