Skip to main content
added 4 characters in body; edited tags; edited title
Source Link
Raphael
  • 72.9k
  • 30
  • 181
  • 393

Why is mydo I not get the correct smallest possible value in 2's complement conversion incorrect?

If I only hadWhen using 2's complement with 4 bits available, the largest positive int I can represent is 0111. The smallest negative one is 1000.

The smallest int should intuitively be the negative of 0111 - 1 = 0110 since we can represent one more positive than negative int.

If we invert the bits of 0110 and then add 1, however, we get 1010, which differs from 1000. What am I doing wrong? D:

Why is my 2's complement conversion incorrect?

If I only had 4 bits available, the largest positive int I can represent is 0111. The smallest negative one is 1000.

The smallest int should intuitively be the negative of 0111 - 1 = 0110 since we can represent one more positive than negative int.

If we invert the bits of 0110 and then add 1, however, we get 1010, which differs from 1000. What am I doing wrong? D:

Why do I not get the correct smallest possible value in 2's complement?

When using 2's complement with 4 bits, the largest positive int I can represent is 0111. The smallest negative one is 1000.

The smallest int should intuitively be the negative of 0111 - 1 = 0110 since we can represent one more positive than negative int.

If we invert the bits of 0110 and then add 1, however, we get 1010, which differs from 1000. What am I doing wrong?

Source Link

Why is my 2's complement conversion incorrect?

If I only had 4 bits available, the largest positive int I can represent is 0111. The smallest negative one is 1000.

The smallest int should intuitively be the negative of 0111 - 1 = 0110 since we can represent one more positive than negative int.

If we invert the bits of 0110 and then add 1, however, we get 1010, which differs from 1000. What am I doing wrong? D: