Examples of Binary Integers
Example 1: Overflowing Complement Systems
Incorrect example with overflow:
equals
in a 6-bit 2’s complement system (leftmost bit as sign), which has possible values ( to ). This is incorrect because the leading bit in the result signals negation, but is not negative. There was an overflow error.
Example 2:
in 2’s complement with flip and increment steps:
Adding a 5-bit 2’s complement number to a 3-bit 2’s comp number
How to actually add numbers represented by different bit complements:
- move leading bit (sign) to match with larger
- fill spaces with ones (negative) and zeroes (for positive)
- (sign extension)