comp.lang.ada
 help / color / mirror / Atom feed
* Re: Reusable math package?
@ 1994-10-20 16:12 Bob Crispen
  0 siblings, 0 replies; only message in thread
From: Bob Crispen @ 1994-10-20 16:12 UTC (permalink / raw)


This is a late follow-up, and many thanks to David Weller, Mark Biggar,
tarjeij@extern.uio.no, Robb Nebbe, WOODRUFF@EC2226.ADDVAX.LLNL.GOV,
Bob Eachus, and Robert Dewar for their help.

If you'll recall, my problem was that we had defined some numeric
types (e.g., Float_64, Integer_32) which we use everywhere instead
of Standard.Float and Standard.Integer.  We wanted to supply math
functions (e.g., sin, cos) for those types.

There were numerous good suggestions from all of you, and naturally
we decided to do something completely different!  But some of you
will find this plan looks familiar, and many thanks.

Step 1: We developer a subset of the math functions we need everywhere.
That turned out to be:

        sin, cos, tan, asin, acos, atan, atan2, sqrt, log, ln,
        exp, **, min, max, sign and RSS (the latter being
        x**2 + y**2 + z**2)

We overloaded these functions on all our types (Float_32, Float_64,
and Float_80).

Step 2: We implemented a short-term solution of a front-end package
to the vendor-supplied math packages.  It turns out our VADS compilers
will let us do two levels of pragma INLINES, so things like:

   function Sin (Theta : Float_64) return Float_64 is
   begin
      return Float_64 (Math.Sin (Float(Theta)));
   end Sin;

end up generating efficient code (in this case, a call to the Unix
/usr/include/libm.a routines of the same name).  Not super-efficient,
but it's only an interim step.

Step 3 is more long-term.  We've done a cleanroom implementation of the
package body for our core functions for the i960 in machine code.  We
intend to do the same for the other systems we work on (Sun, SGI,
MC680x0).

There's a wonderful MC68881 math package supplied in VADSWorks 1.2c
whose header says:

-- ************************************************************************
-- * NOTE: This file is supplied as an example of using machine code for  *
-- *       math packages using the 68881 coprocessor.  This is an example *
-- *       only, and does not provide the full 68881 math functionality.  *
-- *                                                                      *
-- *       Verdix does NOT warrant this code in any way.                  *
-- *                                                                      *
-- *       As a matter of note, this code was provided by a customer as   *
-- *       an example of how to approach 68881 recoding of the entire     *
-- *       math package as defined in verdixlib.  Due to the current work *
-- *       by NUMWG (Numerical Working Group of SIGAda), we felt that     *
-- *       recoding effort was best delayed until the NUMWG proposed      *
-- *       standard math package definition was complete. Some recoding   *
-- *       Verdix was done.                                               *

I haven't the slightest idea whether I'm allowed to use the code in
that package or not, but I sure would appreciate somebody at Rational
letting me know.  Curiously, all subsequent VADSWorks releases have
used their vanilla math_body.a which calls the libm.a routines.

In the meantime, a couple of folks mentioned NUMWG, but I can't seem to
find any information on it, apart from a one-line mention in the faq.
And I haven't had much luck at getting Ada source code for BCSLIB,
though to be honest, I've probably been asking the wrong people.

So, basically, thanks to you and some folks here, we're running and
safe from the vivid imaginations of lawyers, and we have a plan to
finish up.  If somebody can point me to the NUMWG or BCSLIB stuff,
if that'll save the cleanroom effort, I'd appreciate it at least
enough to buy you a drink at TRI-Ada.
+-------------------------------+--------------------------------------+
| Bob Crispen                   |   Who will babysit the babysitters?  |
| crispen@foxy.hv.boeing.com    +--------------------------------------+
| (205) 461-3296                |Opinions expressed here are mine alone|
+-------------------------------+--------------------------------------+



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1994-10-20 16:12 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1994-10-20 16:12 Reusable math package? Bob Crispen

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