Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!bloom-beacon!husc6!cmcl2!adm!smoke!gwyn From: gwyn@smoke.BRL.MIL (Doug Gwyn ) Newsgroups: comp.lang.c Subject: Re: complex arithmetic in C Keywords: complex arithmetic, C Message-ID: <9933@smoke.BRL.MIL> Date: 27 Mar 89 14:15:57 GMT References: <54901@yale-celray.yale.UUCP> Reply-To: gwyn@brl.arpa (Doug Gwyn (VLD/VMB) ) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 18 In article <54901@yale-celray.yale.UUCP> ashcraft@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.