1

How do I find $4$ digit $10$'s complement of $-456$ (withbase $10$)?

I am able to do $4$ digit $10$'s complement of a positive number (base 10) using the formula

$base^n - number$

where $n$ is the number of digits, in this case $4$.

i.e. $4$ digit $10$'s complement of $456$ is

$10^4 - 456 = 9544$

But I can't seem to find the negative. I've tried googling and looking in StackExchange Math but none seems to fit what I need.

I would appreciate any help!

domster
  • 115
  • 6

2 Answers2

1

Taking base($=$radix) as $r$ and $n$ number of digits, so called, Radix-Complement Representation for the complement of $n$-digit number is obtained by subtracting it from $r^n$. If $D$ is between $1$ and $r^n − 1$, then subtraction produces again result between $1$ and $r^n − 1$. For example for number $1849$ it's $10$'s complement is $8151$, for $100$ it's $10$'s complement is $9900$. So, you computation is correct, you obtained $10$'s complement in $4$ digits of $456$ and it is $9544$.

"negative" $(-456)$ i.e. complement of $456$ is exactly $9544$ in $10$'s complement representation. Now if you take $10$'s complement of $9544$ i.e. $(-(-456))$, then you, obviously, obtain $456$.

Addition.

Let's look in more detail. In $n=4$ digits we have $10^n=10000$ possible decimal combinations from $0$ up to $9999$. Now, when we have only this combinations, but we want to have also negative numbers, then in $10$'s complement representation we make following: we leave $0$ in its place and keep first $\frac{10^n}{2}-1$ combinations as positive numbers i.e. from $1$ up to $\frac{10^n}{2}-1=4999$. And we call negative numbers all numbers from $\frac{10^n}{2}=5000$ up to $9999$. Finally we have positive $4999$ numbers, negative $5000$ numbers and zero.

So, $9544$ is $10$'s complement representation of $(-456)$ and it is $10$'s complement of $456$.

Some books use circle for radix complement representation: $0$ is north pole. Increasing direction is clockwise and south pole is first negative number. BTW south pole is most bad place in this representation.

zkutch
  • 13,410
  • thank you for your effort on this. however, i am trying to find the 10's complement of negative 456 (-456). will the answer differ from 10's complement positive 456 (applying the formula giving us 9544)? – domster Feb 09 '21 at 10:14
  • 1
    I wrote little addition in answer for $456$. The whole point of this representation is to declare part of the numbers from $1$ to $(10000-1)$ as "negative" and thus have both positive and negative numbers built from initially positive numbers. This is used in computers for radix $2$ where we have only combinations of $0$ and $1$ and have not sign mark. – zkutch Feb 09 '21 at 10:26
  • sorry for the late reply. i understand what you're saying but a little in doubt. am i right to say that the 4 digit 10's complement of a negative number is the same as the 4 digit 10's complement? i.e. 456's 4 digit 10's complement is 9544, also -456's 4 digit 10's complement is also 9544? – domster Feb 09 '21 at 14:34
  • 1
    Write one more addition. Write if/when need to clear something more. – zkutch Feb 09 '21 at 16:05
  • thank you so much, extremely grateful @zkutch. essentially, the MSB of 9544, which is 9, denotes negative? like how 2's complement work? – domster Feb 09 '21 at 16:15
  • 1
    Not exactly. In $4$ digits $10$'s complement $(-1)$ is $9999$, $(-2)$ is $9998$ and so on. But $(-4999)$ is $5001$, $(-4998)$ is $5002$, so negativity here gives msb numbers from $5$ up to $9$. In $2$'s complement it's more easy: $1$ in most left bit gives negativity. If/when you want more practice, look at south pole. It is most funny place of radix complement representation, about which books prefer keep silence. – zkutch Feb 09 '21 at 16:59
1

First compute 9's complement, i.e.,

$= 9999 - 0456$ $= 9543$

Then, add 1 to the LSB, that will be 10's complement, i.e.,

$= 9543 + 1$ $= 9544$

Note that this is the magnitude of given negative number.

  • thank you. however, does this work the same for -456? – domster Feb 09 '21 at 10:21
  • 1
    @domster , Note that this is the magnitude of given negative number. – Mithlesh Upadhyay Feb 09 '21 at 10:23
  • magnitude as in sign and magnitude? if i think i understood what you meant, am i right to say that the 4 digit 10's complement of a negative number is the same as the 4 digit 10's complement? i.e. 456's 4 digit 10's complement is 9544, also -456's 4 digit 10's complement is also 9544? – domster Feb 09 '21 at 14:36
  • 1
    @domster , when number is negative then compute 10's complement, otherwise no . Positive number has already its correct magnitude so you don't need find 10's complement of positive number. I guess, you understood. – Mithlesh Upadhyay Feb 09 '21 at 15:09
  • thanks! what do you mean by "when number is negative then compute 10's complement" though? so i can say 10's complement of -456 is 9544? – domster Feb 09 '21 at 15:59
  • 1
    @domster yes .. – Mithlesh Upadhyay Feb 10 '21 at 12:04