Signed, unsigned and overflow on 8 bits
The same 8 bits can be interpreted in different ways. As unsigned they represent values from 0 to 255; as signed two's-complement they represent values from −128 to +127.
The fundamental rule
With 8 bits there are only 256 possible patterns. When an operation produces a value outside the available range, the hardware keeps the 8 least significant bits. This is wrapping. overflow indicates that the mathematical result cannot be represented in the selected format.
11111111 is 255 unsigned, but the same bits represent −1 signed.
Three cases to know
Signed: 127 + 1 = 128, but 128 cannot be represented using 8 signed bits. The resulting bits are 10000000, interpreted as -128 → overflow.
Unsigned: 255 + 1 = 256. Keeping 8 bits gives 00000000 = 0 → overflow.
Signed: −128 − 1 = −129. Keeping 8 bits gives 01111111, which represents 127 → overflow.
Practice
Mode: Guided · Attempts: 0/5 · Correct: 0
Calculate using 8 bit unsigned:
250 + 20
Range: 0…255. The mathematical result is 270. If it leaves the range, keep only the 8 least significant bits: 00001110.
Bridge to IEEE 754
Here you saw that a fixed number of bits imposes a range and that bit patterns must be interpreted according to a convention. IEEE 754 applies the same principle to floating-point numbers by dividing the bits into sign, exponent and fraction.