Re: Core Euphoria Functions
CChris wrote:
>
> Robert Craig wrote:
> >
> > George Orr wrote:
> > > To Rob and company -
> > >
> > > Is there a reason that we have the natural logarithm log(x) as a core
> > > Euphoria
> > > function but do not have exp(x)? I know I can get the equivalent using
> > > power(x,y)
> > > provided I remember the value of e to enough significant places.
> >
> > I didn't like to add lots of very simple global functions that
> > the programmer could create for himself, probably in
> > less time than it would take him to browse through the manual.
> >
> > We have "PI" in misc.e.
> > We could add "e" as well,
> > but I bet that would cause a lot of naming conflicts.
> >
> > Regards,
> > Rob Craig
> > Rapid Deployment Software
> > <a href="http://www.RapidEuphoria.com">http://www.RapidEuphoria.com</a>
>
> For largish values of x (around 12 iirc, I don't have my test files at hand),
> power(E,x) starts drifting from exp(x), even with the most accurate value of
> E as double..
> Introducing exp() would have the side benefit of not needing to define E -
> because
> of the likely name clashes -, since exp(1.0) would work well.
>
> CChris
I tried this and didn't really see any difference until x is larger than 20 and
insignificant differences afterwards.
For x = 30 difference between the power(x,y) and libm exp(x) solution was less
than 0.02 in ten trillion. Of course, libm could be unstable in this range as
well!
I don't really see a problem in accuracy, although I would prefer to have exp(x)
as a core Euphoria function.
George
|
Not Categorized, Please Help
|
|