On 2005-05-25 15:22:31 +0100, chris jefferson wrote: > On the other hand, in general using != and == on floating point > numbers is always dangerous if you do not know all the consequences. > For example, on your above program if I use 30.1 and 90.3, the > program fails without -ffast-math.
Yes, but != and == are not the only problems with floating point. Any programmer who uses floating-point should have read Goldberg's article. However, -ffast-math is particularly evil since it turns a correct program (when assuming some basic properties of the floating-point system[*]) into an incorrect one. [*] that have not always been true, but just to give some sense to what one has written. BTW, other interesting recent articles: http://csdl.computer.org/dl/mags/co/2005/05/r5091.pdf "An Open Question to Developers of Numerical Software", by W. Kahan and D. Zuras http://www.cs.berkeley.edu/~wkahan/Mindless.pdf "How Futile are Mindless Assessments of Roundoff in Floating-Point Computation?", by W. Kahan -- Vincent Lefèvre <[EMAIL PROTECTED]> - Web: <http://www.vinc17.org/> 100% accessible validated (X)HTML - Blog: <http://www.vinc17.org/blog/> Work: CR INRIA - computer arithmetic / SPACES project at LORIA