Re: Implementation of exp()
- Posted by Al Getz <Xaxo at aol.c??> Aug 28, 2007
- 582 views
CChris wrote: > > Al Getz wrote: > > > > Hi there, > > > > > > If you dont like the results of power(e,x) then the only alternative > > is to implement your own power series. Taylors is the most popular > > and easy to implement, so maybe start there and check the accuracy > > of that and compare with power(e,x). > > Most of the time when i use exp(x) i implement as power(e,x) unless > > i need better accuracy then i go to a big number routine, but > > either way i end up using x negative because that comes up so much > > more in time domain studies of electrical networks and even networks > > that represent other physical processes. > > > > Example: > > y=a*exp(-t/b) > > where t is time and a,b are constants depending on circuit values > > and b is almost always positive. > > > > > > Al > > > > E boa sorte com sua programacao Euphoria! > > > > > > My bumper sticker: "I brake for LED's" > > > > No need for such efforts, the standard C library has done it way before us. > It has a native exp() function, which I checked against arbitrary precision > computation: the native exp() doesn't have issues, only power(E,x) has. And > i is not because the value of E is inexact - things are ok as long as x is no > greater than 7 or something. > > The implementation would duplicate the code for sin(), with a check for > overflow > (the maximum allowable value for x is 1024*ln(2), which is about 694). > > CChris > > CChris You mean only the Euphoria version of power(e,x) doesnt work right? Take care, Al E boa sorte com sua programacao Euphoria! My bumper sticker: "I brake for LED's" From "Black Knight": "I can live with losing the good fight, but i can not live without fighting it". "Well on second thought, maybe not."