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


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

Re: What is acceptable for -ffast-math? A numerical viewpoint


dewar@gnat.com wrote:
> 
> Suppose you write a Newton-Raphson sqrt that iterates to exact equality on
> the estimate. In many floating-point models, that's perfectly valid, and often
> the most efficient represntation of the algorithm.
> 
> However, in real arithmetic, this loop would never converge. Does that mean
> an optimizer is allowed to replace the loop with
> 
>   L1: JMP L1
> 
> Well the answer is yes, if you accept the bogus criterion that any
> transformation that would be valid for reals is valid.

Please stop assuming that anybody who disagrees with you must be an
igoramus who needs to be protected from the consequences of their folly.

I understand the behaviour of floating point arithmetic perfectly well,
thank you. That's why I feel confident in asking the compiler to be
generous in its transformations: because I understand the nature of FP
and the nature of my problem well enough to know that it won't poison
the results fatally.

Your Newton-Raphson example is bogus because it relies on the assumption
that anybody who asks for loose FP must not know what they're doing. It
wouldn't be a problem for me because I know perfectly well not to write
code like that. I expect most of the other people who have asked for
loose FP are at least as intelligent as I am.

I think Laurent Guerby [*1] made a really unfortunate choice of
terminology. Your side has to get away from this assumption that "wants
precisely predictable behaviour at the expense of speed" == "expert" &&
"wants speed at the expense of precisely predictable behaviour" == "not
an expert".

[*1: It took me ages to find the relevant message in the archive so I
could identify the author. Robert, please stop snipping attributions, it
makes following threads unnecessarily difficult.]

-- 
Ross Smith <ross.s@ihug.co.nz> The Internet Group, Auckland, New Zealand
========================================================================
"Unix has always lurked provocatively in the background of the operating
system wars, like the Russian Army."                  -- Neal Stephenson


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