Booth and Radix-4 Questions
Booth and Radix-4 Questions
Solution
a. In the solutions below the multiplier has been encoded using Booth encoding in which each
bit has been replaced with a symbol based on the original bit as well as its neighbor to the right:
Bit and its
right-hand neighbor Booth encoding
00 0
01 1
10 1
11 0
Multiplying by 1 and adding is the same as adding in the two’s complement of the multiplicand.
a. 101 101 b. 011 110 c. 111 100 d. 101 010
×011 100 ×111 101 ×100 111 ×011 001
000 001 001 100 11 111 100 010 00 000 000 100 0 000 010 110
111 101 101 00 001 111 0 11 111 111 00 1 101 010
000 100 11 11 100 010 00 000 010 0 0 101 10
000 011 100 100 00 111 10 11 110 0 0 011 000 110
10 001 0
−19 × −12 = 228 11 110 001 100 −22 × −9 = 198
10 110 001 010 −4 × 29 = −116
30 × −21 = −630
1
b. In the solutions below the multiplier has been encoded using bit-pair encoding (Booth radix-4
encoding) in which each pair of bits has been replaced with a symbol based on the original pair of
bits as well as its neighbor to the right:
Bit and its Bit and its
right-hand neighbor Bit-pair encoding right-hand neighbor Bit-pair encoding
000 00 100 10
001 01 101 01
010 01 110 01
011 10 111 00
Multiplying by 1 and adding is the same as adding in the two’s complement of the multiplicand.
2
6.28 Convert the following decimal numbers to IEEE single-precision floating-point numbers. Re-
port the results as hexadecimal values. You need not e4xtend the calculation of the significand
value beyond its most significant 8 bits.
b. 6.5125
e. 56,000,135
f. −23.23
g. 6.02 × 1023
Solution
6.28 b.
6.512510 = 1.62816 × 22
≈ 1.A0CCCCD16 × 22
= 1.1010 0000 1100 1100 1100 1100 1101
If only the most significant eight bits of the significand are included (assuming the bit to the
left of the binary point is one of them,) then the result can be shortened to 40D0000016
3
6.28 e.
56, 000, 13510 = 1.6689 × 225
= 1.AB3F43816 × 225
= 1.1010 1011 0011 1111 0100 0011 10002 × 225
≈ 1.1010 1011 0011 1111 0100 0102 × 225 .
Here we round off to 23 bits after the binary point. If the truncated digits are exactly 1 with
infinitely many trailing zeroes, round in the direction which yields a 0 in the least significant
remaining bit.
The sign bit s = 0 since this number is positive.
The exponent e = 127 + 25 = 128 + 24 = 1001 10002.
Piecing these together gives
0 1001 1000 1010 1011 0011 1111 0100 010 = 0100 1100 0101 0101 1001 1111 1010 0010
= 4C55 9FA216
≈ 4C56 000016 .
6.28 f.
−23.23 = −1.451875 × 24
≈ −1.73AE14816 × 24
= 1.0111 0011 1010 1110 0001 0100 100016 × 24 .
4
6.29 Convert the following IEEE single-precision floating-point numbers to their decimal values.
Report the answers to three significant figures. Use scientific notation if needed to maintain
precision:
a. 0x21E0 0000
b. 0x8906 0000
c. 0x4B90 0000
d. 0xf1A6 0000
Solution
6.29 a.
0x21E0 0000 = 0010 0001 1110 0000 0000 0000 0000 0000
= 0 0100 0011 1100 0000 0000 0000 0000 000
The floating point number, therefore, is 1.75 × 2−60 = 1.518 × 10−18 ≈ 1.52 × 10−18 .
6.29 b.
0x8906 0000 = 1000 1001 0000 0110 0000 0000 0000 0000
= 1 0001 0010 0000 1100 0000 0000 0000 000
The floating point number, therefore, is −1.047 × 2−109 = −1.613 × 10−33 ≈ −1.61 × 10−33 .
5
6.29 c.
0x4B90 0000 = 0100 1011 1001 0000 0000 0000 0000 0000
= 0 1001 0111 0010 0000 0000 0000 0000 000
The floating point number, therefore, is 1.125 × 224 = 1.887 × 107 ≈ 1.89 × 107 .
6.29 d.
0xF1A6 0000 = 1111 0001 1010 0110 0000 0000 0000 0000
= 1 1110 0011 0100 1100 0000 0000 0000 000
The floating point number, therefore, is −1.297 × 2100 = −1.644 × 1030 ≈ −1.64 × 1030 .
6
6.31 In floating-point addition, can you give an example where a+b = a for some nonzero value of b?
Solution
Let a = 1 × 224 and let b = 1. In the IEEE single-precision floating-point format there
are only 24 bits of precision available, including the implied 1-bit in a normalized number.
When we add them in floating-point hardware, they must first be aligned, which means the
lesser number needs to be shifted to the right until its exponent matches that of the larger
number. As a result we do not get the same results as when we add them using infinitely
precise real numbers, as shown in the table below.
7
6.32 Show that for floating-point addition, the associative law, (a + b) + c = a + (b + c), does not
hold.
Solution
It is sufficient to show that the associative law fails in even one instance. The law fails, gener-
ally, because there is a limited number of bits in the representation. When doing floating-point
addition or subtraction, the arguments must be aligned, that is, they must have the same ex-
ponent. One of the numbers—usually the lesser—is scaled so that it has the same exponent
as the other. This means using a denormalized version of the number, that is, it requires that
there be leading zeroes before the addition can be performed.
Consider the addition problem (a + b) + c = (1 × 224 + 1) + 1. The 1 inside the parentheses
must be scaled by shifting it to the right 24 places, making its exponent 24 also. However,
with only 24 bits in the number, the result is zero:
1.0000 0000 0000 0000 0000 0001 × 224 1.0000 0000 0000 0000 0000 000 × 224
+ 1 + 0.0000 0000 0000 0000 0000 000 × 224
24
1.0000 0000 0000 0000 0000 0010 × 2 1.0000 0000 0000 0000 0000 000 × 224
We get the correct answer the second way but not the first way. Not only does this show that
addition of floating point numbers does not obey the associative law, it also suggests errors
can be reduced by doing addition and subtraction of the smallest numbers first.