pTAL Reference Manual (H06.03+)

Built-In Routines
HP pTAL Reference Manual523746-005
15-90
$UDIVREM16
$UDIVREM16
$UDIVREM16 divides an INT(32) dividend by an INT divisor to produce an INT
quotient and INT remainder.
dividend input
INT(32):value
divisor input
sINT:value
quotient output
sINT: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:
$UDIVREM16(dividend, 2 / 2 - 1, quot, rem); ! Report error
Example 15-89. $UDBL Routine
INT a16 := -1;s
INT(32) a32;
a32 := $UDBL (a16); ! Return 65535D
pTAL privileged procedure No
Can be executed only by privileged procedures No
Sets condition code No
Sets $CARRY No
Sets $OVERFLOW Yes, if the divisor is 0 or the
quotient is too large
$UDIVREM16
(
,
,divisor
remainder ) ;
quotient
VST653.vsd
,
dividend