beautypg.com

Basic programming guide – Remote Processing BASIC for the CX-10 Modbus User Manual

Page 75

background image

BASIC PROGRAMMING GUIDE

2-66

SQR

Syntax:

SQR(expr)
Where: expr is any valid mathematical expression, number, or variable greater than 0

Function:

Returns a positive square root.

Mode:

Command, run

Use:

PRINT SQR(A)

DESCRIPTION

expr must be positive. Any calculation is accurate to ±5 least significant digits.

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
±.99999999E+127

BAD ARGUMENT

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