Question 7.1: Represent the decimal number (183)10 in binary and in hex.
Represent the decimal number (183)_{10} in binary and in hex.
Learn more on how we answer questions.
Initially we are not sure how many bits the number (183)_{10} requires in binary representation. To sort of figure out the number of bits required, let us list the powers of two:
Note from Table 7.3 that the number (128)_{10} can be represented in binary simply by writing:
(1000_{-}0000)_2=(128)_{10}
Similarly 128 + 64 = (192)_{10} is written as:
(1100_{-}0000)_2=(192)_{10}
Since we want to write the number (183)_{10} in binary representation we know that 8 bits will suffice. To convert from decimal to binary, algorithmically we proceed as follows:
We divide (183)_{10} by 2 to give an integer quotient of 91 and a remainder of ½. This process is repeated until the integer quotient becomes zero. We record all the operations as shown below:
Integer quotient | Remainder | Bit position | Weight | |
183/2 = 91 | + | ½ | b0 = 1(LSB) | 1 |
91/2 = 45 | + | ½ | b1 = 1 | 2 |
45/2 = 22 | + | ½ | b2 = 1 | 4 |
22/2 = 11 | + | 0 | b3 = 0 | 8 |
11/2 = 5 | + | ½ | b4 = 1 | 16 |
5/2 = 2 | + | ½ | b5 = 1 | 32 |
2/2 = 1 | + | 0 | b6 = 0 | 64 |
1/2 = 0 | + | ½ | b7 = 1(MSB) | 128 |
From above we conclude that (183)_{10} = (1011_{-}0111)_2.
Table 7.3 Some powers of two and bit position in a binary number |
|
Powers of 2 | Binary Bit Position |
2^0=1 | b_0 |
2^1=2 | b_1 |
2^2=4 | b_2 |
2^3=8 | b_3 |
2^4=16 | b_4 |
2^5=32 | b_5 |
2^6=64 | b_6 |
2^7=128 | b_7 |
Now to convert (183)_{10} to hex we simply translate each group of four bits into their hex equivalent starting with the LSB position according to Table 7.2,
Table 7.2 List of 16 uniquely defined hex digits, their binary and decimal equivalents | ||
Hexadecimal (Hex, Base 16) | Binary (Base 2) | Decimal (Base 10) |
0 | 0000 | 0 |
1 | 0001 | 1 |
2 | 0010 | 2 |
3 | 0011 | 3 |
4 | 0100 | 4 |
5 | 0101 | 5 |
6 | 0110 | 6 |
7 | 0111 | 7 |
8 | 1000 | 8 |
9 | 1001 | 9 |
A | 1010 | 10 |
B | 1011 | 11 |
C | 1100 | 12 |
D | 1101 | 13 |
E | 1110 | 14 |
F | 1111 | 15 |
thus:
(183)_{10}=(1011_0111)_2=(B7)_{16}
In Chapter 8 we will address some interesting ways of representing positive and negative binary numbers. This will be useful to design digital arithmetic circuits.