Skip to main content
Previous sectionNext section

Atn

Returns the arctangent of a number.

Synopsis

Atn(number)

Arguments

The number argument can be any valid numeric expression.

Description

The Atn function takes the ratio of two sides of a right triangle (number) and returns the corresponding angle in radians. The ratio is the length of the side opposite the angle divided by the length of the side adjacent to the angle. 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
Println "Arctangent of ",x," is: ",Atn(x)
Next
Copy code to clipboard

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

Dim pi
pi = 4 * Atn(1)   ' Calculate the value of pi.
Println "pi is: ",pi
Copy code to clipboard

Notes

Arctangent (Atn) 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