Can I write that the two's compliment of an 8-bit binary number,$\displaystyle n$ is:

$\displaystyle -n=\bar{n}+1$ ?

Or is that simply wrong notation? Is there a correct way of showing this?

Printable View

- Nov 14th 2010, 06:48 AMJodlesRepresenting two's compliment
Can I write that the two's compliment of an 8-bit binary number,$\displaystyle n$ is:

$\displaystyle -n=\bar{n}+1$ ?

Or is that simply wrong notation? Is there a correct way of showing this? - Nov 14th 2010, 08:41 AMchisigma
Let $\displaystyle n$ a numer represented by $\displaystyle N$ bits and suppose to indicate with $\displaystyle \bar{n}$ the numer obtained by $\displaystyle n$ complementing each of its bit. Is...

$\displaystyle n+\bar{n}= 2^{N}-1 \implies \bar{n} +1 = (2^{N} - n)\ mod(2^{N})= -n$ (1)

... so that Your notation is correct...

Kind regards

$\displaystyle \chi$ $\displaystyle \sigma$