Re: LF: ASM Question...Help please...


[Prev][Next][Index][Thread]

Re: LF: ASM Question...Help please...





On Wed, 4 Dec 1996, Tyler Klein wrote:

> There must be a formula for finding those functions. I mean the calculator
> isn't looking up a table when you punch in 392.48 degrees, It isn't
> practical to make a table big enough to hold all of those values.
> 
> (BIG snip)

	Yes, there is a formula for finding these functions.  Suppose x is
an angle given in radians (180 degrees = \pi radians).  Then:

If n! = n * (n-1) * (n-2) * . . . * 3 * 2 * 1 then we have:

cos x = 1 - x^2/2! + x^4/4! - x^6/6! + . . .
sin x = x - x^3/3! + x^5/5! - x^7/7! + . . .
tan x = (sin x)/(cos x)
(there is also one for arctan, but it is a bit hairy...)

	Note:  These require skill at decimal arithmetic, something the
68k processor is not good at.  Also, these series are INFINITELY long.
Decent accuracy takes some time, especially for large values of x.  This
is the reason why, when programming for speed, lookup tables are used.
True, a lookup table will be missing some values.  Simply rounding to the
nearest value usually suffices, however.


References: