← ProblemsCircuits / Combinational Logic / Arithmetic Circuits

Signed addition overflow

15%arithmeticvectors

Treat a and b as 8-bit 2's-complement (signed) numbers. Compute their sum s = a + b and also detect signed overflow — the case where the true result doesn't fit in 8 bits.

Overflow can only happen when both operands have the same sign: two positives whose sum looks negative, or two negatives whose sum looks positive. Adding numbers of opposite signs can never overflow.