Integer Overflow/Underflow and Floating Point Imprecision.

How memory restrictions in computers can lead to serious side effects.

Odometer Rollover, a mechanical analog of integer overflow.
  • 8 bits: maximum representable value 28 − 1 = 255
  • 16 bits: maximum representable value 216 − 1 = 65,535
  • 32 bits: maximum representable value 232 − 1 = 4,294,967,295 (the most common width for personal computers as of 2005),
  • 64 bits: maximum representable value 264 − 1 = 18,446,744,073,709,551,615 (the most common width for personal computer CPUs, as of 2017),
  • 128 bits: maximum representable value 2128 − 1 = 340,282,366,920,938,463,463,374,607,431,768,211,455
Maximum storable values for different data types.

Floating Point Arithmetic Imprecision:

  • The binary representation of the decimal number may not be exact.
  • There is a type mismatch between the numbers used (for example, mixing float and double).

Examples:

  • Ariane 5: On 4 June 1996, the first Ariane 5 rocket, manufactured by the European Space Agency(ESA), malfunctioned and consequently self-destructed 37 seconds after launch. The resulting $370m loss was primarily due to control software failure. Much of the software for Ariane 5 was originally written for its predecessor, the Ariane 4. The older software was unable to handle the unexpectedly high readings for the sideways velocity of the newer, faster vehicle. The resulting integer overflow lead to software malfunction which was the reason for initiating the self-destruct sequence on the rocket.
Ariane 5 Rocket
  • Patriot Missile Imprecision: The US Army used the Patriot Missile systems during the Gulf War in Saudi Arabia to track and intercept incoming Iraqi Scud missiles. On February 25, 1991, an American Patriot Missile battery in Dhahran, Saudi Arabia, dropped the track on an incoming scud. Failure to intercept led to the missile directly striking an US Army barracks resulting in 28 deaths. The reason for failure to launch missiles as counter-measure was related to a bug in the software of the Patriot system.
Patriot Missile System
  • Gangnam Style breaks YouTube: Before December, 2014, YouTube had programmed their view counter using a 32-bit memory system which stored signed integers. The maximum value recordable on the counter was, therefore, 2,147,483,647. However, the music video for South Korean singer Psy’s Gangnam Style exceeded YouTube’s view limit, prompting the site to upgrade its counter.
Gangnam Style View Count
  • Civilization Gandhi Bug: In the first installment of the popular turn base video game series Civilization, each leader in the game was assigned a numeric value, greater that zero, to attribute their various characteristics. Gandhi was assigned an “aggressiveness” score of 1 by default. If the player/AI adopted democracy as the ideology for any civilization, the aggressiveness score would drop by 2 for the leader of that civilization. This score, which was already at 1 for Gandhi, would become negative on adopting democracy.
Gandhi in Civilization I
  • Millennium Bug/Y2K Bug: Until the 1990s, many computer programs stored the four-digit year in an abbreviated format consisting of the last two-digits of the year, primarily for saving memory. So the year 1999 was represented on these computers as ‘99’. The next year would be represented as 00 and could possibly be interpreted by the computers as 1900 instead of 2000.
An electronic sign displaying the year incorrectly as 1900 on 3 January 2000 in France
  1. webappsec.org-Integer Overflows
  2. utexas.edu-Integer Overflows
  3. open-std-C99 Specification
  4. microsoft.com-Floating-Point Imprecision.
  5. math.unm-Some disasters attributable to bad numerical computing.
  6. math.unm-The Patriot Missile failure.
  7. Wikipedia-Year 2000 problem.
  8. Furman.edu-Risks in Numeric Computing.
  9. Britannica-The Y2K Bug/The Millennium Bug.
  10. BBC Future-The number glitch that can lead to catastrophe.
  11. archive.org-Patriot Missile Failure Report

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store