The issue with the binary system is that there is no way to represent negative numbers, here we will introduce 3 systems designed to solve that problem:
- Sign-and Magnitude
- 1s Complement
- 2s Complement
Signed-and-Magnitude
Use the first bit to represent the sign.
- 0 for + (positive)
- 1 for - (negative) For example,
- 00110100 represents 52
- 10110100 represents -52
Given n-bits, the range of value it can represent is:
1s Complement
- Represent the negation of a positive binary value as
- Or, can think of it as βflippingβ the binary numbers around
- e.g. negation of 00001100 is 11110011, representing 1210 and -1210 respectively
Given n-bits, the range of value it can represent is:
2s Complement
- Represent the negation of a positive binary value as
- Or, can think of it as βflippingβ the binary numbers around, then add 1
- Alternatively, (from LSB to MSB), copy the numbers to the first 1, and invert the rest.
 
- e.g. negation of 00001100 is 11110100, representing 1210 and -1210 respectively
Given n-bits, the range of value it can represent is:
Note
You can also extend the idea of complement on fractions!
Excess Representation
- Allows range of values to be distributed evenly between the positive and negative values.
- E.g. Excess-4 representation on 3-bits number
Actual value = Bit pattern (unsigned) - 4
| 3-bit pattern | Unsigned value | Actual value (Excess-4) | 
|---|---|---|
| 000 | 0 | β4 | 
| 001 | 1 | β3 | 
| 010 | 2 | β2 | 
| 011 | 3 | β1 | 
| 100 | 4 | 0 | 
| 101 | 5 | +1 | 
| 110 | 6 | +2 | 
| 111 | 7 | +3 |