expm1 - chung-leong/qb GitHub Wiki
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.
Parameters:
x - The exponent. It can be a scalar or an array.
Return Value:
exp( x ) - 1. If x is an array, the return value will also be an array.
Notes:
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;
}
Version
1.0 and above.