bit overflows

1s-complement

Only 2 conditions: positive + positive = negative -> bit overflow negative + negative = positive -> bit overflow

For: positive + negative -> won’t ever overflow In the worst case: max_positive + max_negative = max_positive + 0 = max_positive

The magnitude range: 0 <= positive + negative <= max_positive

2s-complement

Same as 1s-complement

Examples

A = -7 = 1001 B = -6 = 1010

result = -13 = 1 0011

It is clear that there is overflow here.