Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!ames!pasteur!ucbvax!decwrl!sun!pitstop!sundc!seismo!uunet!mcvax!ukc!stl!stc!datlog!torch!paul From: paul@torch.UUCP (Paul Andrews) Newsgroups: comp.graphics Subject: Re: Challenge program. Keywords: Write sin(x) using integer math. Message-ID: <194@torch.UUCP> Date: 23 May 88 08:49:20 GMT References: <327@abvax.UUCP> Reply-To: paul@torch.UUCP (Paul Andrews) Organization: TORCH Computers Ltd., Cambridge, United Kingdom Lines: 19 In article <327@abvax.UUCP> gfs@abvax.UUCP (Greg F. Shay) writes: > ------> Write sin(x) using integer math only. No lookup tables! Why no lookup tables? If you relax that constraint you could use the Cordic algorithm (COordinate Rotation by DIgital Computer). The lookup table is small (#entries = bits of precision I think), and there are NO multiplications involved. Even machines that have hardware multiplies are usually fairly slow at them. In addition it performs - as the name implies - a rotation on two arguments giving two results (the X,Y of the rotated point). Only problem is a scale factor left at the end. You can either remove this using 2 divides or account for it in later transformations. Still I'll be interested to see the results of your poser. When I was looking for algorithms in this area I found it very difficult to find papers on the subject. At the time almost all the papers assumed that everyone had hardware floating point. That may have been true in the mainframe world but certainly not on my humble 6502. - Paul.