How do you convert from 10s complement to SIGNED decimal?

159 Views Asked by At

A bit confused. I am preparing for an exam and one of the practice problems asks us to convert from 10s complement to signed decimal. Attached is the answer to the table:

Table

As far as I'm aware and from what I've been taught, converting to and from 10s complement is done using: 1 + (r^n - 1) - x where r is the radix, n is the number of positions, and x is the original number.

I tried that on 48 for example, and I end up getting 52. Something about the "signed" aspect of the decimal number is throwing me off here. I would appreciate if someone explained this.

Thank you.

2

There are 2 best solutions below

4
On

You take the $10$s complement by first replacing each digit with $9$ minus the digit, and then adding $1$:

The $10$s complement of $3821$ is $$[9-3][9-8][9-2][9-1] + 1 = 6178 + 1 = 6179$$

But notice that if you add $3821 + 6179 = 10000$. This is because if you subtract your original number $3821$ from $9999$, since there is never a need to borrow, you just end up replacing each digit with $9$ minus it. So the conversion becomes $$3821 \mapsto (9999 - 3821) + 1 = (9999 + 1) - 3821 = 10000 - 3821$$

So the $10$s complement is the same as subtracting your original number from $10^n$, where $n$ is the number of digits available.

For $n = 2$, that means subtracting the original number from $100$. So yes, the $10$s complement of $48$ will be $52$ in a 2-digit system. There are no negative numbers, so the bottom half of the available numbers, $0 - 49$, are used to represent positives, while the top half of the available numbers, $50 - 99$ are used to represent negative numbers.

$0$ is its own negative. The negatives of $1 - 49$ are $100$ minus the positive value, that is, the range $51 - 99$ in reverse order. $50$ is usually also treated as negative, as if it were $-50$. This way you only have to look at the top digit to decide if the number represented is positive or negative: top digits of $0 - 4$ are positive, top digits of $5-9$ are negative.

This works because if you want to subtract $a - b$, that is $a + (-b)$, which in $10$s complement is $a + (100 - b) = 100 + (a-b)$. Since there is no room for the $100$s digit, it is lost, and the stored number is just $a - b$. (Yes, technically in actual systems, the $100$s digit would be stored in an "overflow digit" that could be used in later multi-word calculations. But when doing a simple subtraction, you ignore the overflow digit, so it is still lost.)

0
On

When you have "signed" numbers without an explicit sign -- such as tens complement -- you have to have some other way of telling which numbers are positive and which are negative.

It seems that in this two-digit tens complement system the rule is that if the leftmost of the two digits is $5$ or greater, the number is negative. If the leftmost digit is in anything in the range from $0$ to $4$ inclusive, the number is positive.

Since the leftmost digit of $48$ is $4,$ you have a positive number. Since the number is positive, you do not do take the "tens complement" of it. You just take the number as is. It is simply the positive number $48.$