ReadyBASIC
BASIC Language Reference Manual > Command and Function Reference >

TAN Function

Summary

Calculates the tangent of a given angle (in radians).

Syntax

TAN(angle in radians)

Remarks and Examples

The TAN function calculates the tangent of an angle, returning the result as a floating-point value.

The angle is assumed to be a value in radians.

To convert degrees to radians, use the formula x * pi / 180, where pi = 3.1415926.

Sample program:

10 INPUT "Enter adjacent length of right triangle: ", ADJACENT
20 INPUT "Enter angle in degrees: ", ANGLEDEGREES
30 PI = 3.1415926
40 ANGLERADIANS = ANGLEDEGREES * PI / 180
50 HYPOTENUSE = TAN(ANGLERADIANS) * ADJACENT
60 PRINT "The hypotenuse is ", HYPOTENUSE



Copyright 2006-2008, Kevin Matz, All Rights Reserved.