[BIB PATCH] Add real_sqrt literature reference

Roger Sayle roger@eyesopen.com
Thu Nov 7 22:17:00 GMT 2002


On Mon, 4 Nov 2002, Fergus Henderson wrote:
> 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.

No problem.  The following patch adds the literature citation mentioned
above to the comment describing real_sqrt in real.c.  If we decide to
use a different implementation in the future, we can change the comment
then.

Ok for the gcc-3_4-basic-improvements-branch?


2002-11-07  Roger Sayle  <roger@eyesopen.com>

	* real.c (real_sqrt): Add bibliographic reference to comment.


Index: real.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/real.c,v
retrieving revision 1.75.4.8
diff -c -3 -p -r1.75.4.8 real.c
*** real.c	4 Nov 2002 00:04:21 -0000	1.75.4.8
--- real.c	8 Nov 2002 05:48:36 -0000
*************** const struct real_format *real_format_fo
*** 4384,4390 ****


  /* Calculate the square root of X in mode MODE, and store the result
!    in R.  */

  void
  real_sqrt (r, mode, x)
--- 4384,4392 ----


  /* Calculate the square root of X in mode MODE, and store the result
!    in R.  For details see "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.  */

  void
  real_sqrt (r, mode, x)

Roger
--
Roger Sayle,                         E-mail: roger@eyesopen.com
OpenEye Scientific Software,         WWW: http://www.eyesopen.com/
Suite 1107, 3600 Cerrillos Road,     Tel: (+1) 505-473-7385
Santa Fe, New Mexico, 87507.         Fax: (+1) 505-473-0833



More information about the Gcc-patches mailing list