This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.

Index Nav: Message Nav: [Date Index] [Subject Index] [Author Index] [Thread Index] [Date Prev] [Date Next] [Thread Prev] [Thread Next]

# Re: What is acceptable for -ffast-math? (Was: associative law in combine)

```Gabriel Dos_Reis wrote:

> I don't consider 0.5 * DBL_MAX to be at the "very limits of the number
> space".

Gaby, I'll try a different approach - I'm not going to say you are an
<elided> or your analysis is wrong, flawed, or biased.

I'm just going to point you at the topic of this thread: "What is
acceptable for -ffast-math ?".

Now, try for a moment to think with me.  During the hoolabaloo around
the Pentium FDIV error, I actually went into our weather forecasting
code to count the floating point divisions per grid cell per time step
(70).

The grand total for the whole forecast period was 2.2x10^9.

That was end-of-1994.  Nowadays, we have about 15 times more grid cells
and a 33 % longer forecast period.  Because I don't want to do this
counting exercise again, I'll just assume the same number of divisions
per grid cell, per time step, i.e. 70.

That makes the total 20 x 2.2 x 10^9 ~ 0.5 x 10^11 divisions per
forecast.

If we further assume that:

1) All of these divisions are of the form that allow the transformation.

2) Some forecast will hit your example.

3) The probability distribution for this hit is uniform (this assumption
is doubtful, because of the value involved).

this means that one in 2^53 / (0.5x10^11) ~ 10^5 forecasts will hit the
error.

I'm sorry, but I do not have the time to wait for the off-chance that
this error will occur, so I'll happily apply this transformation.

Now, even given this, I would certainly heed Roberts advice that the
transformation should actually be a perceptable "optimisation".

In our case, I doubt this (but then, I - personally - am not interested
in anything less than a 10 % improvement).

Cheers,

--
Toon Moene - mailto:toon@moene.indiv.nluug.nl - phoneto: +31 346 214290
Saturnushof 14, 3738 XG  Maartensdijk, The Netherlands
Maintainer, GNU Fortran 77: http://gcc.gnu.org/onlinedocs/g77_news.html
Join GNU Fortran 95: http://g95.sourceforge.net/ (under construction)

```

Index Nav: Message Nav: [Date Index] [Subject Index] [Author Index] [Thread Index] [Date Prev] [Date Next] [Thread Prev] [Thread Next]