pTAL Reference Manual (H06.03+)

Built-In Routines
HP pTAL Reference Manual523746-005
15-91
$UDIVREM32
If both dividend and divisor have constant values whose unsigned quotient is
greater than 16 bits, the compiler reports overflow:
INT quot, rem;
$UDIVREM16(65536 * 1024, 256, quot, rem); ! Report error
If both dividend and divisor are constants, and you test $OVERFLOW
following the call to $UDIVREM16, the compiler reports a warning that overflow
cannot occur:
$UDIVREM16(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:
$UDIVREM16(65536 * 1024, 256, quot, rem); ! Report error
IF $OVERFLOW THEN.... ! No warning or error
$UDIVREM32
$UDIVREM32 divides an INT(32) dividend by an INT divisor to produce an INT(32)
quotient and INT remainder.
dividend input
INT(32):value
Example 15-90. $UDIVREM16 Routine
INT(32) dividend;
INT divisor;
INT quotient;
INT remainder;
$UDIVREM16(dividend, divisor, quotient, remainder);
pTAL privileged procedure No
Can be executed only by privileged procedures No
Sets condition code No
Sets $CARRY No
Sets $OVERFLOW Yes, if and only if the divisor is 0
$UDIVREM32 (
,
,
) ;
VST654.vsd
,
dividend
divisor
quotient
remainder