Integer Overflow

Integer overflow occurs in computers, when the number which is stored becomes larger than the capacity of the memory it is stored in.

The most likely result is that the number will reset to 0 and start over.

Integer Overflow
A mechanical form of integer overflow. All digits are set to the maximum 9, and adding 1 causes it to reset to 0.

For example, start with the number 14, using 4-bits integers. Add 1 a few times, this will result in an overflow, which causes it to reset the number to 0.

Binary number Decimal number
1110 14
1111 15
0000 0
0001 1

Another result is the number will reset to the most negative number, if the number has a sign. This is because negative numbers are represented by values after the maximum positive value.

For example, with signed 4-bit integers. Adding 1 will cause this type of overflow:

Binary number Decimal number
0110 6
0111 7
1000 -8
1001 -7

References


Tags:

🔥 Trending searches on Wiki Simple English:

Peter CrouchList of political ideologiesStanley Cup playoffsZayn MalikTansenGuitarEdward VIIIGodzilla (2014 movie)List of nearest galaxiesFalconNephew and nieceTromboneM. R. RadhaSaxophone2018 UEFA Champions League FinalPrimary colorConstitutional republicList of largest starsJeanne CalmentPan American World AirwaysFerruccio LamborghiniLord's PrayerRonaldinho8 (number)Roberto BaggioVaginaSausage PartyApril 30GreecePlumFamily nameFacebookJohn F. Kennedy Jr.BasketballCricketSchrödinger's catValmiki1 (number)OdinSimo HäyhäList of fruitsIan RushBarack ObamaList of Roman emperorsMadridMS DhoniRRR (movie)List of Prime Ministers of the United KingdomAsatruCarom billiardsLauren BlakeCounty (United States)Christogram IHSGolden TempleCitronBill KaulitzM. S. SubbulakshmiList of world snooker championsList of U.S. states and territories by time zoneAlan RickmanList of U.S. state capitalsEdge (wrestler)IstanbulPlayStation 4The Day the Music DiedList of U.S. states and territories by areaPotatoFellatioGuru Nanak DevPhysicsCarlton Gebbia21st centuryRohit SharmaTom BosleyElton JohnSchoolPriyanka ChopraLogic gate🡆 More