2
$\begingroup$

I'm solving the end of the chapter problems of Morris Mano's Digital Design (4th Edition, if that's relevant). In one of the problems, it is asked to simply find the 1's and 2's complement of 00000000. It's 1's complement would be 11111111. Now, for 2's complement, adding 1 to will give 100000000. But in the answer key, the answer is 00000000.

I know that if i'm working with a hardware that is only capable of handling 8 bits, the 1 will not be stored. But, in theory, the 2's complement of 00000000 should be 100000000, right? Or is there something i missed? In the question there was no mention of hardware limitations, or even something like "use only 8 bits".

$\endgroup$
  • $\begingroup$ Two's complement is a form of modular arithmetic, numbers have a limited range (en.wikipedia.org/wiki/Modular_arithmetic). -0 is like "what time was it exactly one day ago ?" $\endgroup$ – TEMLIB Jun 16 '18 at 0:47
1
$\begingroup$

You have 00000000 as the number, it implies how many bits are used. The 1 at the front comes from carry bit, but two complements does not extend number of bits used, so the answer is 00000000, as the carry is discarded because it doesn't fit given space.

You can check it (to convince yourself) by converting code back from 2's complement to decimal. 00000000 yields 0, while 100000000 gives -256.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.