1.

Solve : radix 2 srt division?

Answer»

hello
Does somebody knows about RADIX 2 SRT division ?
I cant understand all of it !

z : dividend
d : divisor
Q : quotient
s : remainder

this is the algorithm(pseudo CODE) :

z = s(0)
for j=1 to k
if 2s(j-1) > 1/2 then
q(j) = 1;
s(j) = 2s(j-1) -d ;
els if s(j-1) <-1/2 then
q(j) = -1;
s(j) = 2s(j-1) +d ;
else
q(j) = 0;
s(j) = 2s(j-1);
end if ;
end for;


and this is an example :


z0.01000101
d0.1010
-d1.0110
=============================
s(0)0.01000101
2s(0)0.1000101>1/2 so q(-1)=1
+(-d)
=============================
s(1)1.1110101
2s(1)1.110101in [-1/2,1/2) so q(-2)=0
=============================
s(2)1.110101
2s(2)1.10101<-1/2 so q(-3)=-1
+d0.1010

=============================
s(3)0.01001
2s(3)0.1001>1/2 so q(-4)=1
+(-d)1.0110
=============================
s(4) 1.1111negative so add to correct
2s(4)0.1010
=============================
s(4)0.1001
s0.0000 1001
q0.10(-1)1uncorrect BSD quotient
q0.0110convert and subtract ulp

i think this is not true : (line 13)
s(2)1.110101
2s(2)1.10101<-1/2 so q(-3)=-1
+d0.1010

and what is "ulp" and how convert 0.1.(-1)1 to 0.0110 ?

THNX



Discussion

No Comment Found