downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

floor> <exp
Last updated: Fri, 13 Nov 2009

view this page in

expm1

(PHP 4 >= 4.1.0, PHP 5)

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

说明

float expm1 ( float $number )
Warning

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

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

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

参见 log1p()exp()



add a note add a note User Contributed Notes
expm1
brettz9 AAT yah
03-Apr-2009 04:07
Note that exp(x)-1 can be approximated by x + x^2/2! + ... + x^n/n!  and for any value
hagen at von-eitzen dot de
24-Feb-2003 11: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);
}

floor> <exp
Last updated: Fri, 13 Nov 2009
 
 
show source | credits | sitemap | contact | advertising | mirror sites