complex arithmetic in C

Doug Gwyn gwyn at smoke.BRL.MIL
Tue Mar 28 00:15:57 AEST 1989


In article <54901 at yale-celray.yale.UUCP> ashcraft at yale.UUCP (Cleve Ashcraft) writes:
>dealing with struct's may be easy, but will it later have to be
>hardcoded into two arrays for efficiency?

Two arrays of what?

Long ago in a company far away, I developed a set of complex arithmetic
routines which I've since improved.  They are of course based on the
use of structures.  My particular implementation passes around pointers
to the structures rather than the structures themselves; depending on
your C implementation, this can be more efficient.  Maximal efficiency
calls for in-line expansion of many of the "functions" as macros rather
than actual function calls.

If you're comfortable with Polish or LISP notation, this works fine.

P.S.  Naive implementation of functions such as division and principal
square root can get one in trouble.



More information about the Comp.lang.c mailing list