Two's complement in 5 minutes
My quick notes:
- To negate a number: flip every bit, then add 1.
- The leftmost bit tells you the sign (1 = negative).
- The range for n bits is -2^(n-1) to 2^(n-1) - 1.
- Overflow happens when adding two numbers of the same sign gives a result of the opposite sign.
- Sign extension: copy the sign bit to the left to widen a number without changing its value.
Comments
No comments yet. Start the conversation.