pTAL Reference Manual (G06.24+, H06.09+, J06.03+)

IF $OVERFLOW THEN ... ! Report warning
If the compiler reports an error because overflow occurs for constant dividend and constant divisor,
it does not report a warning if you test $OVERFLOW in the following IF statement:
$UDIVREM16(65536 * 1024, 256, quot, rem); ! Report error
IF $OVERFLOW THEN.... ! No warning or error
Example 311 $UDIVREM16 Routine
INT(32) dividend;
INT divisor;
INT quotient;
INT remainder;
$UDIVREM16(dividend, divisor, quotient, remainder);
$UDIVREM32
$UDIVREM32 divides an INT(32) dividend by an INT divisor to produce an INT(32) quotient and
INT remainder.
NopTAL privileged procedure
NoCan be executed only by privileged procedures
NoSets condition code
NoSets $CARRY
Yes, if and only if the divisor is 0Sets $OVERFLOW
dividend
input
INT(32):value
divisor
input
sINT:value
quotient
output
INT(32):variable
remainder
output
sINT:variable
The compiler checks the following conditions during compilation:
If the value of divisor is a constant value of zero, the compiler reports an error that division
by zero is not valid:
$UDIVREM32(dividend, 2 / 2 - 1, quot, rem); ! Report error
If both dividend and divisor are constants, and you test $OVERFLOW following the
call to $UDIVREM32, the compiler reports a warning that overflow cannot occur:
348 Built-In Routines