comp.lang.ada
 help / color / mirror / Atom feed
From: "Robert I. Eachus" <rieachus@comcast.net>
Subject: Re: Standard Library Interest?
Date: Fri, 10 Oct 2003 02:29:13 GMT
Date: 2003-10-10T02:29:13+00:00	[thread overview]
Message-ID: <3F86195B.3040209@comcast.net> (raw)
In-Reply-To: wvbry8vux24x.fsf@sun.com

Ole-Hjalmar Kristensen wrote:
> OK, I'll bite. What's wrong with Cody-Waite? 

Nothing, they were both members of NumWG/NRG that developed the Ada 
numerics standards.

> (W.J. Cody and W. Waite, Software manual for the elementary functions, 
> Prentice Hall, 1980).

Oh, that Cody and Waite.  Same people, but I think you have to realize 
that the Prentice Hall book was at best a working draft for the over 10 
years of work that ended up in the DIS.  And remember the timing.  The 
Cody and Waite book was published about the same time as Mil Std 1815 
(Ada 80) which was the basis for ANSI/Mil-Std 1815A (Ada 83).  Adding 
Cody and Waite to the draft standard, as I said was not done, because 
all the Bills involved Cody, Waite, and Wittaker, (and Bob Mathis) knew 
how much more work was needed.

See if you can find a copy of "Proposed Standard for a Generic Package 
of Elementary Functions for Ada," Ada Letters - A Special Edition from 
SIGAda, Volume XI, Number 7, Fall 1991.  (There are actually four draft 
NRG standards in there, including the complex versions, with complete 
generic implementations.  There are a couple of typos, and I think one 
of the names was changed in the final standard, but the code is all good.)

If you can find it, burn your copy of Cody and Waite.  Otherwise it is 
better than nothing.  (Actually I prefer Abramowitz, M., and Stegun, I. 
A., Eds. Handbook of mathematical functions with formulas, graphs, and 
mathematical tables. Dover Publications Inc., New York, 1972 for 
completeness, and the Ada Letters Special Edition for the reference 
implementations of the functions that are provided.)

Seriously, if I sat down and looked through the original Cody and Waite 
book, I don't think I would find a single function that wasn't 
significantly improved in both performance and accuracy, usually several 
times over the next ten years.

As for the square root in particular, there are two basic algorithms. 
One is to use the N-R approach which doubles accuracy at each step with 
a good starting guess.  But in requires a divide at each iteration, and, 
on modern CPUs, divides are slow. The algorithm you may have learned in 
school (in decimal) works very nicely in binary with only additions, 
subtractions, compares and shifts.  Since it uses two-bits at each step 
in binary, you can often write a machine code version that is faster 
than hardware division.  But don't bother, except for very special uses, 
such as arbitrary precision arithmetic.  The computer you use, unless it 
is ancient, should have this algorithm in microcode as part of the IEEE 
floating point functions.  If I thought it was worth writing the code 
today, I'd show you the tricks that speed up the code.  (Basically you 
want to do compare, adjust, then subtract.)

-- 
                                                     Robert I. Eachus

"Quality is the Buddha. Quality is scientific reality. Quality is the 
goal of Art. It remains to work these concepts into a practical, 
down-to-earth context, and for this there is nothing more practical or 
down-to-earth than what I have been talking about all along...the repair 
of an old motorcycle."  -- from Zen and the Art of Motorcycle 
Maintenance by Robert Pirsig




  reply	other threads:[~2003-10-10  2:29 UTC|newest]

Thread overview: 285+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-10-05  0:09 Standard Library Interest? chris
2003-10-05  1:38 ` Robert I. Eachus
2003-10-05 11:44   ` chris
2003-10-05 15:16   ` Marin David Condic
2003-10-05 16:40     ` Robert I. Eachus
2003-10-05 19:22     ` Martin Dowie
2003-10-06 13:12       ` Marin David Condic
2003-10-06 17:09         ` Martin Dowie
2003-10-06 23:34           ` Marin David Condic
2003-10-07  0:23             ` Stephane Richard
2003-10-07 12:42               ` Marin David Condic
2003-10-07 13:17                 ` Stephane Richard
2003-10-07 17:17                   ` Marin David Condic
2003-10-07 17:42                     ` Larry Hazel
2003-10-07 19:36                       ` Stephane Richard
2003-10-07 20:31                         ` Stephen Leake
2003-10-07 21:56                           ` Stephane Richard
2003-10-08  1:11                             ` Marin David Condic
2003-10-08 16:07                               ` Martin Krischik
2003-10-10  4:38                                 ` Marin David Condic
2003-10-10 14:37                                   ` Stephen Leake
2003-10-10 16:24                                     ` Martin Dowie
2003-10-11 14:16                                       ` Marin David Condic
2003-10-12  1:30                                         ` Martin Dowie
2003-10-12  2:46                                           ` Marin David Condic
2003-10-11 14:07                                     ` Marin David Condic
2003-10-14 14:20                                       ` Stephen Leake
2003-10-14 19:14                                         ` Marin David Condic
2003-10-14 19:27                                           ` Stephen Leake
2003-10-15 12:27                                             ` Marin David Condic
2003-10-15 12:42                                               ` Marin David Condic
2003-10-10 16:46                                   ` Martin Krischik
2003-10-10 18:00                                     ` Stephane Richard
2003-10-12 11:19                                       ` Martin Krischik
2003-10-12 14:48                                         ` Stephane Richard
2003-10-11 14:22                                     ` Marin David Condic
2003-10-09 10:50                               ` Ching Bon Lam
2003-10-09 12:11                                 ` Marin David Condic
2003-10-09 17:16                                   ` Warren W. Gay VE3WWG
2003-10-09 18:30                                     ` tmoran
2003-10-10  1:29                                   ` Frank
2003-10-10  8:19                                     ` chris
2003-10-10  2:53                                   ` Robert I. Eachus
2003-10-08 15:55                             ` Stephen Leake
2003-10-08 16:49                               ` Stephane Richard
2003-10-08 17:18                               ` Marin David Condic
2003-10-10  2:59                                 ` Hyman Rosen
2003-10-08 19:54                             ` Robert I. Eachus
2003-10-08 21:40                               ` Stephen Leake
2003-10-09 12:28                               ` Marin David Condic
2003-10-09 15:18                                 ` Stefan Lucks
2003-10-09 16:10                                   ` Stephen Leake
2003-10-09 16:57                                     ` Stephane Richard
2003-10-10  4:58                                     ` Marin David Condic
2003-10-10  9:28                                     ` Stefan Lucks
2003-10-10 14:59                                       ` Stephen Leake
2003-10-10 16:48                                         ` Ed Falis
2003-10-10 16:29                                       ` Warren W. Gay VE3WWG
2003-10-11  7:01                                         ` Simon Wright
2003-10-10 15:51                                     ` Robert I. Eachus
2003-10-10 17:04                                       ` Stephen Leake
2003-10-10  3:02                                 ` Robert I. Eachus
2003-10-10  5:17                                   ` Marin David Condic
2003-10-10 16:38                                     ` Warren W. Gay VE3WWG
2003-10-11 14:35                                       ` Marin David Condic
2003-10-15 16:24                                         ` Warren W. Gay VE3WWG
2003-10-15 17:57                                           ` Ed Falis
2003-10-15 20:45                                             ` Warren W. Gay VE3WWG
2003-10-15 20:44                                           ` Mark A. Biggar
2003-10-16 12:55                                             ` Marin David Condic
2003-10-16 16:52                                               ` Warren W. Gay VE3WWG
2003-10-16 17:53                                                 ` Marin David Condic
2003-10-17 13:25                                                   ` Warren W. Gay VE3WWG
2003-10-18 13:50                                                     ` Marin David Condic
2003-10-21 17:14                                                       ` Warren W. Gay VE3WWG
2003-10-22 13:04                                                         ` Marin David Condic
2003-10-22 16:46                                                           ` Warren W. Gay VE3WWG
2003-10-22 17:13                                                             ` Ed Falis
2003-10-23  5:23                                                               ` Marin David Condic
2003-10-23 13:55                                                                 ` Ed Falis
2003-10-23  5:21                                                             ` Marin David Condic
2003-10-27 17:37                                                               ` Warren W. Gay VE3WWG
2003-10-28  1:53                                                                 ` Marin David Condic
2003-10-16 12:38                                           ` Marin David Condic
2003-10-16 17:16                                             ` Warren W. Gay VE3WWG
2003-10-16 18:02                                               ` Stephane Richard
2003-10-16 18:23                                                 ` Stephane Richard
2003-10-17  0:36                                                 ` Robert I. Eachus
2003-10-17  1:24                                                   ` Stephane Richard
2003-10-17  1:40                                                   ` Marin David Condic
2003-10-17  2:34                                                     ` Stephane Richard
2003-10-17 12:45                                                       ` Marin David Condic
2003-10-16 18:04                                               ` Marin David Condic
2003-10-17 20:09                                                 ` Jacob Sparre Andersen
2003-10-20 17:40                                                   ` Robert I. Eachus
2003-10-21 20:55                                                     ` Warren W. Gay VE3WWG
2003-10-21 22:46                                                     ` Stephane Richard
2003-10-21 21:02                                                 ` Warren W. Gay VE3WWG
2003-10-10 18:44                                     ` Robert I. Eachus
2003-10-11 14:42                                       ` Marin David Condic
2003-10-11 15:10                                         ` Stephane Richard
2003-10-11 17:58                                           ` Robert I. Eachus
2003-10-12  1:01                                             ` Marin David Condic
2003-10-12  0:51                                           ` Marin David Condic
2003-10-12  1:17                                             ` Stephane Richard
2003-10-12  2:10                                               ` Marin David Condic
2003-10-12  5:14                                                 ` Robert I. Eachus
2003-10-12 13:39                                                   ` Marin David Condic
2003-10-12  1:20                                             ` Stephane Richard
2003-10-12  2:32                                               ` Marin David Condic
2003-10-12 11:14                                                 ` Stephane Richard
2003-10-16 13:18                                                   ` aleistad
2003-10-07 22:12                           ` tmoran
2003-10-07 22:37                           ` Alexandre E. Kopilovitch
2003-10-08 16:03                           ` Martin Krischik
2003-10-09 13:28                           ` Jacob Sparre Andersen
2003-10-28 11:25                         ` Marius Amado Alves
2003-10-28 12:52                           ` Marin David Condic
2003-10-28 13:28                             ` Marius Amado Alves
2003-10-28 23:20                               ` Marin David Condic
2003-10-28 13:21                           ` Stephane Richard
2003-10-28 16:21                           ` Standard Library Interest? (The Big Player ACT) Stephane Richard
2003-10-28 23:37                             ` Marin David Condic
2003-10-29  1:12                               ` Stephane Richard
2003-10-29 14:35                               ` Marc A. Criley
2003-10-29 23:10                                 ` tmoran
2003-10-29 23:34                                 ` Marin David Condic
2003-10-31 14:42                                   ` Georg Bauhaus
2003-11-01  3:05                                     ` Marin David Condic
2003-11-01  3:50                                       ` Stephane Richard
2003-11-01 13:20                                         ` Marin David Condic
2003-11-02 16:41                                       ` Georg Bauhaus
2003-11-02 19:25                                         ` Marin David Condic
2003-11-01  7:20                                     ` Simon Wright
2003-11-02 17:04                                       ` Georg Bauhaus
2003-11-02 15:09                             ` Standard Library Interest? (The Big Player IRVINE) Stephane Richard
2003-11-02 16:18                               ` Marius Amado Alves
2003-11-02 16:35                                 ` Stephane Richard
2003-11-02 22:41                               ` Marin David Condic
2003-11-03  1:07                                 ` Standard Library Interest? Robert I. Eachus
2003-11-03  1:27                                   ` Stephane Richard
2003-11-03 12:52                                     ` Marin David Condic
2003-11-03  3:58                                   ` Alexandre E. Kopilovitch
2003-11-03  6:28                                     ` Robert I. Eachus
2003-11-03 12:11                                       ` Jeff C,
2003-11-03 17:07                                         ` Robert I. Eachus
2003-11-04 18:07                                       ` Alexandre E. Kopilovitch
2003-11-03  7:54                                     ` Mark A. Biggar
2003-11-03 21:02                                       ` Alexandre E. Kopilovitch
2003-11-04  1:50                                         ` Robert I. Eachus
2003-11-04 18:16                                           ` Jeffrey Carter
2003-11-06  2:07                                           ` Alexandre E. Kopilovitch
2003-11-03 15:14                                     ` Robert Spooner
2003-11-03 15:38                                       ` Dmitry A. Kazakov
2003-11-03 16:52                                       ` Alexandre E. Kopilovitch
2003-11-03 12:36                                   ` Marin David Condic
     [not found]                         ` <1067340353.3441.18.camel@localhost.localdomain>
2003-10-28 11:30                           ` Marius Amado Alves
2003-10-08  1:07                       ` Marin David Condic
2003-10-08  1:15                         ` Stephane Richard
2003-10-08  1:32                           ` Marin David Condic
2003-10-08 15:58                           ` Stephen Leake
2003-10-08 17:24                             ` Marin David Condic
2003-10-07 18:19                     ` Martin Dowie
2003-10-07 19:29                       ` Stephane Richard
2003-10-07 20:30                         ` Martin Dowie
2003-10-08  1:15                       ` Marin David Condic
2003-10-08 21:56                         ` Stephane Richard
2003-10-08 23:56                           ` Robert I. Eachus
2003-10-09  0:29                             ` Stephane Richard
2003-10-10 16:47                             ` POSIX File Structure Conventions for Ada (Was: Standard Library Interest?) Warren W. Gay VE3WWG
2003-10-10 17:17                               ` Ludovic Brenta
2003-10-11 16:25                                 ` Warren W. Gay VE3WWG
2003-10-09 12:42                           ` Standard Library Interest? Marin David Condic
2003-10-09 13:07                             ` Stephane Richard
2003-10-10  3:15                               ` Robert I. Eachus
2003-10-10  8:10                                 ` Stephane Richard
2003-10-10 12:49                                   ` Marin David Condic
2003-10-10 13:20                                     ` Jeff C,
2003-10-11 14:48                                       ` Marin David Condic
2003-10-11 15:09                                         ` Stephane Richard
2003-10-10 19:22                                   ` Robert I. Eachus
2003-10-11 11:30                                     ` Stephane Richard
2003-10-11 12:36                                     ` Stephane Richard
2003-10-11 17:41                                       ` sk
2003-10-11 17:43                                         ` Stephane Richard
2003-10-11 18:08                                       ` Robert I. Eachus
2003-10-11 18:11                                         ` Stephane Richard
2003-10-12  1:33                                         ` Marin David Condic
2003-10-12  5:16                                           ` Robert I. Eachus
2003-10-15 16:42                                         ` Warren W. Gay VE3WWG
2003-10-15 16:35                                     ` Warren W. Gay VE3WWG
2003-10-16 12:59                                       ` Marin David Condic
2003-10-17 19:54                                         ` Warren W. Gay VE3WWG
     [not found]                   ` <8d6b51-0u3.ln1@beastie.ix.netcom.com>
2003-10-07 23:58                     ` Stephane Richard
     [not found]                       ` <f8nc51-gv2.ln1@beastie.ix.netcom.com>
2003-10-08 12:45                         ` Marin David Condic
2003-10-08 16:00                         ` Stephen Leake
2003-10-08 17:37                           ` Stephane Richard
     [not found]                           ` <hdbf51-523.ln1@beastie.ix.netcom.com>
2003-10-09 14:24                             ` Hyman Rosen
2003-10-10 12:06                               ` Stephane Richard
2003-10-10 15:03                                 ` Stephen Leake
2003-10-05 17:41   ` Georg Bauhaus
2003-10-05 17:48     ` chris
2003-10-05 23:57     ` Robert I. Eachus
2003-10-07  1:44       ` Georg Bauhaus
2003-10-08 20:44         ` Robert I. Eachus
2003-10-09  2:05           ` Alexandre E. Kopilovitch
2003-10-09  5:39             ` Robert I. Eachus
2003-10-09  9:06               ` Dmitry A. Kazakov
2003-10-05 14:49 ` Martin Krischik
2003-10-05 15:25   ` Marin David Condic
2003-10-05 15:51     ` sk
2003-10-05 18:23       ` Marin David Condic
2003-10-05 19:14         ` Stephane Richard
2003-10-06 13:15           ` Marin David Condic
2003-10-05 19:35         ` Jeffrey Carter
2003-10-06  9:46           ` Stephane Richard
2003-10-06 13:16             ` Marin David Condic
2003-10-06 14:44               ` Stephane Richard
2003-10-06 16:51               ` Martin Krischik
2003-10-06 16:48         ` Martin Krischik
2003-10-06 23:38           ` Marin David Condic
2003-10-06 16:42     ` Martin Krischik
2003-10-06 23:39       ` Marin David Condic
2003-10-05 15:02 ` Marin David Condic
2003-10-05 16:43   ` Robert I. Eachus
2003-10-05 18:31     ` Marin David Condic
2003-10-07  1:58       ` Robert I. Eachus
2003-10-07 12:48         ` Marin David Condic
2003-10-08 20:49           ` Robert I. Eachus
2003-10-05 17:49   ` Georg Bauhaus
2003-10-05 18:43     ` Marin David Condic
2003-10-05 23:26       ` Georg Bauhaus
2003-10-06 13:27         ` Marin David Condic
2003-10-10 16:58           ` Warren W. Gay VE3WWG
2003-10-11  9:55             ` Martin Dowie
2003-10-15 16:51               ` Warren W. Gay VE3WWG
2003-10-16 12:14                 ` Martin Dowie
2003-10-22 16:48                   ` Warren W. Gay VE3WWG
2003-10-05 19:27   ` Martin Dowie
2003-10-06 13:33     ` Marin David Condic
2003-10-06 17:16       ` Martin Dowie
2003-10-06 23:45         ` Marin David Condic
2003-10-06 16:47     ` chris
2003-10-06 19:03       ` sk
2003-10-06 20:18         ` chris
2003-10-06 21:13           ` sk
2003-10-20  3:22             ` Dave Thompson
2003-10-20 10:29               ` sk
2003-10-07  0:30           ` Mark Lorenzen
2003-10-07  2:13     ` Robert I. Eachus
2003-10-07 22:49       ` Georg Bauhaus
2003-10-08 20:58         ` Robert I. Eachus
2003-10-09 12:57           ` Marin David Condic
2003-10-10  3:09             ` Robert I. Eachus
2003-10-06  7:02   ` Preben Randhol
2003-10-06 13:37     ` Marin David Condic
2003-10-06 14:34       ` Preben Randhol
2003-10-06 23:50         ` Marin David Condic
2003-10-07  8:55           ` Preben Randhol
2003-10-07 13:05             ` Marin David Condic
2003-10-06 19:37       ` tmoran
2003-10-06 23:57         ` Marin David Condic
2003-10-08 21:46           ` Robert I. Eachus
2003-10-09  8:10             ` Ole-Hjalmar Kristensen
2003-10-10  2:29               ` Robert I. Eachus [this message]
2003-10-09  9:20             ` Dmitry A. Kazakov
2003-10-09 13:09             ` Marin David Condic
2003-10-10 14:44               ` Robert I. Eachus
2003-10-11 14:57                 ` Marin David Condic
2003-10-11 18:25                   ` Robert I. Eachus
2003-10-12  1:49                     ` Marin David Condic
2003-10-12  3:52                       ` Robert I. Eachus
2003-10-06 13:50     ` (see below)
2003-10-06 15:28       ` Preben Randhol
2003-10-06 19:37         ` tmoran
2003-10-07  8:59           ` Preben Randhol
2003-10-05 23:33 ` Robert C. Leif
2003-10-06  9:02 ` Vadim Godunko
2003-10-07  0:48 ` Matthew Heaney
2003-10-07  8:56   ` Preben Randhol
2003-10-07 13:08     ` Marin David Condic
  -- strict thread matches above, loose matches on Subject: below --
2003-10-10 13:46 Beard, Frank Randolph CIV
2003-10-11  7:33 ` Martin Krischik
2003-10-11 15:04 ` Marin David Condic
     [not found] <mailman.191.1066918723.25614.comp.lang.ada@ada-france.org>
2003-10-23 14:26 ` Ed Falis
replies disabled

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