comp.lang.ada
 help / color / mirror / Atom feed
From: "Robert I. Eachus" <eachus@mitre.org>
Subject: Re: Calculating SQRT in ADA
Date: 1999/03/29
Date: 1999-03-29T00:00:00+00:00	[thread overview]
Message-ID: <36FFF83A.BE789C93@mitre.org> (raw)
In-Reply-To: 7dhjhi$27a$1@nnrp1.dejanews.com

robert_dewar@my-dejanews.com wrote:

> I have *far* more faith in library routines than in math
> routines cooked up by programmers who do not know how to
> compute elementary functions!
> 
> I must say that in a *lot* of experience, I have never seen
> a library sqrt function that was bad. As I said, this is a
> particularly easy one (that does not mean it cannot be
> messed up by people whose knowledge of numerical algorithms
> is minimal :-)
 
   Robert, your memory is going as you are getting older. ;-)  In the
sixties and seventies, there were some extremely atrocious
implementations in language run-time libraries.  The worst horror was
the URAND for the IBM 360 which caused dozens of peer-reviewed papers to
be withdrawn.  But I also remember many trigonometric libraries which
used polynomical approximations that were good to only six decimal
places--even for double precision.  Notice that even one N-R iteration
would have fixed that problem.  (The justification! was that the same
library function was used for both single and double precision, but most
single precision users wanted speed.  Of course, in many cases I was
able to write faster library functions that were much more accurate for
the double case, and gave LSB results for the single precision case.

   Of course, as Robert Dewar knows, the IEEE floating-point arithmetic
project did a lot to fix the situation, and to get trig, log, and
exponential functions officially in the hardware.

   Nowadays it is very hard to improve on the "hardware" IEEE
instructions, even when they involve some software emulation.  Back to
the original topic, the best way to compute square roots is not to use
NR, but to use the same algorithm you learned in school (with
calculating the exponent correctly for floating-point values).  On most
RISC hardware it is slightly faster than one floating-point divide, so
Newton-Rhapson can't compete.  (Of course, the hardware instruction, if
it is really done in hardware, is faster still.)




  reply	other threads:[~1999-03-29  0:00 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-03-24  0:00 Calculating SQRT in ADA cmcrae
1999-03-23  0:00 ` Chris Morgan
1999-03-24  0:00   ` Marin David Condic
     [not found]   ` <36F913E0.75F51763@lmco.com>
1999-03-24  0:00     ` Ada 83 - Sometimes still chosen Richard D Riehle
1999-03-25  0:00       ` robert_dewar
1999-03-25  0:00         ` Richard D Riehle
1999-03-25  0:00           ` Larry Kilgallen
1999-03-26  0:00           ` robert_dewar
1999-03-26  0:00             ` Richard D Riehle
1999-03-26  0:00               ` Tom Moran
1999-03-26  0:00                 ` Larry Kilgallen
1999-03-29  0:00                 ` Marin David Condic
1999-03-29  0:00                   ` Tarjei Tj�stheim Jensen
1999-03-27  0:00               ` Matthew Heaney
1999-03-26  0:00             ` Tom Moran
1999-03-26  0:00             ` Tarjei Tj�stheim Jensen
1999-03-27  0:00               ` robert_dewar
1999-03-27  0:00                 ` Tarjei Tj�stheim Jensen
1999-03-25  0:00       ` robert_dewar
1999-03-25  0:00         ` Richard D Riehle
1999-03-25  0:00           ` Marin David Condic
1999-03-26  0:00           ` robert_dewar
1999-03-24  0:00     ` Calculating SQRT in ADA John Herro
1999-03-24  0:00       ` Hans Marqvardsen
     [not found]         ` <36FAA3DF.42C31CF@lmco.com>
1999-03-26  0:00           ` Tom Moran
1999-03-25  0:00       ` robert_dewar
1999-03-25  0:00       ` robert_dewar
1999-03-25  0:00         ` John Herro
1999-03-24  0:00           ` Hans Marqvardsen
1999-03-25  0:00             ` David C. Hoos, Sr.
1999-03-25  0:00           ` robert_dewar
1999-03-25  0:00             ` David C. Hoos, Sr.
1999-03-26  0:00               ` Howard W. LUDWIG
1999-03-26  0:00             ` Ole-Hjalmar Kristensen
1999-03-27  0:00               ` robert_dewar
1999-03-29  0:00                 ` Robert I. Eachus [this message]
1999-03-30  0:00                   ` robert_dewar
1999-04-02  0:00                     ` Robert I. Eachus
1999-04-03  0:00                       ` robert_dewar
1999-03-30  0:00                   ` robert_dewar
1999-04-02  0:00                     ` Robert I. Eachus
1999-03-25  0:00           ` robert_dewar
1999-03-26  0:00             ` Calculating SQRT in Ada John Herro
1999-03-26  0:00               ` David C. Hoos, Sr.
1999-03-26  0:00                 ` John Herro
1999-03-25  0:00     ` Calculating SQRT in ADA robert_dewar
1999-03-24  0:00       ` Howard W. LUDWIG
1999-03-25  0:00         ` Larry Kilgallen
1999-03-24  0:00 ` bob
1999-03-24  0:00   ` Niklas Holsti
1999-03-26  0:00     ` bob
1999-03-26  0:00     ` als0045
1999-03-26  0:00       ` als0045
1999-03-26  0:00 ` Marin David Condic
1999-03-26  0:00   ` David C. Hoos, Sr.
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox