[PATCH] Constant fold sqrt at compile time (take 3)
Fergus Henderson
fjh@cs.mu.OZ.AU
Sun Nov 3 18:33:00 GMT 2002
On 03-Nov-2002, Roger Sayle <roger@eyesopen.com> wrote:
>
> The third and final change is to implement Karp and Markstein's
> final iteration method. The Newtonian iteration produces the
> approximation 1/sqrt(x), and previously we'd get our final result
> by just multiplying this value by the original argument x. The
> "Karp and Markstein" approach is to use a slightly modified final
> iteration to produce sqrt(x). Due to the self-correcting nature
> of Newton-Raphson, this results in an answer accurate to 1 ulps.
>
> For more details see equation (5) of "High Precision Division
> and Square Root", Alan H. Karp and Peter Markstein, HP Lab Report
> 93-93-42, June 1993.
> http://www.hpl.hp.com/techreports/93/HPL-93-42.pdf
It would be nice to include that reference in a comment in the source, IMHO.
--
Fergus Henderson <fjh@cs.mu.oz.au> | "I have always known that the pursuit
The University of Melbourne | of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh> | -- the last words of T. S. Garp.
More information about the Gcc-patches
mailing list