HP-UX Floating-Point Guide

Chapter 3 79
Factors that Affect the Results of Floating-Point Computations
Other System-Related Factors that Affect Application Results
of this, the parsing of a floating-point constant might change if the exact
value of the constant lies extremely close to the halfway point between
two representable values.
The compiler usually performs compile-time expression evaluation,
which is commonly referred to as constant folding. A statement like
X = 1.1/10.0E1 + 5.0E-1
will probably be compiled as
X = 0.511
but, because an extra division and addition took place, each contributing
some rounding error, the result may not be bit-for-bit identical in all
cases.
NOTE Floating-point constants without suffixes (1.1, for example) are
evaluated differently in Fortran 90 and FORTRAN 77. FORTRAN 77
evaluates them in double precision, while Fortran 90 evaluates them in
single precision. This can lead to slight differences in the resulting
constant value.
The zeal with which the compiler pursues opportunities for constant
folding may vary from one compiler release to another and may depend
on the optimization level and other compiler options. In general, lower
optimization levels produce more repeatable results.
New versions of compilers often incorporate improved constant folders
and optimizers that compile applications into more efficient sequences of
operations. However, as we have shown, different sequences of
operations produce different results, even though the new sequence is
mathematically equivalent to the old.
Compiler Options
A compiler typically has several options that affect the sophistication of
the optimization algorithms used. As these compiler options change, the
final sequence of operations produced by the compiler changes.
HP-UX compilers by default do not reorder floating-point operations,
even at high optimization levels. The order of operations is the same as
the order your program specifies. If, however, you want to allow the
compiler to reorder floating-point operations so as to improve
performance, even at the expense of possible small differences in results,
specify the +Onofltacc option.