how to find 6-bit 2’s complement representation of -32

3.5k views Asked by At

I am a new rookie in computer engineering, not sure how to get the 2's complement representation of -32 in 6-bits, because -32 is reaching limit.

1

There are 1 answers

0
Derlin On

For 2's complement, the easiest method is this one:

  • write the positive value (here 32) in binary form
  • begin to read from the right, and skip all the zeroes until you find the first 1
  • leave the one as it is
  • keep going left, this time inversing each number (1 => 0, 0 => 1)

Example: -7. 7 is 000111. The first 1 is on the right, keep it then inverse the rest. You get 111001.

So in your example, you can't represent -32 with six bits, since the first one is also the last one. Si it will be read 100000 => -011111 => 31.

You need at least one more bite to avoid overflow (the last bite on the left being the "sign": 0 for positive, 1 for negative).