0

"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?

Jim
  • 33
  • 7

2 Answers2

0

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.

Reinhard Männer
  • 14,022
  • 5
  • 54
  • 116
0

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".

Vatine
  • 20,782
  • 4
  • 54
  • 70
  • Ha! Very interesting! I thought (see my answer) that _The nines' complement of a number given in decimal representation is formed by replacing each digit with nine minus that digit_, see [here](https://en.wikipedia.org/wiki/Method_of_complements). How did you come to your result? – Reinhard Männer Oct 14 '21 at 16:50
  • @ReinhardMänner It really depends on how you interpret the text. I interpreted as "in 9-complement representation, a positive integer is expressed as itself", whereas you seem to have interpreted it as "form the 9-complement of an integer". Both are valid, but only one has ANYTHING represented as itself. – Vatine Oct 15 '21 at 07:57
  • Thanks for letting me know! – Reinhard Männer Oct 15 '21 at 15:00