14

Sometimes, if the sum of two digits are < 10, BCD addition is similar to binary addition.

But sometimes if the sum > 9, the result requires a correction. This corrections is +( 0110).

Why do we add 6? Why not some other number? I searched the web, but I don't understand.


If you want links of this question that have been asked in the past:

JYelton
  • 34,119
  • 33
  • 145
  • 265
mine wwe
  • 151
  • 1
  • 2
  • 6

2 Answers2

22

Four binary digits count up to 15 (1111) but in BCD we only use the representations up to 9 (1001). The difference between 15 and 9 is 6. If you want 9+1 to produce 10, which is 1 0000, you have to add 6 to make 1010 wrap to 1 0000.

If you're adding minutes, you similarly add 40 to a time which exceeds 59 minutes. Example: 45 minutes plus 35 minutes is 80 minutes. Correction, add 40 to make 120. Now insert a colon: 1:20. One hour, twenty minutes. 40 is the difference between 100 and 1:00.

Kaz
  • 20,006
  • 1
  • 39
  • 83
1

It refers to two's complement representation of numbers.

https://en.wikipedia.org/wiki/Two%27s_complement

When you want to subtract B from A (A - B), we can add (-B) to A alternatively (A +(-B)).

If the sum > 10, we need 4 least significant digits of the sum for BCD representation, therefore, we should subtract 10 from the sum.

2's complement of 10 in 5 bit is (Ten = 01010), therefore when we want to subtract 10 from a number, we can add (-Ten) to number, that represents in 2'complement as (10110).

BCD addition is like a 4-bit binary adder that means we need 4 least significant bits of (-Ten){0110 = #6}, to add it to sum.