Booth Algorithm, Toom Cook, Restoring and Non Restoring, Karatsuba
Booth Algorithm, Toom Cook, Restoring and Non Restoring, Karatsuba
Ques 1.
Sol.1
x y
x y
..(1)
x y
(200 160 106 ) (591 891) {(200 591)(160 891) (200 160) (891 591)}103
x y
x y
x y
32273286581
Ans.
Ques 2.
Sol.2
Here, i max b , b 1
k
k
log P log Q
i max b , b 1 max b
,
1
k
k
k
k
4.15 4.35
i max
,
1 11 2
3 3
k 3 for TOOM 3
B b2 10000 .
Step2: Evaluation
Now evaluating P( x) and Q( x) as follows, for points at (0,1, 1, 2, )
P(0)
1115
Q(0)
0501
P(1)
2228
Q(1)
1011
P(1) 6
P(2) 1099
Q(1) 1
Q(2) 489
P ( ) 2
Q () 5
P(0)Q(0)
558615
r (1)
P(1)Q(1)
2252508
r (1)
r (2)
P(1)Q(1)
P(2)Q(2)
6
537411
r ( )
P()Q()
10
Step4: Interpolation
Using the given below matrix for interpolation we get,
0
0
0
0 r (0)
r0 1
r 1/ 2 1/ 3 1 1/ 6 2 r (1)
r1 1 1/ 2 1/ 2
0
1 r (1)
r2 1/ 2 1/ 6 1/ 2 1/ 6 2 r (2)
r 0
0
0
0
1 r ()
r0
558615
r1
r1
r2
934016
567632
6547
10
Ans.
Ques 3.
Sol.
Q -1
Operation
Cycle
00000000
01100010
10110110
Initial values
First`
00000000
00110001
10110110
Shift
01001010
00110001
10110110
A A-M
00100101
00011000
10110110
Shift
11011011
00011000
10110110
A A+M
11101101
10001100
10110110
Shift
11110110
11000110
10110110
Shift
Fourth
11111011
01100011
10110110
Shift
Fifth
01000101
01100011
10110110
A A-M
Sixth
00100010
10110001
10110110
Shift
00010001
01011000
10110110
Shift
Seventh
11000111
01011000
10110110
A A+M
Eighth
11100011
10101100
10110110
Shift
Second
Third
Ans.
Sol.
Q-1
Operation
Cycle
00000000
10111100
10110101
Initial values
First
00000000
01011110
10110101
Shift
00000000
00101111
10110101
Shift
Second
01001011
00101111
10110101
A A-M
Third
00100101
10010111
10110101
Shift
00010010
11001011
10110101
Shift
Fourth
00001001
01100101
10110101
Shift
Fifth
00000100
10110010
10110101
Shift
Sixth
10111001
10110010
10110101
A A-M
Seventh
11011100
11011001
10110101
Shift
00100111
11011001
10110101
A A-M
00010011
11101100
10110101
Shift
Eighth
Ans.
Ques 4.
Sol.
Operation
000000
10001000
Initial Values
000001
0001000_
-100010
0001000_
Subtract B
-100001
00010000
000001
00010000
restore
000010
0010000_
Shift
-100010
0010000_
Subtract
-100000
00100000
0000010
00100000
restore
0000100
0100000_
Shift
-100010
0100000_
Subtract B
011110
01000000
000100
01000000
restore
001000
1000000_
Shift
-100010
1000000_
Subtract
-011010
10000000
001000
10000000
Restore
Cycle
First
Second
Third
Fourth
010001
0000000_
Shift
-100010
0000000_
Subtract
-010001
00000000
010001
00000000
Restore
100010
0000000_
Shift
-100010
0000000_
Subtract
000000
00000001
000000
0000001_
Shift
-100010
0000001_
Subtract
-100010
00000010
000000
00000010
Restore
000000
0000010_
Shift
-100010
0000010_
Subtract
-100010
00000100
000000
00000100
Restore
Fifth
Sixth
Seventh
Eighth
From the above table the output remainder is P and Quotient is A i.e,
P = (000000)2 = 0 = Remainder and A = (00000100)2 = 4 = Quotient
We get
136
4 as quotient and 0 as remainder.
34
Ans.
Ques 5.
Sol.
Operation
Cycle
00000000
11001000
Initial vaule
First
00000001
1001000_
11011000
1001000_
Subtract B
11011001
10010000
10110011
0010000_
Shift
00101000
0010000_
Add B
11011011
00100000
10110110
0100000_
Shift
00101000
0100000_
Add B
11011110
01000000
10111100
1000000_
Shift
00101000
1000000_
Add B
11100100
10000000
11001001
0000000_
Shift
00101000
0000000_
Add B
Second
Third
Fourth
Fifth
11110001
00000000
11100010
0000000_
Shift
00101000
0000000_
Add B
00001010
00000001
00010100
0000001_
Shift
11011000
0000001_
Add B
11101100
00000010
11011000
0000010_
Shift
00101000
0000010_
Add B
00000000
00000101
Sixth
Seventh
Eighth
From the above table the output remainder is P and Quotient is A. Here P is (+ve), therefore
previous value is not restored.
P = (000000)2 = 0 = Remainder and A = (00000101)2 = 5 = Quotient.
We get
200
5 as quotient and 0 as remainder
40
Ans.