This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: weird optimization in sin+cos, x86 backend
On Friday 10 of February 2012 17:41:49 Andrew Haley wrote:
> On 02/10/2012 05:31 PM, PaweÅ Sikora wrote:
> > it would be also nice to see functions for reducing argument range in public api.
> > finally the end-user can use e.g. sin(reduce(x)) to get the best precision
> > with some declared cpu overhead.
>
> Hmm. I'm not sure this is such a terrific idea: each function has its
> own argument reduction (e.g. to [0, pi/4], [0, pi/8] or even [0, some
> weird constant that looks arbitrary but just happens to be exactly
> representable in binary]). You really don't want double rounding,
> which is what would happen with sin(reduce(x)).
hmm, maybe the math functions should contain an additioanal
'bool reduce' argument with some default (./configure-ed) value?
with such approach the end-user can avoid double rounding
and choose desired behaviour.