Excess-3 code for the digit 5 — BCD
edge casea self-complementing alternative
Answer
1000
Why this example is worth doing
Excess-3 adds three to each digit before encoding, which makes the code self-complementing: the nine's complement of a digit is the bitwise complement of its codeword. That property makes decimal subtraction cheap, which is why excess-3 was used in early calculators. The page includes it to show that 8421 BCD is one choice among several decimal codes, not the only possible one.
Try your own input in the BCD converter. Pack and unpack binary-coded decimal, and add with the +6 correction shown.
How the answer is reached
Excess-3
| digit | digit + 3 | code |
|---|---|---|
| 5 | 8 | 1000 |