From the course: Computer Science Principles: Digital Information

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Overflow

Overflow

From the course: Computer Science Principles: Digital Information

Start my 1-month free trial

Overflow

- When the computer sets aside a specific amount of memory to store a value, it does so based on the number of bytes that are required. As more and more values need to be stored, more reservations are made in memory. So what happens when we run out of room to store value? We have a situation called overflow. Let's an 8-bit value. In this number we have eight bits to store a value. We keep flipping the bits to add more and more to the value that can be stored. But then we hit a situation where we have to add a ninth bit to the value. But since the amount of space reserved won't fit that, we get an overflow. Some overflows happen and you get an error. Like when you take a calculator and you try to get a number larger than the digits that can be displayed on the screen. But sometimes there is no error and what you get is something weird. What can happen is that the computer just throws away any digits beyond eight. So if I get a number like 255 and I add one to it, instead of getting…

Contents