[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Need for missing functions expm1 and log1p
- From: SJain <zzsj@...>
- Date: Sat, 21 Aug 2021 09:06:07 +0530
For small x << 1, there is loss of several digits of precision when calculating exp(x)-1 from exp(x), because we are taking the difference of two numbers almost equal to each other and to 1. Likewise there is similar error in computing ln(1+x), sinh(x), asinh(x), tanh(x) etc for small x.
ANSI Forth, C and x87 FPU provide the instructions expm1(x) and log1p(x) to meet this need. Furthermore given these two functions one can compute all hyperbolic functions for the entire range of x, which is of use and interest in scientific applications of Lua. Therefore I request that expm1 and log1p be provided in Lua.