Arithmetic underflow

The term arithmetic underflow (also floating point underflow, or just underflow) is a condition in a computer program where the result of a calculation is a number of more precise absolute value than the computer can actually represent in memory on its central processing unit (CPU).

Arithmetic underflow can occur when the true result of a floating point operation is smaller in magnitude (that is, closer to zero) than the smallest value representable as a normal floating point number in the target datatype.[1] Underflow can in part be regarded as negative overflow of the exponent of the floating point value. For example, if the exponent part can represent values from −128 to 127, then a result with a value less than −128 may cause underflow.

For integers, the term "integer underflow" typically refers to a special kind of integer overflow or integer wraparound condition whereby the result of subtraction would result in a value less than the minimum allowed for a given integer type, i.e. the ideal result was closer to negative infinity than the output type's representable value closest to negative infinity.[2][3][4][5][6]

  1. ^ Coonen, Jerome T (1980). "An implementation guide to a proposed standard for floating-point arithmetic". Computer. 13 (1): 68–79. doi:10.1109/mc.1980.1653344. S2CID 206445847.
  2. ^ "CWE - CWE-191: Integer Underflow (Wrap or Wraparound) (3.1)". cwe.mitre.org.
  3. ^ "Overflow And Underflow of Data Types in Java - DZone Java". dzone.com.
  4. ^ Mir, Tabish (4 April 2017). "Integer Overflow/Underflow and Floating Point Imprecision". medium.com.
  5. ^ "Integer underflow and buffer overflow processing MP4 metadata in libstagefright". Mozilla.
  6. ^ "Avoiding Buffer Overflows and Underflows". developer.apple.com.