This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: GCC beaten by ICC in stupid trig test!
>>>>> "Robert" == Robert Dewar <dewar@gnat.com> writes:
Robert> Toon Moene wrote:
>> Laurent GUERBY wrote:
>>
>>> All Monte Carlo based algorithms are also likely to be in the
>>> -ffast-math category. You're happy with 3-4 digits of "accuracy"
>>> thanks to 1/sqrt(n) convergence :).
>> Another example is all computation where reducing the continuous
>> physics to discrete mathematics already introduced truncation
>> errors larger than any floating point rounding error at 24 bit
>> mantissa precision.
Robert> Well I don't know exactly what stuff is in -ffast-math, but I
Robert> suspect it is a mistake to just think in terms of rounding
Robert> error vs the mantissa length. For example, if -ffast-math is
Robert> so sloppy as to consider that (a+b)+c can be replaced by
Robert> a+(b+c), then all bets are off. It is easy to construct
Robert> cases where the former has a value of 1.0 and the latter has
Robert> a value of 0.0.
It's obvious that you can construct pathological cases where you end
up with zero bits of accuracy. That doesn't justify the conclusion
that -ffast-math should avoid transformations where this may happen.
Otherwise you might as well get rid of -ffast-math -- which would be a
major mistake.
Incidentally, it is equally trivial to construct a pathological case
where the statement as written has zero bits of accuracy and the
transformation is much more accurate.
paul