Let *X* be an integer and *Y* a natural number with *Y* > 0. Define *Q* and *R* respectively as the *quotient* and the *remainder* of the division of *X* by *Y*, with an accuracy of *p* fractional base-*B* digits:

where *Q* and *R* are integers, − *Y* ≤ *R* < *Y* and *sign*(*R*) = *sign*(*X*). In other words,

so that the unit in the least significant position (*ulp*) of *Q.B ^{−p}* and

*Q* and *R* are the *quotient* and the *remainder* of the *integer division* of *X* by *Y*.

The basic algorithm applies to operands *X* and *Y* such that

In the general case, to ensure that −*Y* ≤ *X* < *Y*, a previous alignment step is necessary. Assume that *X* is an *m*-digit reduced *B'*s complement number, that is, −*B*^{m−1} ≤ *X* < *B*^{m−1}; then

substitute *Y* by *Y′* = *B*^{m−1}.*Y*, so that *Y′* ≥ *B*^{m−1}.1 > *X* and − *Y′* ≤ − *B*^{m−1}.1 ≤ *X*; compute the quotient *Q* and the remainder *R′* of the division of *X* by *Y′*, with an accuracy of *p* + *m* − 1 fractional base-*B* digits, that is,

that is,

*Comment 6.2 ...*

Start Free Trial

No credit card required