HP-UX Floating-Point Guide
Chapter 7 183
Performance Tuning
Denormalized Operands
Of course, changing the denormalized value to zero can affect the
accuracy of the algorithm. You need to determine whether this change
will affect the usefulness of your program’s output.
The third solution is to use flush-to-zero mode. If your target execution
system supports flush-to-zero mode, you have the option of disabling
gradual (that is, IEEE-754-compliant) underflow. To do so, use the +FPD
compiler and linker option or the fesetflushtozero function. (The
fesetflushtozero function always executes successfully. However, on
system types that do not support fast underflow, the call has no effect.)
These methods are described in Chapter 5. Running the sample program
in “Underflow Mode: fegetflushtozero and fesetflushtozero” on page 145
will tell you whether your system supports fast underflow.
Using flush-to-zero mode can have the same effect on the accuracy of
your algorithm as changing a value to zero, so use the same caution.
The final way to avoid denormalized numbers is to scale your entire
algorithm upwards in magnitude. The exact way in which you do this
depends on your algorithm because the results of most expressions do
not scale up linearly as their operands are scaled. This method is more of
a general way to rethink your overall algorithm than a way to fix the
specific problem of denormalized values.