Tokens spill over the edge of a numeric storage tray.

Overflow definition

Overflow occurs when a numerical result exceeds the range available in its representation.

In Spanish
desbordamiento
Topic
Number bases and digital representations

Overflow in a picture

Overflow diagramAn unsigned eight-bit integer can represent 0 through 255, so 255 + 1 is outside that range.Maximum unsigned value: 255The format has eight bitsExact sum: 255 + 1 = 256This requires a ninth bitThe result exceeds the formatHandling depends on the arithmetic system
An unsigned eight-bit integer can represent 0 through 255, so 255 + 1 is outside that range.

How it works

In floating-point arithmetic, an exact result may have magnitude too large for the format’s finite range. The returned value can be infinity or a largest finite value depending on rounding behavior. Fixed-width integer systems can instead wrap, report an error, or clamp the result according to their rules.

Worked examples

Can 100 + 40 fit in an unsigned eight-bit integer?

Yes, because 140 is below 256.

What happens to 256 in arithmetic that wraps modulo 256?

It wraps to 0.

Can a very large negative result overflow a signed format?

Yes, if it falls below the minimum representable value.

Common mistake

Separate overflow from rounding a value inside the range. Overflow concerns the range of available values.

Quick check

Which exact value is outside the range of an unsigned eight-bit integer?

Is the result always infinity?

Show answer

No. It depends on the representation and arithmetic rules.

What sets the finite range of a floating-point format?

Show answer

Its available significands and exponents.

Sources

Flashcard

Overflow

Reveal the definition

Overflow occurs when a numerical result exceeds the range available in its representation.

Effortless Math. “Overflow.” Math Dictionary.