Cambridge O Level Computer Science · Syllabus 2210 · Data Representation
Overflow
What is Overflow?
An overflow error occurs when the result of a calculation is outside the range a fixed-width register can represent, for example a value above 255 in an 8-bit unsigned register, so the correct result cannot be stored or returned.
This definition is part of the Data Representation chapter in Cambridge O Level Computer Science.
Overflow in context
A computer or device has a predefined limit on the size of value it can represent or store — a register of a fixed width, for example 8 bits or 16 bits. An overflow error occurs when a calculation produces a value outside that limit, so the correct result cannot be returned. In an 8-bit unsigned register the representable range is 0 to 255, so an overflow error occurs if the result of an addition is greater than 255: the correct answer needs a ninth bit, and there is no ninth bit to put it in.
Common mistakes with Overflow
- 2. Calling every carry an overflow. Why it fails Carries happen inside almost every binary addition and are completely normal. An overflow error is different: the correct answer is too large for the register to hold. Fix Only the carry out of the leftmost column of an 8-bit unsigned addition signals overflow. See section 1.1 F.
- M4. "Any carry means overflow." Why it fails Carries occur inside almost every binary addition and are ordinary arithmetic. Only a carry out of the leftmost column of the register signals a problem. Correct model Overflow means the correct result lies outside the register's range, not that a column overflowed into the next one. Exam-safe "A carry between columns is normal; an overflow error occurs only when the result is outside the range the register can represent." Test yourselfHideQ. 90 + 45 in an 8-bit register produces four carries. Is that an overflow?A. No — the total 135 is not greater than 255, so it fits.
Questions students ask about Overflow
What is an overflow error, and when does it occur in an 8-bit register?
An overflow error occurs when a calculation produces a value outside the range a fixed-width register can represent, so the correct result cannot be stored or returned. An 8-bit unsigned register can hold values from 0 to 255; if an addition produces a result greater than 255, the correct answer needs a ninth bit, and there is no ninth bit to put it in, so overflow occurs. A carry between columns during addition is normal and is not, by itself, overflow.

