BCD addition: 25 + 48
corethe +6 correction
Answer
01110011 = 73
Why this example is worth doing
Five plus eight is thirteen, which does not exist as a BCD digit, so the low nibble lands in the illegal range and must be corrected by adding six — pushing it past the six wasted patterns and generating the decimal carry as a side effect. The page shows the uncorrected intermediate, the detection condition and the corrected result, because the intermediate is where the marks are and it is invisible in the final answer.
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 00100101 + 01001000
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 | 2 + 4 + 1 = 7 | 00111 | no | 0 | - | 0111 (7) | 0 |
| 0 | 5 + 8 + 0 = 13 | 01101 | yes | 0 | +0110 | 0011 (3) | 1 |
result0111 001173
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 (counting from the least significant digit).