1. Missing function

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

new topic     » topic index » view message » categorize

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

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu