TIP: Click on subject to list as thread! ANSI
echo: 80xxx
to: BRIAN MCCLOUD
from: JEAN-FRANCOIS GOBIN
date: 1997-04-11 15:02:00
subject: Transcendental Functions

Hello Brian ...
 > Does anyone have any good code for calculating some of the
 > transcendental
 > functions (exp, sin, cos would be enough... I already know how I
 > can do ln and
 > atan2, and the various hyperbolic and inverse functions can be
 > derived from
 > those five) using only 8087 instructions (no library calls, no
 > emulator
 > shortcuts, and no 387 FCOS/FSIN instructions)?
Hmmm ...
I think you know (since Taylor said it long ago!) that each continuous 
function (which is derivable in the open segment considered, but that's the 
case for the function you ask!) can be represented by its Polynomial forms.
For ex. :
exp(x)= sum for i=0 to infinite of (x^i)/(i!), with
0!=1 and x^0=1 too.
That can be expressed as :(with eps = precision required)
sum=1+x;
factor=x;
for(i=2;fabs(factor)>eps,i++)
  {
   factor=(factor*x/i);
   sum+=factor;
  }
(I tried to make it in asm, but my knowledge of x87 is a bit short!)
and
cos(x)= sum for i=0 to infinite of 1+(-1)^i*(x^(2*i+1))/(2*i+1)!
sin(x)= sum for i=0 to infinite of (-1)^(i+1)*(x^(2*i))/(2*i)!
                                             ùPouceù
-* Champlon (Belgique) ... Perdu au milieu de la Foret !
--- FMail 1.0g
---------------
* Origin: - The Alenia BBS - Gobin Jean-Francois SysOp (2:293/3212.83)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.