new topic     » goto parent     » topic index » view thread      » older message » newer message

I was playing with some ideas and writing code for them, when I
realized that I had no function exactly equivalent to exp(x),
which returns the famous "e" raised to the x power.  Sure, this
could be done by using the power() function and hard-coding "e" -
but how far in do you remember "e"?

So, I sat down with a piece of paper and a pen, and managed to
derive the following function:

global function exp(x)
  return power(n,x/log(n))
end function

where n is _any_ positive number (strictly greater than zero) -
except 1.0 exactly.

If x is 1, you will get the value of "e" to the limits of
Euphoria's precision in the power and log functions.
--
Jeff Zeitlin
jeff.zeitlin at mail.execnet.com

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu