HP-UX Floating-Point Guide
222 Appendix C
Floating-Point Problem Checklist
Incorrect or Imprecise Results
For more information, see “How Basic Operations Affect Application
Results” on page 71 and “Testing Floating-Point Values for Equality”
on page 84.
• Does your application take the difference of floating-point values that
are similar in magnitude? Such subtraction can result in the loss of
many significant digits.
For more information, see “Taking the Difference of Similar Values”
on page 87.
• Conversely, does your application add values that are very different
in magnitude? Such addition can also result in the loss of many
significant digits.
For more information, see “Adding Values with Very Different
Magnitudes” on page 88.
• Does your application underflow? An unintentional underflow during
a calculation can result in the loss of many significant digits.
For more information, see “Unintentional Underflow” on page 91.
• Does your application truncate floating-point values to integer? In C
and Fortran, assigning a floating-point value to an integer variable
causes the value to be truncated, not rounded to the nearest integer.
For more information, see “Truncation to an Integer Value” on
page 92.
• Does your application contain ill-conditioned computations—those
that use arguments near a function’s singularity, where small
differences in input produce results so different that the results are
meaningless?
For more information, see “Ill-Conditioned Computations” on page 94.
• (Fortran only) Are you computing in double or quad precision, but
have one or more undeclared variables, which in Fortran default to
single precision?
For more information, see the HP FORTRAN/9000 Programmer’s
Reference.
• Does your program call functions in the fenv(5) suite of routines, and
did you compile it at an optimization level greater than +O0? If so,
operation reordering around the function calls may have unexpected
effects.