Path: utzoo!attcan!uunet!lll-winken!ames!ncar!noao!asuvax!nud!estinc!fnf From: fnf@estinc.UUCP (Fred Fish) Newsgroups: comp.sys.amiga Subject: Re: Complex Numbers in C Message-ID: <14@estinc.UUCP> Date: 14 Jan 89 16:42:40 GMT References: <8166@orstcs.CS.ORST.EDU> <5655@cbmvax.UUCP> <13459@cup.portal.com> Reply-To: fnf@estinc.UUCP (Fred Fish) Organization: Enhanced Software Technologies, Inc. Lines: 56 In article <13459@cup.portal.com> thad@cup.portal.com (Thad P Floryan) writes: >Re: the request for complex math functions for C ... > >Lest we forget, Fred Fish is the author of the Portable Math Library written >while he was a Goodyear Aerospace. The PML (distributed in source form and >freely redistributable (my copy accompanied the KCC compiler distribution >from SRI-International)) includes all the transcendental functions and the >arithmetic operations (and other stuff). > >Surprisingly, a quick perusal of the index to the "Fish Disks" didn't elicit >any matches to "pml", "math", "libr", etc. Just for those that are interested, here is some history about PML. It was written as my first C project, and was actually partially an execise in writing C. Thus it is not exactly my best C code. At the time, the only C compilers I had access to were the Decus C compilers on a PDP-11 and another primitive C compiler on the DECSYSTEM-20. Neither of these compilers had structure passing, so the code does lots of passing of pointers to structures of type "complex" (real and imag parts). Also, it used one of the very first versions of my macro based C debugging package, which had quite a few warts. Nevertheless, the code worked quite well, and seemed to be only about 50% slower than the native math libraries on both of my test machines, which presumably were written in hand optimized assembly language (remember, these were NOT UNIX machines). One of the nice features of the library is that it assumes only the existance of the basic floating point operations supported by the compiler (+,-,*,/). Everything else is built up from scratch using either machine (floating point format) specific C code, or portable C code. Thus once the primitive machine specific C code is done, everything else falls into place. Several years after releasing the first version (which is probably what Thad has), I went back and made several aborted attempts to overhaul the code. I wanted to eliminate the structure pointer passing and pass the actual "complex" structures, since most modern C compilers now support this feature. This eliminates LOTS of kludgery. I also wanted to retrofit my latest C debugging package macros, reorganize some of the low level functions to use standard UNIX style floating point primitives (ldexp, frexp, modf, etc), use standard UNIX style error handling (matherr), and use UNIX libm compatible calling conventions for the functions of the same name. This would make porting easier to UNIX systems because one would not have to rewrite the primitives (ldexp, frexp, modf, etc). Some of these partially converted versions may have been released before I finally gave up on the project due to lack of time and released the code into the public domain, hoping someone would "adopt" it, clean it up, and rerelease it. This version was posted to the net about a year or two ago, and is probably the only version that I currently have on line somewhere. So far I haven't seen any sign that an improved/cleaned-up version was ever produced. -Fred -- # Fred Fish, 1835 E. Belmont Drive, Tempe, AZ 85284, USA # asuvax!nud!estinc!fnf