1. Missing function
- Posted by Jeff Zeitlin <jeff.zeitlin at EARTH.EXECNET.COM>
Jul 26, 1997
-
Last edited Jul 27, 1997
Ooopsie! There's a missing function in Euphoria!
There's a log function that returns the natural (base e)
logarithm of a number, but there's no inverse function for it -
i.e., there's no function that, when passed the value 1, will
return the value of e.
Yes, I know I can approximate it with 2.718281828459045, but...
Jeff Zeitlin =
jeff.zeitlin at earth.execnet.com
2. Re: Missing function
A few days ago Jeff Zeitlin wrote:
> There's a log function that returns the natural (base e)
> logarithm of a number, but there's no inverse function for it -
> i.e., there's no function that, when passed the value 1, will
> return the value of e.
> Yes, I know I can approximate it with 2.718281828459045, but...
In some languages this function is called "exp".
constant e=2.718281828459045
function exp(object x)
-- returns e to the x (inverse of Euphoria log function)
-- x can be an atom or a sequence
return power(e, x)
end function
? exp(1) -- 2.71828 (use printf to see more digits)
? exp({0, 1.5, -2}) -- {1, 4.48169, 0.135335}
? log(exp({0, 1.5, -2})) -- {0, 1.5, 2}
Regards,
Rob Craig
Rapid Deployment Software