Converting from binary to RC(Radix Complement - Two's complement) and back from RC to binary

69 Views Asked by At

Assume we have a negative number X.
To convert X from binary to Radix Complement we perform two's complement (Complement on the digits) + 1.
Now to convert X from Radix Complement we can perform two's complement again to get back to binary.

For example : $$(5)_{10} = (00101)_{2}$$ $$(-5)_{10} = (\overline{(00101)} +1)_{2} = (11010 + 1) = (11011)_{RC}$$

Now let's go back : $$(11011)_{RC} = (\overline{(11011)} + 1) = (00100 + 1) = (00101) = (5)_{10}$$

But now lets try to write this as identity : $$ X = \overline{(\overline{X} + 1)} + 1 = (\overline{\overline{X}} * 0) + 1 = (X * 0) + 1 = 0 + 1 = 1 \neq X $$

Am I comparing apples and oranges ?
Where is my mistake ?

1

There are 1 best solutions below

1
On BEST ANSWER

Your mistake stems from treating the "$+1$" operation as both an addition operation (when you performed Two's Complement), and as an OR operation with the constant $1$ (when you tried to write an identity).

The operations are non-equivalent, here's an example:

$$(00101)_2 + 1 = (00110)_2 \neq (00101)_2 \vee 1 = (00101)_2$$