This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: -ffast-math and floating point reordering
Joe Buck wrote:
On Thu, Mar 25, 2004 at 01:03:39AM -0500, Robert Dewar wrote:
What is "model interval"?
Brief answer (long answer is too long). When the result of an
fpt operation is exactly representable, the model interval is
the set consisting of this one number.
When the result is not exactly representable, then the model
interval is the range of results between the two representable
values surrounding the true real result, including the end
points.
Generally any value within the model interval can be returned,
either end point, or, using temporary excess precision, some
value in between.
An optimization like reassociation is permitted only if the
result is within the model interval of the original result
as defined by the canonical semantics.
This is quite a strict criterion. For example in Ada 83, it
forbod the optimization of x**4 to x**2**2, because there
are cases where the latter is less accurate and lies outside
the model interval of x*x*x*x, which is the canonical
semantic result. This particular effect was unintended (it
is a bit of a surprise to some that x**2**2 which has one
less multiplication, can be less accurate :-) So in Ada 95
reassociation is explicitly permitted in computing x**j
for integer exponent j.