/sys/doc/ Documentation archive



LDIV(III)                     5/7/73                    LDIV(III)



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  er-
     roneous results will occur unless the magnitude of the divi-
     sor is greater than that of the high-order dividend.

     An integer division of an unsigned dividend by a signed  di-
     visor 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.




























                              - 1 -