<< Chapter < Page | Chapter >> Page > |
This module contains worked examples of how to convert between the decimal, hexadecimal and binary.
Before working through some examples, it will be useful to review how we use the decimal system. The decimal system can express any real rational number using the digits 0-9 and a minus sign. The places of the digits represent the power of ten that is being used. For example:
In the same way, binary systems use 1's and 0's to express a number:
The following examples show how to convert between unsigned binary and decimal values.
What is the decimal value of 10101 ?
In this case, we are dealing with unsigned binary numbers. Our range of possible numbers are between 0 and .
Convert 011010 to decimal.
Write out the sum of each digit multiplied by its correct power of two:
Convert the decimal number 47 to binary unsigned.
For the decimal number 47, the largest multiple of two is 32 ( ).
Note: If necessary, you can check your answer by reversing the steps and converting it back to decimal.
Convert 11001110 (signed) to decimal value.
The most significant bit is 1. This means it is negative.
Thus the answer is -78.
Convert -98 to signed binary(8bit).
In this case, the decimal number is negative so the most significant bit is 1.
Convert 98 to signed binary(8bit).
In this case, the decimal number is negative so the most significant bit is 0.
Since we have already calculated the binary representation for 98, we can use the answer from the previous example. The steps are shown again to illustrate this.
The table below is a refresher for two's complement.
Two's Complement | Decimal |
0111 | 7 |
0110 | 6 |
0101 | 5 |
0100 | 4 |
0011 | 3 |
0010 | 2 |
0001 | 1 |
0000 | 0 |
1111 | -1 |
1110 | -2 |
1101 | -3 |
1100 | -4 |
1011 | -5 |
1010 | -6 |
1001 | -7 |
1000 | -8 |
Convert 001011 (two's complement 6-bit) to decimal value.
In this case, the most significant bit is 0. The number is positive.
Convert 111011 (two's complement 6-bit) to decimal value
The first bit is 1 so the number is negative.
11011 -->00100
Thus the answer is -5.
Convert -13 to two's complement 8-bit binary.
The number is negative so the most significant bit will be 1.
1100 -->0011
0011 -->11110011
A reference table is attached for conversion between decimal, hexadecimal and binary.
Decimal | Hexadecimal | Binary |
0 | 0 | 0000 |
1 | 1 | 0001 |
2 | 2 | 0010 |
3 | 3 | 0011 |
4 | 4 | 0100 |
5 | 5 | 0101 |
6 | 6 | 0110 |
7 | 7 | 0111 |
8 | 8 | 1000 |
9 | 9 | 1001 |
10 | A | 1010 |
11 | B | 1011 |
12 | C | 1100 |
13 | D | 1101 |
14 | E | 1110 |
15 | F | 1111 |
Convert ABC (hexadecimal) to binary and decimal.
It may sometimes be easier to convert to decimal first and then binary.
ABC -->10 , 11 , 12
ABC -->10 + 11 + 12 -->1010 1011 1100
1010 1011 1100 -->101010111100
Convert 1010011110000001 to its decimal and hexadecimal values.
1010011110000001 -->1010 0111 1000 0001
1010 0111 1000 0001 -->A781
A781 -->10, 7, 8, 1
Notification Switch
Would you like to follow the 'Precalculus with engineering applications' conversation and receive update notifications?