2
NUMBER SYSTEMS
AND CODES
E X E R C I S E
2.1
(a)
1101011 2 = 6B 16
10110111 2 = B7 16
(b)
(e)
10100.1101 2 = 14.D 16
(f)
(g)
11011001 2 = 331 8
101111.0111 2 = 57.34 8
(h)
(c)
(i)
2.3
(a)
(b)
(c)
(d)
(e)
(f)
2.5
S O L U T I O N S
(a)
(c)
(e)
(g)
(i)
(d)
174003 8 = 1111100000000011 2
67.24 8 = 110111.0101 2
F3A5 16 = 1111001110100101 2
AB3D 16 = 1010101100111101 2
15C.38 16 = 101011100.00111 2
1023 16 = 1000000100011 2 = 10043 8
7E6A 16 = 111111001101010 2 = 77152 8
(j)
ABCD 16 = 1010101111001101 2 = 125715 8
C350 16 = 1100001101010000 2 = 141520 8
9E36.7A 16 = 1001111000110110.0111101 2 = 117066.364 8
DEAD.BEEF 16 = 1101111010101101.1011111011101111 2 = 157255.575674 8
1101011 2 = 107 10
(b) 174003 8 = 63491 10
10110111 2 = 183 10
(d) 67.24 8 = 55.3125 10
10100.1101 2 = 20.8125 10 (f) F3A5 16 = 62373 10
12010 3 = 138 10
7156 8 = 3694 10
(h)
AB3D 16 = 43837 10
(j)
15C.38 16 = 348.21875 10
21
22
2.6
DIGITAL CIRCUITS
125 10 = 1111101 2
209 10 = 11010001 2
(b)
132 10 = 1000100 2
727 10 = 10402 5
(f)
(g)
(h)
23851 10 = 5D2B 16
57190 10 = DF66 16
(i)
1435 10 = 2633 8
(j)
65113 10 = FE59 16
(a)
(c)
(e)
2.7
(a)
2.10 (a)
(d)
3489 10 = 6641 8
9714 10 = 22762 8
1100010
110101
+ 11001
-------------------------1001110
(b)
1011000
101110
+ 100101
-------------------------1010011
(c)
111111110 (d) 11000000
11011101
1110010
+ 1100011
+ 1101101
--------------------------------------------------------------101000000
11011111
1372
+ 4631
-------------------59A3
(b)
4F1A5
+ B8D5
---------------------5AA7A
(c)
F35B
+ 27E6
--------------------11B41
(d)
1B90F
+ C44E
---------------------27D5D
2.11
decimal
+ 18
+ 115
+79
49
100
signed-magnitude
00010010
01110011
01001111
10110001
10000011
11100100
twos-magnitude
00010010
01110011
01001111
11001111
11111101
10011100
ones-complement
00010010
01110011
01001111
11001110
11111100
10011011
2.18
hj =
b4j + i 2
i=0
Therefore,
4n 1
B =
n1
bi 2i =
i0
hi 16i
i=0
4n 1
B =
24 n
i=0
n1
bi
2i
16 n
h i 16 i
i=0
Suppose a 3n-bit number B is represented by an n-digit octal number Q. Then the twos-complement of B is
represented by the 8s-complement of Q.
2.22 Starting with the arrow pointing at any number, adding a positive number causes overflow if the arrow is
advanced through the +7 to 8 transition. Adding a negative number to any number causes overflow if the
arrow is not advanced through the +7 to 8 transition.
EXERCISE SOLUTIONS
23
2.24 Let the binary representation of X be x n 1 x n 2 x 1 x 0 . Then we can write the binary representation of Y as
x m x m 1 x 1 x , where m = n d . Note that x m 1 is the sign bit of Y . The value of Y is
0
n2
Y = 2 m 1 xm 1 +
xi 2 i
i=0
The value of X is
n2
X = 2 n 1 xn 1 +
xi 2 i
i=0
n2
= 2 n 1 xn 1 + Y + 2 m 1 xm 1 +
xi 2 i
i = m1
n2
xi 2 i
= 2 n 1 xn 1 + Y + 2 2 m 1 +
i=m
Case 1 ( x m 1 = 0 ) In this case, X = Y if and only if 2 n 1 x n 1 +
only if all of the discarded bits ( x m x n 1 ) are 0, the same as x m 1 .
i = m x i 2 i
n2
= 0 , which is true if and
Case 2 ( x m 1 = 1 ) In this case, X = Y if and only if 2 n 1 x n 1 + 2 2 m 1 + n 2 x i 2 i = 0 , which
i=m
is true if and only if all of the discarded bits ( x m x n 1 ) are 1, the same as x m 1 .
2.25 If the radix point is considered to be just to the right of the leftmost bit, then the largest number is 1.11 1 and
the 2s complement of D is obtained by subtracting it from 2 (singular possessive). Regardless of the position
of the radix point, the 1s complement is obtained by subtracting D from the largest number, which has all 1s
(plural).
2.28
n2
B = b n 1 2n 1 +
bi 2i
i=0
n2
2B = b n 1 2 n +
bi 2 i + 1
i=0
Case 1 ( b n 1 = 0 ) First term is 0, summation terms have shifted coefficients as specified. Overflow if
bn 2 = 1 .
Case 2 ( b n 1 = 1 ) Split first term into two halves; one half is cancelled by summation term b n 2 2 n 1 if
b n 2 = 1 . Remaining half and remaining summation terms have shifted coefficients as specified. Overflow if
bn 2 = 0 .
2.32 001010, 011100, 101110, 111000.
2.34 Perhaps the designers were worried about what would happen if the aircraft changed altitude in the middle of a
transmission. With the Gray code, the codings of adjacent alitudes (at 50-foot increments) differ in only one
bit. An altitude change during transmission affects only one bit, and whether the changed bit or the original is
transmitted, the resulting code represents an altitude within one step (50 feet) of the original. With a binary
code, larger altitude errors could result, say if a plane changed from 12,800 feet (0001000000002) to 12,750
feet (0000111111112) in the middle of a transmission, possibly yielding a result of 25,500 feet
(0001111111112).
24
DIGITAL CIRCUITS
2.37
010
000
011
110
111
100
101
001