HP-UX Floating-Point Guide
56 Chapter 2
Floating-Point Principles and the IEEE Standard for Binary Floating-Point Arithmetic
Exception Conditions
These routines are designed to run in the default rounding mode, round
to nearest. Changing the rounding mode may cause library routines to
yield results with more rounding errors in unpredictable directions.
Be careful if you change the rounding mode in the middle of your
program when you are optimizing your code. Some optimizations change
the order of operations in a program, and the compiler may place the
change in rounding mode after the operations it is intended to affect.
Overflow Conditions
An overflow condition occurs whenever a floating-point operation
attempts to produce a result whose magnitude is greater than the
maximum representable value. Table 2-10 shows approximate maximum
values for floating-point numbers on HP 9000 systems. For example, an
attempt to represent the value 10
400
would produce an overflow
condition in single-precision and double-precision, but not in
quad-precision.
NOTE Out-of-range conditions that occur during conversions from
floating-point to integer format are discussed in “Invalid Operation
Conditions” on page 58.
Table 2-10 Approximate Maximum Representable Floating-Point Values
Several actions are possible when an overflow occurs, depending on
whether overflow traps are enabled or disabled. (By default, traps are
disabled.) If overflow traps are enabled, the system signals a
floating-point exception (SIGFPE). Then, if the program provides a trap
handler, the system takes whatever action is dictated by the trap
handler. If the program does not provide a trap handler, the SIGFPE
exception will cause the program to terminate.
Largest Negative
Value
Largest Positive
Value
Single-Precision −3.4E38 3.4E38
Double-Precision −1.7E308 1.7E308
Quad-Precision −1.2E4932 1.2E4932