Overflow Errors - When Numbers Get Too Big

Test yourself on Binary Arithmetic with exam style questions, marked instantly.

Flashcards that come back just before you would forget them.

A revision plan that remembers what you know and shows what to do next.

See which topics you have nailed and which need another look.

Quiz yourself on Binary ArithmeticGet your flashcardsBuild my revision planTrack my progress

Overflow Errors - When Numbers Get Too Big

What is Overflow?

When the result of a calculation is too large to fit in the available number of bits, an overflow error occurs. The extra bits are lost!

Example: 8-bit Overflow

  8-bit can store: 0 to 255 (00000000 to 11111111)
  
  What happens if we add 200 + 100?
  
    11001000  (200)
  + 01100100  (100)
  ----------
   ¹¹¹¹¹¹¹   ← carries
  1 00101100  (This would be 300, but...)
  ↑
  This 9th bit doesn't fit in 8 bits!
  
  Computer sees: 00101100 = 44 (WRONG!)
  
  Overflow error! The carry out of the MSB is lost.
  

Detecting Overflow:

  • Unsigned binary: Overflow if carry out of the MSB
  • Real-world: Games showing "99999" max score, counters wrapping around
  • Example: Pac-Man kill screen at level 256 (8-bit overflow: 255+1 = 0)

Make this stick

Signing in gives access to all PrepWise features.

PrepWise is a trading name of A3M Quality Solutions Limited, registered in England and Wales, company number 14959172. Registered office: 202 Stroud Road, Gloucester, GL1 5LA. ICO registration ZC267069.