TAL Reference Manual
Standard Functions
TAL Reference Manual—526371-001
14-35
$OVERFLOW Function
PROC p2 (p, q) EXTENSIBLE;
INT .p;
INT .q;
BEGIN
!Lots of code
CALL p1 ($OPTIONAL ($PARAM (p), p ),
$OPTIONAL ($PARAM (q), q ));
!Lots of code
END;
$OVERFLOW Function
The $OVERFLOW function checks the state of the overflow indicator and indicates
whether an overflow occurred.
Usage Considerations
The overflow indicator is bit 8 in the environment register (ENV.V). The overflow
indicator is affected as follows:
For example, the following operations turn on the overflow indicator (and interrupt the
system overflow trap handler if the overflow trap is armed through ENV.T):
•
Division by 0
•
Floating-point arithmetic result in which the exponent is too large or too small
•
Signed arithmetic result that exceeds the number of bits allowed by the data type
of the expression
To recover locally from a statement’s overflow, turn off the overflow trap bit and use
$OVERFLOW in an IF statement immediately following the operation that affects the
overflow indicator. If the overflow indicator is on, $OVERFLOW is –1 (true). If the
overflow indicator is off, $OVERFLOW is 0 (false).
Operation Overflow Indicator
Unsigned INT addition, subtraction, and negation Preserved
Addition, subtraction, and negation except
unsigned INT
On or Off
Division and multiplication On or Off
Type conversions On, off, or preserved
Array indexing and extended structure
addressing
Undefined
Assignment or shift operation Preserved
$OVERFLOW
VST1436.vsd