BCD addition needing two corrections: 99 + 99
corecorrections cascade
Answer
000110011000 = 198
Why this example is worth doing
Both digit positions overflow, so the correction is applied twice and the carry ripples into a new leading digit. It is the worst case for a BCD adder and the one that shows the correction is not a special case bolted on for one situation but a per-digit rule applied uniformly. The page steps through both nibbles separately so the cascade is visible.
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
BCD addition 10011001 + 10011001
Work least significant digit first. Add the two digits and the carry in. If the raw sum exceeds 9 OR the 4-bit add carried out, add 0110 and carry 1 into the next digit.
| digit | raw sum | 5-bit | > 9? | nibble carry | correction | digit | carry out |
|---|---|---|---|---|---|---|---|
| 1 | 9 + 9 + 1 = 19 | 10011 | yes | 1 | +0110 | 1001 (9) | 1 |
| 0 | 9 + 9 + 0 = 18 | 10010 | yes | 1 | +0110 | 1000 (8) | 1 |
result0001 1001 1000198
why 616 - 10 = 6— BCD skips the six codes 1010..1111, so a binary carry (weight 16) has to be realigned with a decimal carry (weight 10)
Correction applied at digit 0, 1 (counting from the least significant digit).