Re: Assembly Language - Mathematics WITHOUT maths coprocessor



On Sat, 08 Oct 2005 17:15:15 GMT, "Richard Cooper"
<spamandviruses@xxxxxx> wrote:

>On Sat, 08 Oct 2005 13:05:21 -0400, ¬a\/b <al@xxx> wrote:
>
>> if the case adjust the result of partial computation (doing -1)
>
>How do you do that?

i say only where the book algo do it: in point 3.2 and in 3.4
for reference see the book; it is in internet

14.20 Algorithm Multiple-precision division
INPUT: positive integers x = (xn, ... x1,x0)b, y = (yt,... y1,y0)b
with n >= t >= 1, yt != 0.
OUTPUT: the quotient q = (qn-t, ... q1,q0)b and remainder r = (rt,...
r1r0)b such that
x = qy + r, 0 <= r < y.
1. For j from 0 to (n - t) do: qj 0.
2. While (x  ybn-t) do the following: qn-t qn-t + 1, x x - ybn-t.
3. For i from n down to (t + 1) do the following:

3.1 If xi = yt then set qi-t-1 b - 1; otherwise set qi-t-1 b(xib +
xi-1)=yt)c.


#######################
3.2 While (q[i-t-1](y_tb +y_t-1) > x_ib^2 +x_i-1b + x_i-2)
do: q[i-t-1]= q[i-t-1] -1.
#######################

3.3 x = x - q[i-t-1]yb^(i-t-1).


#######################
3.4 If x < 0 then set x=x + yb^(i-t-1) and q[i-t-1]= q[i-t-1] - 1.
#######################
4. r x.
5. Return(q,r).
.