CT Textbook Site
  

Signed Numbers

Understanding Two's Complement Representation

This 4-bit binary counter demos the two's complement notation for signed numbers. The 24 = 16 numbers are 0 to 7, -8 to -1.

Click on any position to add 1 to that position. Shift+click on any position to subtract 1 from that position.

As you count up/down repeatedly, you'll see how it carries to or borrows from the next position. As you experiment, the number cycles through negative, 0, and positive values. There is no overflow or underflow.

counter


Challenges

  • Predict the new bit pattern before clicking or shift-clicking.
  • Verify the total against the bit pattern.
  • Try to cause underflow or overflow. Can you?