Path: utzoo!mnetor!uunet!husc6!bbn!gatech!mcnc!ecsvax!urjlew From: urjlew@ecsvax.UUCP (Rostyk Lewyckyj) Newsgroups: comp.sys.m68k Subject: Re: assembly sine function Message-ID: <4872@ecsvax.UUCP> Date: 5 Apr 88 04:45:19 GMT References: <2514@umd5.umd.edu> <9887@tekecs.TEK.COM> Organization: UNC Educational Computing Service Lines: 31 Summary: A suggestion of sorts In article <9887@tekecs.TEK.COM>, andrew@frip.gwd.tek.com (Andrew Klossner) writes: > > "does anyone out there have a PD sine/cosine function written > in 68000 assembly language? I need one that will be VERY fast, > for it will be called durring an interrupt (VBLANK)." > > I've got a very fast function: table lookup. For example, if you can > round the argument to the nearest degree, then a 90-element table > suffices. If you need seven-digit accuracy, a table won't help. > I would have sent this by mail to the person who posed the original question to which Mr. Klossner in replying, but the identity of that person is not in the posting. So here goes to the net. A lot depends on the speed of your machine relative to the length of the VBLANK interval. If you don't get ready made code then I suggest using a table of sine(x) 0<=x<=pi/2 with a Taylor's series expansion for interpolation between tabulated values. Using trig identities reduce the argument for which you want to calculate the sine to 0<=y<=pi/2. then if y=x+h where x is the nearest tabulated point. sin(x+h)=sin(x)+h*cos(x)-(h*h/2)sin(x) and cos(x)=sin(x+pi/2) which will also be a tabulated value if the x es are evenly spaced from 0 to pi/2. I think this will give you both the speed and accuracy you need. ----------------------------------------------- Reply-To: Rostyslaw Jarema Lewyckyj urjlew@ecsvax.UUCP , urjlew@tucc.bitnet or urjlew@tucc.tucc.edu (ARPA,SURA,NSF etc. internet) tel. (919)-962-9107