Nine's complement with positive and negative decimal values Question

912 Views Asked by At

"If the number is positive, the nine's complement of the number is itself."

I read this on a book named "Foundation of Computer Science", it said that the 9's complement of +234 is +234.

Meanwhile, I looked for some turtorials on Youtube, however, it said 999 substract 234 is +234's 9's complement, I am very confused right now.

Book: 234 9's = 234

Youtube: 234 9's = 999-234=765

Can someone plz explain to me?

2

There are 2 best solutions below

0
Reinhard Männer On

In number representation, the complement of a number is obtained by subtracting this number from the max that can be represented using the available digits, see here.
If you have a 3 digit decimal number, the max that can be represented is 999. So the 9’s complement of 234 is here indeed 999 - 234 = 765.

3
Vatine On

In 9-complement representation, the digit sequence used to represent the positive integer 2*10**2 + 3*10 + 4 is "234". The digit sequence to represent -1 * 2*10**2 + 3*10 + 4 is 999 - 234, which is "765".

So, after a fashion, the 9-complement of 234 is indeed "234".