Re: Floating point: sine, cosine etc.

From: gsteemso <48bitsorbust_at_gmail.com>
Date: Sat, 15 Oct 2022 10:43:28 -0700
Message-Id: <EC260006-55F5-4C2D-85D9-FA36ABD7BA9D_at_gmail.com>
Hi all,

> On Oct 13, 2022, at 8:26 AM, ruud_at_baltissen.org wrote:
> 
>> I'd start from "tan(x) = sin(x)/cos(x)" and see what happens when you
>> express that division in terms of their expansions, whichever
>> expansions you end up using.
> 
> If you mean me to calculate these two and then do a division, no sir, to much work.

As others have said, performing the triple calculation "scratch = sin(x), temp = cos(x), answer = scratch / temp" is both plausible and in fact how Commodore themselves did it; but no, I mean you can figure out your coëfficients or whatnot by simply writing out the first few terms of your selected sin(x) and cos(x) expansions on paper, expressed as a division -- it would look like a big, ungainly fraction -- and simplifying it with basic high-school algebra.

I freely admit I haven't had time to dig into this personally, and for all I know none of the plausible resulting expressions are so amenable to simplification as my mental reflexes expect.  I'm only saying that I'd take this approach as my first stab at the problem.

For what it's worth, what others have said in this thread about not needing to reïnvent the wheel does apply very strongly here.  I've not had the pleasure of time to examine how packages such as CORDIC actually work, but I've read that they're pretty much masterpieces of the kind of "no hardware multiplication or division" arithmetic that you would want for 65xx work.  Sieving out the bits relevant to your use case would probably be a very good investment of your time.

G.
Received on 2022-10-15 20:00:05

Archive generated by hypermail 2.3.0.