Q(uick)BASIC Function: TAN

Quick View

TAN Function

A math function that returns the tangent of an angle expressed in radians

Worth knowing

Useful and cross-version information about the programming environments of QBasic and QuickBasic.

Syntax
  • ATN(numeric-expression)
  • COS(angle)
  • SIN(angle)
  • TAN(angle)
Description/Parameter(s)
numeric-expression The ratio between the sides of a right triangle.
angle An angle expressed in radians.

The ATN function returns an angle in radians.

To convert from degrees to radians, multiply degrees by (PI / 180).

Example
CONST PI=3.141592654 PRINT ATN(TAN(PI/4.0)), PI/4.0 'Output is: .7853981635 .7853981635 PRINT (COS(180 * (PI / 180))) 'Output is: -1 PRINT (SIN(90 * (PI / 180))) 'Output is: 1 PRINT (TAN(45 * (PI / 180))) 'Output is: 1.000000000205103