You couldn't use that hardware to compare two numbers in 2C. In particular, it would say all negative values were larger than non-negative values.
This isn't a big problem, certainly not enough to outweigh the advantages of using 2C for signed ints.
Still, this leads to another idea for representation.
Here's a chart for 3 bit binary numbers using unsigned representation.
Representation | Value |
000 | 0 |
001 | 1 |
010 | 2 |
011 | 3 |
100 | 4 |
101 | 5 |
110 | 6 |
111 | 7 |
Suppose we wanted to represent negative numbers, but wanted to keep the same ordering where 000 represents the smallest value and 111 represents the largest value?
This is the idea behind excess representation or biased representation. The bitstring with N 0's maps to the smallest value and the bitstring with N 1's maps to the largest value.
Like SM and 1C, it might be nice if half the bitstrings mapped to negative numbers. Since 3 bits allows for 8 different representations, then half that is 4. So, the smallest value is -4.
When we shift by 4, this is called excess 4 representation. Here's a chart.
Representation | Value |
000 | -4 |
001 | -3 |
010 | -2 |
011 | -1 |
100 | 0 |
101 | 1 |
110 | 2 |
111 | 3 |
In excess notation, you specify two parameters: the number of bits, N, and the bias value, K. In SM and 1C, there's only one parameter: the number of bits.
For example, let K = 5 (in 3 bits), and you have excess 5 representation, which assigns 000 to -5 and makes 111 equal to 2.
In fact, excess K representation maps 0^{N} to -K, and 1^{N} to -K + 2^{N} - 1.
If you pick K = 2^{N - 1}, then the sign bit is flipped, where 1 in the MSb means positive, and 0 means negative.
With excess (or bias) representation, you can't do addition using unsigned int addition hardware. You need a specialized circuit to perform the addition.
Number of Bits | Number of Values | Min Value | Max Value |
16 | 2^{16} | -K | -K + (2^{16} - 1) |
32 | 2^{32} | -K | -K + (2^{32} - 1) |
N | 2^{N} | -K | -K + (2^{N} - 1) |
However, since excess K representation using N bits has two parameters, K and N, you can pick K to be whatever you want. You can have more positive numbers than negative, not include zero, and so forth.
Because excess K representation uses two variables (K and N), any hardware designed to perform addition in this representation will depend on both K and N. Fortunately, sorting values in excess representation only depends on N.
Like 2C, excess representation has, at most, one zero. However, it is possible to pick K so there's no zero (pick a suitably large K).
Unlike the other signed int representations, you can compare values in excess/bias representation using unsigned comparison. However, most people prefer doing addition correctly to comparison, which is why 2C is preferred to excess notation.
Excess notation does find a use in floating point representation, however, which is why we study it.