Two’s Complement Overflow
Consider two 8-bit 2’s complement numbers. I can represent the signed integers -128 to +127 using this representation.What if I do (+1) + (+127) = +128. The number +128 is OUT of the RANGE that I can represent with 8 bits. What happens when I do the binary addition?
+ +1 = $ 01------------------- 128 /= $80 (this is actually -128 as a twos complement number!!! - the wrong answer!!!)How do I know if overflowed occurred? Added two POSITIVE numbers, and got a NEGATIVE result.