Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!purdue!bu-cs!dartvax!eleazar.dartmouth.edu!earleh From: earleh@eleazar.dartmouth.edu (Earle R. Horton) Newsgroups: comp.sys.mac.programmer Subject: Re: How to Cosine Message-ID: <16293@dartvax.Dartmouth.EDU> Date: 23 Oct 89 12:05:59 GMT References: <2157@hudson.acc.virginia.edu> Sender: news@dartvax.Dartmouth.EDU Reply-To: earleh@eleazar.dartmouth.edu (Earle R. Horton) Organization: Thayer School of Engineering Lines: 43 In article <2157@hudson.acc.virginia.edu> cak3g@astsun8.astro.Virginia.EDU (Colin Klipsch) writes: ... >I am writing a library of three-dimensional graphics routines >similar to the Graf3D package supplied by Apple. However, I >desire more precision than these routines use. I have chosen >to represent my angles as long integers, with the angle being >expressed in milli-arcseconds (with 360*3600*1000 milli-arcseconds >to a circle). I am also using 64 bit integers (like the SANE >comp format) to represent my coordinates. > >In the interest of speed, I desire to write a subroutine with >the following properties: ... This may not be what Colin wants, but in the interest of speed, I would think the best thing to do would be to use floating point coordinates exclusively, and to compile the program to use the floating point coprocessor directly. If you can convince your end users that they require something with a 68020/68881 combo or better, then you have your performance problems licked. I seriously doubt that you can come close to the performance of the hardware math unit using any kind of integer-based package, particularly if you have to do trigonometry. >So how do the professionals do it? Good question. This depends on what kind of professionals we are talking about. Professional programmers might try to approach the performance level of a hardware math unit using highly optimized integer routines, and they might get within the same order of magnitude at the expense of huge outlays of intellectual effort. Professional engineers, physicists, chemists, accountants, etc. will say "Gimme that floating point chip!" and spend their intellectual efforts in solving the problem that they are actually interested in. That is why I wrote my 3d graphics library to use the 68881 directly. If I ever have to run it on a Plus or SE, well then I plan to byte the bullet and get a Radius or Daystar board with hardware floating point. Earle R. Horton