expm1

(PHP 4 >= 4.1.0, PHP 5)

expm1 --  返回 exp(number) - 1,甚至当 number 的值接近零也能计算出准确结果

说明

float expm1 ( float number )

警告

本函数是实验性的。本函数的行为,包括函数名称以及其它任何关于本函数的文档可能会在没有通知的情况下随 PHP 以后的发布而改变。使用本函数风险自担。

expm1() 返回 'exp(number) - 1',甚至当 number 的值接近零也能计算出准确结果。但是当两个数值趋近于相等的时候, 'exp (number) - 1' 就会变得不太准确。

注: 本函数未在 Windows 平台下实现。

参见 log1p()exp()


add a note add a note User Contributed Notes
hagen at von-eitzen dot de
24-Feb-2003 07:57
Compare this to log1p (which is its inverse).

Also, You may have to use a similar workaraound in case the underlying C library
does not support expm1:

function expm1($x) {
     return ($x>-1.0e-6 && $x<1.0e-6) ? ($x + $x*$x/2) : (exp($x)-1);
}