- #1

- 43

- 0

I'm working on some one's and two's complement questions and with the help of Wikipedia, am trying to understand it. However, I am quite confused as I seem to be getting wrong answers sometimes, thus I have come here for some clarification ;)

Take the following sum:

3694

__2468__-

1226

Using nine's complement one would perform the following calculations:

9-2 = 7

9-4 = 5

9-6 = 3

9-8 = 1

then, I would perform the following calculation:

3694

7531

_____1__+

11226

and then drop the 1.

That would result in 1226 being the answer which is correct. Now, that was nine's complement, and from further reading it states that ten's complement is nine's complement + 1...so I am assuming they don't mean +1 to 1226, but +1 during the calculation like what I did above. So why is it called ten's complement if it does not affect how I perform the calculation? If I were working in hexadecimals perhaps this would make sense to me, but I am working in decimal so why work out the ten's complement if you have worked out the nine's complement? Not just this, but why would I even go through the entire process if the answer was uncovered in the first step (I worked out 1226 on the 9th line of this post).

Next, moving onto binary, say I wish to perform the following calculation:

47 - 28 = 19

which in binary is 101111 - 11100 (I think)

Using one's complement, I would do the following:

101111

__011100__-

110001

and then performing the one's complement act:

1-0 = 1

1-1 = 0

1-1 = 0

1-1 = 0

1-0 = 1

1-0 = 1

and then:

101111

__100011__+

101100

__111110__+

110010

but as far as I know, 19 in binary is 10011.

Thus, my answer is wrong, and I have no idea why

If you can explain these complement arithmetic problems to me I will be very grateful!

Thanks for any help