2000. Convert the following Binary numbers (1 bit sign, 15 bit value) to Decimal, Octal and Hex
a. 0,110010111011111
b. 0,001101110111011
c. 1,010100111001100 (One’s Complement)
d. 1,111111111111010 (Two’s Complement)
2. a. Decimal:
0,1100101110111112 = 214 + 213 + 210 + 28 + 27 + 26 + 24 + 23 + 22 + 21 + 20
= 16,384 + 8,192 + 1,024 + 256 + 128 + 64 + 16 + 8 + 4 + 2 + 1
= + 26,07910
Octal:
Chk: 6 * 84 + 2 * 83 + 7 * 82 + 3 * 81 + 7 * 80
+ 6 2 7 3 7 = 6 * 4,096 + 2 * 512 + 7 * 64 + 3 * 8 + 7 * 1
= 24,576 + 1,024 + 448 + 24 + 7
0, 110 010 111 011 1112 = 26,07910
Hexadecimal:
Chk: 6 * 163 + 5 * 162 + D = 13 * 161 + F = 15 * 160
+ 6 5 D F = 6 * 4,096 + 5 * 256 + 13 * 16 + 15 * 1
= 24,576 + 1,280 + 208 + 15
0, 110 0101 1101 11112 = 26,07910
2. b. Decimal:
0,001101110111011 = + 212 + 211 + 29 + 28 + 27 + 25 + 24 + 23 + 21 + 20
= + 4,096 + 2,048 + 512 + 256 + 128 + 32 + 16 + 8 + 2 + 1
= + 7,09910
Octal:
+ 1 5 6 7 3 Chk: 1 * 84 + 5 * 83 + 6 * 82 + 7 * 81 + 3 * 80
= 1 * 4,096 + 5 * 512 + 6 * 64 + 7 * 8 + 3 * 1
0, 001 101 110 111 011 = 4,096 + 2,560 + 384 + 56 + 3
= + 7,09910
Hexadecimal:
+ 1 B B B Chk: = 1 * 163 + B=11* 162 + D=13 * 161 + B=11 * 160
= 1 * 4,096 + 11 * 256 + 11* 16 + 11 * 1
0, 001 1011 1011 1011 = 4,096 + 2,816 + 176+ 11
= +7,099
2. c. Decimal:
Since negative, we must first complement: 1,010100111001100 ® 0,101011000110011
101011000110011 = 214 + 212 + 210 + 29 + 25 + 24 + 21 + 20
= 16,384 + 4,096 + 1,024 + 512 + 32 + 16 + 2 + 1
= -22,067
Octal:
5 3 0 6 3 Chk: = 5 * 84 + 3 * 83 + 6 * 81 + 3
= 5 * 4,096 + 3 * 512 + 6 * 8 + 3
101 011 000 110 011 = 20,480 + 1,536 + 48 + 3
= -22,067
Hexadecimal:
Chk: = 1 * 163 + 6 * 162 + 3 * 161 + 3
5 6 3 3 = 5 * 4,096 + 6 * 256 + 3 * 16 + 3
= 20,480 + 1,536 + 48 + 3
101 0110 0011 0011 = -22,067
2.d. Decimal:
Since the binary number: 1,111111111111010 has the value ‘1’ in the left-most position, the number is negative and we must complement the right 15-bits AND add ‘1’ to the complemented result:
000000000000101
+ 1
0000000000001102 = - 610 = - 68 = - 616
Are we sure?? As a check, let’s store the value –610.
6 / 2 = 3 6 % 2 = 0 = 1102 = 00000000000001102 on 16-bits
3 / 2 = 1 3 % 2 = 1
1 / 2 = 0 1 % 2 = 1
Since the value is negative (and stored as a two’s complement), we must complement and add 1 to the complement:
0000000000000110 The Value +6
1111111111111001 One’s Complement
+ 1 Add 1
1111111111111010 Two’s Complement