A signed value can be stored by adding a fixed bias before writing its bits. For an 8-bit representation, the bias is typically 128: -128 becomes 0, while 1 becomes 129. The stored patterns therefore preserve ordinary unsigned ordering, but they no longer support natural signed arithmetic. section 3.1.1
8-bit translation
With bias 128, encode -128 as -128 + 128 = 0, or 00000000. Encode 1 as 1 + 128 = 129, or 10000001. Decoding reverses the operation by subtracting 128. section 3.1.1
Use the contrast with two’s complement to identify the practical trade-off:
- Compare signed and unsigned values using the same ordering. section 3.1.1
- Account for the bias during arithmetic; adding two signed values is more complicated. section 3.1.1
- Prefer two’s complement when uniform binary arithmetic matters, because it works naturally for signed and unsigned operations. section 3.1.1
