This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Simplify pow with constant
On Fri, 4 Aug 2017, Richard Biener wrote:
> >> Do this only for fast-math as accuracy is reduced. This is much faster
> >> since pow is more complex than exp - with a current GLIBC the speedup
> >> is more than 7 times for this transformation.
> >
> > Is it bound to be so on future glibc revisions and non-glibc platforms?
>
> And how is accuracy affected? I think the transform is only reasonable
For pow to be accurate when the result has large (positive or negative)
exponent, it needs to compute the log and intermediate multiplication to a
precision around (number of mantissa bits + number of exponent bits).
This is inevitably slower than when you omit the extra intermediate
precision (and if you omit that precision, the error can be around MAX_EXP
ulps).
--
Joseph S. Myers
joseph@codesourcery.com