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]
Other format: [Raw text]

Re: GCC beaten by ICC in stupid trig test!


Robert Dewar <dewar@gnat.com> writes:

> Per Abrahamsen wrote:
>
>> Not really, the sin**2+cos**2 may often be more readable
>
> Claiming that sin**2+cos**2 is more readable than 1.0 is really
> a very marginal argument,

It can easily be, in some result table with other sin/cos based
functions.  The alternative would be to add a comment stating that we
really meant "sin**2+cos**2", but hand optimized it into "1.0" because
the compiler for weird ideological reasons refused to do the job for
us.

>  especially since the former raises
> the issue of whether you mean 1.0, or the actual value computed
> by this formula. If you want 1.0, say so.

I, and I suspect 99% of all programmers, would mean >> the real value
produced by the mathematical formula "sin**2+cos**2" <<.  I know that
you, and other true numerical programmers, probably feel that we ought
to serve burgers instead of programming.  But wishful thinking doesn't
make it so.

> Floating-point operations are precisely defined in IEEE and if I am
> a serious fpt programmer, I write the computations I want, and I do
> not want the compiler substituting arbitrary non-equivalent
> expressions.

Fine, I just ask for a compiler flag for the *other* kind of
programmers, and for you not to discourage people from adding
optimization there.

> After all if you are happy with wrong results, then I suppose
> getting different wrong results faster is not unacceptable.
> (wrong results here = results whose accuracy is unknown).

Well, in my case, the accuracy of the models used are "within an order
of magnitude, or so we hope" and the accuracy of the input data are
"within an order of magnitude, or so we hope".  Floating-point
artifacts are not the primary concern when it come to the
interpretation of the output data.


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