Re: Core Euphoria Functions
- Posted by George Orr <gorr at w?h.rr.?om> Jan 24, 2008
- 559 views
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> Rob - I actually use your solution myself, having added the value for e (I called it GSL_E since I borrowed it from the GNU Scientific Library code) and having added an exp(x) function using this value of e and the power(x,y) function. As a personal confession, I spent a good bit of time going through the manual looking for exp(x) which I was certain must be there after I found log(x). This may just be a personal problem, but others curious about Euphoria might make the same assumption and get turned off when they can't find exp(x), e, or any explanation of how they are expected to "invert" the provided log(x) function. If nothing else, perhaps a note in the log(x) manual entry indicating the use of power(x,y) to "invert" would be useful. As a side note, I did a quick comparison of using the power(x,y) solution to get to exp(x) versus linking to the libm exp(x) (on Linux). The timings are comparable, so I don't think there is a performance question here. I really like Euphoria as a primary language (for the complete amateur in my case) and just think not having complete "pairs" of elementary functions, like exp(x) to go with log(x), may be a turn off for others taking a quick look at the language. Thanks for Euphoria, by the way. I occasionally get drawn to other languages but seem to always come back! I think the basis of the language in sequences is very powerful and probably not well understood or used! I would like to see our user community grow as others come to appreciate your good work and the many great contributions of other Euphorians. Thanks! George