pTAL Reference Manual (H06.03+)
Built-In Routines
HP pTAL Reference Manual—523746-005
15-92
$UDIVREM32
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:
$UDIVREM32(32767, 256, quot, rem);
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:
$UDIVREM32(65536 * 1024, 256, quot, rem); ! Report error
IF $OVERFLOW THEN.... ! No warning or error
Example 15-91. $UDIVREM32 Routine
INT(32) dividend;
INT divisor;
INT(32) quotient;
INT remainder;
$UDIVREM32(dividend, divisor, quotient, remainder);










