** Correctness of Optimization**

Optimization must never introduce compiler-generated errors! A program that runs faster but produces incorrect results is not an improvement.

There are often cases where an optimization will * nearly always*
be correct.

if ( x * n == y * n ) ...might be optimized to:

if ( x == y ) ...Is this correct?

In general, one must be able to * prove* that an
optimized program will
* always* produce the same result.