Arithmetic underflow
Encyclopedia
The term arithmetic underflow (or "floating point
Floating point
In computing, floating point describes a method of representing real numbers in a way that can support a wide range of values. Numbers are, in general, represented approximately to a fixed number of significant digits and scaled using an exponent. The base for the scaling is normally 2, 10 or 16...

 underflow", or just "underflow")
is a condition in a computer program
Computer program
A computer program is a sequence of instructions written to perform a specified task with a computer. A computer requires programs to function, typically executing the program's instructions in a central processor. The program has an executable form that the computer can use directly to execute...

 that can occur when the true result of a
floating point operation is smaller in magnitude
Magnitude (mathematics)
The magnitude of an object in mathematics is its size: a property by which it can be compared as larger or smaller than other objects of the same kind; in technical terms, an ordering of the class of objects to which it belongs....

 (that is, closer to zero)
than the smallest value representable as a normal
Normal number (computing)
In computing, a normal number is a non-zero number in a floating-point representation which is within the balanced range supported by a given floating-point format....

 floating point number in the target datatype.
Underflow can in part be regarded as negative overflow
Arithmetic overflow
The term arithmetic overflow or simply overflow has the following meanings.# In a computer, the condition that occurs when a calculation produces a result that is greater in magnitude than that which a given register or storage location can store or represent.# In a computer, the amount by which a...

 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 absolute value less than 2−127 may cause underflow (assuming that
the exponent −128 is reserved for values like −∞ which have no "normal" representation).

The underflow gap

The interval between −fminN and fminN, where
fminN is the smallest positive normal floating point value, is called the underflow gap.
This is because the size of this interval is many orders of magnitude larger than the distance between
adjacent normal floating point values just outside of the gap. For instance, if the floating
point datatype can represent 20 binary digits, the underflow gap is 221 times
larger than the absolute distance between adjacent floating point values just outside of the gap.

In older designs, the underflow gap had just one usable value, zero. When an underflow occurred,
the true result was replaced by zero (either directly by the hardware, or by system software
handling the primary underflow condition). This replacement is called flush to zero (on underflow).

The 1984 edition of IEEE 754 introduced subnormal numbers. The subnormal numbers (including zero) fill the
underflow gap with values where the absolute distance between adjacent values is the same as
for adjacent values just outside of the underflow gap. This enables gradual underflow where
a (nearest) subnormal value is used, just as a nearest normal value is used when possible.
Note that even when using gradual underflow, the nearest value may be zero.

Handling of underflow

The occurrence of an underflow may set a ('sticky') status bit, raise an exception, at the hardware
level generate an interrupt, or may cause some combination of these effects.

As specified in IEEE 754 the underflow condition is only signaled if there is also a loss of precision.
Typically this is determined as the final result being inexact.
However if the user is trapping
Trap (computing)
In computing and operating systems, a trap, also known as an exception or a fault, is typicallyThere is a wide variation in the nomenclature...

 on underflow,
this may happen regardless of consideration for loss of precision.
The default handling in IEEE 754 for underflow (as well as other exceptions) is to record
as a floating point status that underflow has occurred. This is specified for the application
programming level, but often also interpreted as how to handle it at the hardware level.

See also

  • IEEE 754
  • −0 (number)
  • Subnormal numbers
  • Normal number (computing)
    Normal number (computing)
    In computing, a normal number is a non-zero number in a floating-point representation which is within the balanced range supported by a given floating-point format....

  • Arithmetic overflow
    Arithmetic overflow
    The term arithmetic overflow or simply overflow has the following meanings.# In a computer, the condition that occurs when a calculation produces a result that is greater in magnitude than that which a given register or storage location can store or represent.# In a computer, the amount by which a...

  • Integer overflow
    Integer overflow
    In computer programming, an integer overflow occurs when an arithmetic operation attempts to create a numeric value that is too large to be represented within the available storage space. For instance, adding 1 to the largest value that can be represented constitutes an integer overflow...

  • Logarithmic Number System
    Logarithmic Number System
    A logarithmic number system is an arithmetic system used for representing real numbers in computer and digital hardware, especially for digital signal processing.-Theory:...

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK