Overflow and division by zero – Rockwell Automation 1746-BAS BASIC LANGUAGE User Manual
Page 27

Publication 1746-RM001A-US-P
Expressions and Operators 3-5
Overflow and Division by Zero
During the evaluation of an expression if an overflow, underflow, or division by
zero error occurs, the module generates error messages and reverts to Command
mode. Refer to the ONERR operation in chapter 8 for more information on how
to trap these errors.
The largest result allowed from any calculation is 0.99999999 E+127. If this
number is exceeded, the 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 this
number is exceeded, the module generates the
ERROR: ARITH. UNDERFLOW
message and returns to Command mode.
If an attempt is made to divide any number by zero, the module generates the
ERROR: DIVIDE BY ZERO
message and returns to Command mode.
>10 PRINT 9/0
>20 PRINT “PROGRAM SHOULD NOT GET HERE.”
READY
>RUN
ERROR: DIVIDE BY ZERO - IN LINE 10
10
PRINT 9/0
-----------------X
READY
>
>10 PRINT 9.9E126*(2)
>
READY
>RUN
ERROR: ARITH. OVERFLOW - IN LINE 10
10
PRINT 9.9E126*(2)
-------------------------X
READY
>