HP-UX Floating-Point Guide
72 Chapter 3
Factors that Affect the Results of Floating-Point Computations
How Basic Operations Affect Application Results
This example also demonstrates a guiding principle of floating-point
programming:
Be very careful about testing two floating-point values or expressions for
exact equality or inequality.
This principle derives from the fact that two given floating-point values
are almost never equal, even when the programmer might expect them
to be equal from a purely mathematical standpoint. The inequality
occurs because of the rounding errors incurred during the calculation of
the two values being compared.
For further discussion of this issue, see “Testing Floating-Point Values
for Equality” on page 84.