[comp.sys.mac.programmer] Lookup table vs 68881/2

rick@wam.umd.edu (Frederick E. Brown) (01/09/90)

Can anyone tell me which is faster: sin/cos lookup tables or using the
68881/2 on a mac II.  I'm writing a 3D program and want to know which has
the performance edge.

	rick@wam.umd.edu

amanda@mermaid.intercon.com (Amanda Walker) (01/10/90)

In article <9001091506.AA00567@cscwam.umd.edu>, rick@wam.umd.edu (Frederick E.
Brown) writes:
> Can anyone tell me which is faster: sin/cos lookup tables or using the
> 68881/2 on a mac II.  I'm writing a 3D program and want to know which has
> the performance edge.

Somebody did some timing on this recently.  Tables beat the FPU as long
as you don't have to do any interpolation (i.e. really huge tables), but
the FPU beat everything else, including tables with quadratic interpolation.

The 68882 is even better at trig than the 68881, which isn't too shabby
itself.

Amanda Walker
InterCon Systems Corporation
--

rcfische@polyslo.CalPoly.EDU (Raymond C. Fischer) (01/11/90)

In article <9001091506.AA00567@cscwam.umd.edu> rick@wam.umd.edu (Frederick E. Brown) writes:
>Can anyone tell me which is faster: sin/cos lookup tables or using the
>68881/2 on a mac II.  I'm writing a 3D program and want to know which has
>the performance edge.
>	rick@wam.umd.edu

If you are using floating point anyway, stick with the 68881.  The time
required to convert a floating point number to an index, do the lookup,
andgenerate the result will take up more time than just doing the 
calculations.

If you don't have to use floating point, consider the fixed point routines
in the Mac ROM.  Although the accuracy is not as good (56 bits floating
point vs. 32 fixed) the routines are much faster and do include sin/cos.
Look up FracSin and FracCos in IM IV.

Ray Fischer
rcfische@polyslo.calpoly.edu