beautypg.com

Rpbasic-52 programming guide – Remote Processing BASIC 52 User Manual

Page 23

background image

RPBASIC-52 PROGRAMMING GUIDE

2-4

ATN

Syntax:

A T N (expr)
Where: expr = value betw een 0 and P I/2

Function:

Returns a trigon ometric arc-ta ngent of expr. Returned result is between -PI/2 and PI/2 radians.

Mode:

Comm and, run

Use:

PRINT 4*AT N(1)

Cards:

All

D E S C R IP T I ON

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

A R I T H . U N D E R F L O W

expr or result is less than RPBASIC-52's smallest floating-point value of ±1E-127

A R I T H . O V E R F L O W

expr or result is greater than RPBASIC-52's largest floating-point value of
±.9999999E+127

D I V I DE B Y Z E R O

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