This is the mail archive of the
mailing list for the GCC project.
Re: What is acceptable for -ffast-math? (Was: associative law in combine)
- To: Theodore dot Papadopoulo at sophia dot inria dot fr, gdr at codesourcery dot com
- Subject: Re: What is acceptable for -ffast-math? (Was: associative law in combine)
- From: dewar at gnat dot com
- Date: Wed, 1 Aug 2001 12:59:14 -0400 (EDT)
- Cc: amylaar at redhat dot com, aoliva at redhat dot com, dewar at gnat dot com,gcc at gcc dot gnu dot org, moshier at moshier dot ne dot mediaone dot net,torvalds at transmeta dot com, tprince at computer dot org
<<Full safety is IMHO impossible with floating point... Only the
programmer knows the accuracy of its input data (Linus called that
noise) and the accuracy he expects on its result.
Now that statement really cannot be let go by.
Of course it is possible to write safe and reliable floating-point code, but
in general this is only feasible if you have a sensible floating-point model
(e.g. IEEE), and you have a well understood mapping between the high level
language and the floating-point model.
THe viewpoint that floating-point is inherently sloppy is an unhelpful
and archaic one. It is the sort of thing that gives rise to idiotic advice
like "never use absolute equality on floating-point values".
Now of course a lot of code is written in a very much less safe and reliable
manner, and indeed, one can considerably relax the model much of the time.