The Student Room Group

Binary Two's Complement Conversion

In Computing, if we have some number (let's say 23) represented as binary (010111) and we want to convert this to a two's complement we can read it from right to left, leaving every bit up to the first 1 then inverting all bits.

So -23 would be 101001

For those who do not know how two's complement works the first bit in this pattern is considered as negative then the value of every bit after this is added on. So for this example we would have -32+8+1 = -23

My question is WHY does this inversion work?

I tried reasoning this by considering a similar scenario in base 10 but I am not quite comfortable enough converting between bases (or even that comfortable with base two) to solve my issue.
Original post by Mav1
...


This wiki article may be of some use. It's rather lengthy, and has a small section in the middle on "why".

Quick Reply

Latest