On Tue, Jun 07, 2005 at 05:49:54PM -0400, Robert Dewar wrote: > * Paul Schlie: > > > (With an exception being FP optimization, as FP is itself based > > only on the approximate not absolute representation of values.) > > Floating-point arithmetic is not simply some inaccurate representation > of real arithmetic. It can be used this way by the programmer, but in > fact fpt operations have very well defined semantics, and compiler > writers have to be very careful not to intefere with these semantics > beyond the level permitted by the language. Certainly the above quoted > attitude would be pretty deadly if held by a compiler optimizer > writer!
Exactly. I have written fixed-point packages as well as expression manipulation packages that are based on the exact behavior of IEEE floating point. I have had running battles in the past (not recently) with people who think that GCC should warn whenever == is applied to float or double expressions. There are some faults that we just have to live with (like the uncontrolled extra precision on the x86, depending on whether a temporary is spilled to memory or not), but programs can and do depend on the fact that certain values and computations are represented precisely by floating point arithmetic.