How to subtract BCD numbers?
For example: $1001 0011 - 0101 0110$
I am unsure what to do. Is there some correction factor just like with BCD addition?
$\endgroup$ 32 Answers
$\begingroup$In binary subtraction, we find the 2's complement of operand $b$ by inverting all bits and adding a $1$. When adding this to $a$ you have performed $a-b$. In BCD we have to find the 10's complement. This is done by subtracting 9 from each decimal digit (a 4 bit binary number) and adding a $1$. Now, using ordinary BCD addition rules we add the two numbers.
Example:
10's complement of 0101 0110 is 0100 0100 (subtracted 9 from each 4 bit segment and added a $1$ to the last one. Notice that this could overflow when finding the 10's complement of $0000$. You would have to correct the BCD number.).
Now adding 1001 0011 and 0100 0100:
$1001 0011 + 0100 0100=1101 0111$
Correction is done when a digit acceeds the value 9 ($1001$ in BCD). The first digit is correct. The second digit is invalid. To correct it we add 6 ($0110$ in BCD). $1101+0110=0011$ (ignore overflow).
So:
$1101 0111$ becomes $0011 0111$
Therefore:
$1001 0011 - 0101 0110=0011 0111$
Let's check if this is correct:
$1001 0011=93$
$0101 0110=56$
$93-56=37=0011 0111$
$\endgroup$ 2 $\begingroup$The explanation actually should say, "subtract each decimal digit from 9" rather than "9 from each decimal digit". The operation is correct, just the explanation is confusing.
$\endgroup$More in general
"Zoraya ter Beek, age 29, just died by assisted suicide in the Netherlands. She was physically healthy, but psychologically depressed. It's an abomination that an entire society would actively facilitate, even encourage, someone ending their own life because they had no hope. Th…"