-
Notifications
You must be signed in to change notification settings - Fork 15
expm1
Chung Leong edited this page Jan 10, 2022
·
3 revisions
expm1 - Exponential of e minus 1
float expm1( float $x )
expm1() raises e to the power of x and subtracts 1. The calculation is done in a way such that the result is accurate even if the value of x is near zero.
x - The exponent. It can be a scalar or an array.
exp( x ) - 1. If x is an array, the return value will also be an array.
On platforms where expm1() is absent from the standard C library (i.e. Windows), expm1() is approximated using a first order Taylor expansion when x is near zero:
if(fabs(x) < 1e-5) {
return x + 0.5 * x * x;
} else {
return exp(x) - 1.0;
}
1.0 and above.