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

RPBASIC-52 PROGRAMMING GUIDE
2-108
SQR
Syntax:
S Q R (expr)
Where: expr is any valid mathematical expression, number, or variable greater than 0
Function:
Retu rns a po sitive s quare root.
Mode:
Comm and, run
Use:
P R I N T SQ R ( A )
Cards:
All
D E S C R IP T I ON
expr must be positive. Any calculation is accurate to ±5 least significant digits.
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
±.99999999E+127
B A D A R G U M E N T
Attempt to take SQR() of a negative number
EXAMPLE
100
FOR N = 1 to 10
110 A=SQR(N)**2
120 IF (A-N)<>0 THEN PRINT A,N
130 NEXT
>run
2.0000001 2
2.9999999 3
5.0000001 5
6.0000002 6
6.9999999 7
7.9999998 8