
BASIC PROGRAMMING GUIDE
2-3
ATN
Syntax: ATN(
expr
)
Where:
expr
= value between 0 and PI/2
Function: Returns a trigonometric arc-tangent of
expr
. Returned result is between -PI/2 and PI/2 radians.
Mode: Command, run
Use: PRINT 4*ATN(1)
DESCRIPTION
SIN, COS, and TAN operators use a Taylor series to calculate the function. These operators first reduce the
argument to a value that is between 0 and PI/2. The algorithm used to reduce the value will reduce accuracy
when
expr
is large. To maintain accuracy, keep the arguments for trig functions as small as possible.
ERRORS
ARITH. UNDERFLOW
expr
or result is less than BASIC-52's smallest floating-point value of ±1E-127
ARITH. OVERFLOW
expr
or result is greater than BASIC-52's largest floating-point value of
±.9999999E+127
DIVIDE BY ZERO Attempt to take TAN(X) when COS(PI/2) = 0
EXAMPLES
100 PRINT SIN(PI/2),COS(10001*PI),TAN(5*PI/4)
110 PRINT ATN(TAN(PI/4))/PI
>run
1 -1 1
.24999996
Commentaires sur ces manuels