Unsigned Binary to Negative Binary Conversion
In 8-bit two's complement every bit still has a place value, but the leftmost bit is worth -128 rather than 128. Reading left to right, the eight place values are -128, 64, 32, 16, 8, 4, 2 and 1. Any 1 bit adds its place value to the total; any 0 bit adds nothing.
| Bit position | Place value |
|---|---|
| 7 (leftmost, the sign bit) | -128 |
| 6 | 64 |
| 5 | 32 |
| 4 | 16 |
| 3 | 8 |
| 2 | 4 |
| 1 | 2 |
| 0 (rightmost) | 1 |
The leftmost bit is called the sign bit, and it really is part of the total. When it is 1 you start at -128; when it is 0 the value is zero or positive and you add only the ordinary values. A pattern with a 1 in the sign bit is always negative, because the other seven bits can add at most 64 + 32 + 16 + 8 + 4 + 2 + 1 = 127, which is never enough to climb back up to zero.
Write down each place value under its bit, then add the values wherever a 1 appears. Take 11010010: the 1s sit in the -128, 64, 16 and 2 columns, so the value is -128 + 64 + 16 + 2 = -46. Try 11100111: -128 + 64 + 32 + 4 + 2 + 1 = -25. Because the sign bit can never be cancelled out, any pattern that begins with 1 sits somewhere from -128 up to -1, and any pattern that begins with 0 sits from 0 up to 127, so a single byte holds exactly 256 different values, from -128 up to 127, with no gaps.
A 0 in the sign bit means the -128 card is not counted, so you just add the positive values. For 01000111 that is 64 + 4 + 2 + 1 = 71. This is exactly the same number you would get reading the pattern as unsigned, because positive two's complement patterns are never changed.
Edexcel GCSE Computer Science · Unsigned Binary to Negative Binary Conversion
Edexcel GCSE Computer Science · Denary to Negative Binary Conversion
Edexcel GCSE Computer Science · Binary Shifts