LDIV(III) − PWB/UNIX 5/7/73
NAME
ldiv, lrem − long division
SYNOPSIS
ldiv(hidividend, lodividend, divisor) lrem(hidividend, lodividend, divisor)
DESCRIPTION
The concatenation of the signed 16-bit hidividend and the unsigned 16-bit lodividend is divided by divisor. The 16-bit signed quotient is returned by ldiv and the 16-bit signed remainder is returned by lrem. Divide check and erroneous results will occur unless the magnitude of the divisor is greater than that of the high-order dividend. An integer division of an unsigned dividend by a signed divisor may be accomplished by quo = ldiv(0, dividend, divisor); and similarly for the remainder operation. Often both the quotient and the remainder are wanted. Therefore ldiv leaves a remainder in the external cell ldivr.
BUGS
No divide check check.