HP-UX Floating-Point Guide
Chapter 2 57
Floating-Point Principles and the IEEE Standard for Binary Floating-Point Arithmetic
Exception Conditions
If overflow traps are disabled, the result of a floating-point operation
that overflows is assigned either an infinity code or the closest
representable number (this will be either the largest positive value or
the largest-magnitude negative value). The choice of whether to use
infinity or the nearest representable value depends on the rounding
mode, as shown in Table 2-11. If overflow traps are disabled, the system
generates an inexact result condition in addition to the overflow
condition.
Table 2-11 Overflow Results Based on Rounding Mode
Underflow Conditions
An underflow condition may occur when a floating-point operation
attempts to produce a result that is smaller in magnitude than the
smallest normalized value. The standard allows the vendor of the
floating-point system to choose whether an underflow condition is
detected before or after rounding. On HP 9000 systems, underflow
conditions generally are detected before rounding. Consequently, an
operation that underflows can produce a minimum-magnitude
normalized value, a denormalized value, or zero.
According to the standard, an underflow condition may be signaled only
if it produces an inexact result, because it is possible that the result will
be exact even though it is denormalized (for example, 2
−1040
). In this
case, there is no reason to signal an exception.
When an underflow condition does produce an inexact result, it is often
difficult to determine whether the inaccuracy occurs because the value is
denormalized or whether the loss of accuracy is inherent in the operation
being performed. For the sake of efficiency, the standard allows the
implementor to decide how to define loss of accuracy for underflow
Rounding Mode
Round To
Nearest
Round Toward
+Infinity
Round Toward
−Infinity
Round Toward
Zero
Positive
Result
+Infinity +Infinity Largest-magnitude
positive value
Largest-magnitude
positive value
Negative
Result
−Infinity Largest-magnitude
negative value
−Infinity Largest-magnitude
negative value