10's complement confusion.

754 Views Asked by At

For the sake of simplicity, lets consider only single digit numbers. According to the logic(that I understand), 10's complement of a number 'x' is (10-x). So,

10's comp. of 0 = (10-0) = 10 (due to overflow, only 0 remains, so no -ve 0)(am I correct?),

10's comp. of 1 = (10-1) = 9 (representing -1),

10's comp. of 2 = (10-2) = 8 (representing -2),

10's comp. of 3 = (10-3) = 7 (representing -3),

10's comp. of 4 = (10-4) = 6 (representing -4),

10's comp. of 5 = (10-5) = 5 (representing -5) (here is the problem).

How can 5 represent -5? If we cannot include +5, then 10's complemented 5 is the negative of whom? how this problem is dealt with? Am I making any mistake? Please explain in detail. Thank You!

Edit: How would a processor, which does 2's complement arithmetic(an extension of 10's complement) be able to distinguish between +5(5) and -5(5)?

3

There are 3 best solutions below

3
On BEST ANSWER

You really need more digits to see what is going on. If you have a three digit register, we consider all numbers that start with $0$ to $4$ as positive and all numbers that start with $5$ to $9$ as negative. The range of numbers you can represent is then $-500$ to $+499$. Yes, $500$ and $-500$ would be represented by the same number, but any calculation that results in $+500$ should be considered an overflow. In your example, $5$ would represent $-5$ and not $+5$. $+5$ (and any higher positive number) cannot be represented in this system.

0
On

What you seem to be looking for is perhaps additive inverse for a group where the additive identity is given by $I=10$.

0
On

If you understand modular arithmetic, you will know that it's just a definition. For example under mod 10, 1 is equivalent to -9.

Imagine a clock with numbers 0 to 9, moving 5 units forward is the same as moving five units backward 0 9 8 7 6 5 or 0 1 2 3 4 5