Rockwell Automation 1771-DB BASIC MODULE User Manual

Page 116

Advertising
background image

Chapter
Expressions, Variables and Operators

9

9 -6

Negation ( – )

Use the negation operator to change an expression from positive to
negative.

>PRINT -(9+4)

Result: -13

Arithmetic Errors

During the evaluation of an expression if a number is too large (overflow)
or too small (underflow), or division by zero error occurs, the BASIC
module generates error messages and reverts to Command mode.

The largest result allowed from any calculation is 0.99999999 E

+127

.

If you exceed this number, the BASIC module generates the

ERROR:

ARITH. OVERFLOW

message and returns to Command mode.

The smallest result allowed from any calculation is 0.99999999 E

–128

.

If you exceed this number, the BASIC module generates the

ERROR:

ARITH. UNDERFLOW

message and returns to Command mode.

If you attempt to divide any number by zero, the BASIC module generates
the

ERROR: DIVIDE BY ZERO

message and returns to Command mode.

Refer to the ONERR statement (page 11 -23) for more information on how
to trap these errors.

Advertising