Skip to main content

This is documentation for Caché & Ensemble.

For information on converting to InterSystems IRIS, see the InterSystems IRIS Adoption Guide and the InterSystems IRIS In-Place Conversion Guide, both available on the WRC Distributions page (login required).

Previous sectionNext section

ATAN

Returns the arctangent of a number.

Synopsis

ATAN(number)

Arguments

number An expression that resolves to a number or a numeric string.

Description

The ATAN function takes the ratio of two sides of a right triangle (number) and returns the corresponding angle. The ratio is the length of the side opposite the angle divided by the length of the side adjacent to the angle.

By default, Caché MVBasic trig functions return results in degrees. To return results in radians, set $OPTIONS RADIANS. The range of the result is -pi/2 to pi/2 radians.

To convert degrees to radians, multiply degrees by pi/180. To convert radians to degrees, multiply radians by 180/pi.

Examples

The following example returns the arctangents of the integers from -4 through 4:

FOR x = -4 TO 4
PRINT "Arctangent of ":x:" is ":ATAN(x)
NEXT
Copy code to clipboard

The following example uses ATAN to calculate the value of pi:

PRINT ATAN(1)*4;   ! Calculate the value of pi.
Copy code to clipboard

Notes

Arctangent (ATAN) is the inverse trigonometric function of tangent (TAN), which takes an angle as its argument and returns the ratio of two sides of a right triangle. Do not confuse the arctangent with the cotangent; a cotangent is the simple inverse of a tangent (1/tangent).

See Also