Reputation: 33
"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?
Upvotes: 0
Views: 1169
Reputation: 21238
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".
Upvotes: 0
Reputation: 15217
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.
Upvotes: 0