Question 2 | |||||||||||||
Assume we use 8 bits to store numbers. | |||||||||||||
a) 43 in unsigned binary | |||||||||||||
43 | 0010 1011 | ||||||||||||
21 | 1 | ||||||||||||
10 | 1 | ||||||||||||
5 | 0 | ||||||||||||
2 | 1 | ||||||||||||
1 | 0 | ||||||||||||
0 | 1 | ||||||||||||
b) -43 in signed magnitude | |||||||||||||
1010 1011 | sign bit = 1 | ||||||||||||
c) -43 in 1's complement | |||||||||||||
1101 0100 | complement bits | ||||||||||||
d) -43 in 2's complement | |||||||||||||
1101 0101 | add 1 | ||||||||||||
e) -43 in excess/bias | |||||||||||||
bias = 27 = 128 | |||||||||||||
-43 + 128 = 85 | 0101 0101 | 85 in base 2 | |||||||||||
f) 43 in BCD (Binary Coded Decimal) | |||||||||||||
0100 0011 | |||||||||||||