Retro Rocket OS
BASIC-Powered Operating System
Loading...
Searching...
No Matches
TAN Function
TAN(real-expression)

Returns the tangent of the given angle, where the angle is expressed in radians.


Examples

PRINT TAN(0)

Produces 0.

PRINT TAN(PI# / 4)

Produces approximately 1.

REM Compute slope of a line from angle
angle# = RAD(30)
PRINT "Slope = "; TAN(angle#)

Notes

  • Argument must be in radians. Convert from degrees with:

    radians# = degrees * PI# / 180
  • The tangent function has asymptotes where cosine is zero, i.e. at odd multiples of PI#/2. Calling TAN at these points will produce very large values or errors due to division by zero.
  • Return value is a real number, unbounded in range.
  • Inverse function: ATAN.

See also: SIN · COS · ATAN · ATAN2