lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> Just out of curiosity, does anyone need any of those hyperbolic functions?
> 
> They are easily implemented as (exp(x) - exp(-x)) / 2,
> (exp(x) + exp(-x)) / 2, and sinh(x) / cosh(x). Shouldn't we need their
> inverses, too (asinh, acosh, atanh)?

My principle here was that since they're provided in the standard math
library, and since you've exposed all the other functions provided there,
you should expose these.

The argument "but they're simply implemented as E" is false, because as
any numerical analyst will tell you, most such functions are *never*
simply implemented (the above reasoning holds true for mathematical
numbers, but not for floating point arithmetic, where it's scarily easy
to get huge errors by assuming mathematical identities).

-- 
http://sc3d.org/rrt/ | Maximiste, n.  pessimiste