Two's Complement to Decimal Conversion
These are examples of converting an eight-bit two's complement number
to decimal. To do this, you first check if the number is negative or
positive by looking at the sign bit. If it is positive, simply convert
it to decimal. If it is negative, make it positive by inverting
the bits and adding one. Then, convert the result to decimal.
The negative of this number is the value of the original binary.
- Interpret 11011011 as a two's complement binary number, and give its
decimal equivalent.
- First, note that the number is negative, since it
starts with a 1.
- Change the sign to get the magnitude of the number.
| 1 | 1 | 0 | 1 | 1 | 0 | 1 | 1 |
¬ |
0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 |
+ | | | | | | | | 1 |
| 0 | 0 | 1 | 0 | 0 | 1 | 0 | 1 |
- Convert the magnitude
to decimal: 001001012 = 2516 =
2×16 + 5 = 3710.
- Since the original number was negative, the final result is
-37.
- Interpret 01101001 as a two's complement binary number, and give its
decimal equivalent. The number is positive, so simply convert it to
decimal: 011010012 = 6916 =
6×16 + 9 = 10510.
- Interpret 11110010 as a two's complement binary number, and give its
decimal equivalent.
| 1 | 1 | 1 | 1 | 0 | 0 | 1 | 0 |
¬ |
0 | 0 | 0 | 0 | 1 | 1 | 0 | 1 |
+ | | | | | | | | 1 |
| 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 |
000011102 = e16 =
0×16 + 14 = 1410. Answer: -14.
- Interpret 10011100 as a two's complement binary number, and give its
decimal equivalent.
| 1 | 0 | 0 | 1 | 1 | 1 | 0 | 0 |
¬ |
0 | 1 | 1 | 0 | 0 | 0 | 1 | 1 |
+ | | | | | | | | 1 |
| 0 | 1 | 1 | 0 | 0 | 1 | 0 | 0 |
011001002 = 6416 =
6×16 + 4 = 10010. Answer: -100.
- Interpret 01010111 as a two's complement binary number, and give its
decimal equivalent. 010101112 = 5716 =
5×16 + 7 = 8710.