This is the mail archive of the
mailing list for the GCC project.
Re: What is acceptable for -ffast-math? A numerical viewpoint
- To: gcc at gcc dot gnu dot org
- Subject: Re: What is acceptable for -ffast-math? A numerical viewpoint
- From: Ross Smith <ross dot s at ihug dot co dot nz>
- Date: Mon, 06 Aug 2001 08:42:59 +1200
- Organization: Ihug
- References: <20010805105124.38520F2B53@nile.gnat.com>
> 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
[*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 <firstname.lastname@example.org> 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