log1p() - 返回 log(1 + number),甚至当 number 的值接近零也能计算出准确结果 - php 数学函数
log1p()
(PHP 4 >= 4.1.0, PHP 5, PHP 7)
返回 log(1 + number),甚至当 number 的值接近零也能计算出准确结果
说明
log1p(float $number):floatlog1p()返回 log(1 +$number),甚至当$number的值接近零也能计算出准确结果。log()might only return log(1) in this case due to lack of precision.
参数
$number要处理的参数
返回值
log(1 +$number)
更新日志
版本 | 说明 |
---|---|
5.3.0 | 此函数在所有平台上均可用 |
参见
expm1()
返回 exp(number)- 1,甚至当 number 的值接近零也能计算出准确结果log()
自然对数log10()
以 10 为底的对数
Note that the benefit of this function for small argument values is lost if PHP is compiled against a C library that that not have builtin support for the log1p() function. In this case, log1p() will be compiled by using log() instead, and the precision of the result will be identical to log(1), i.e. it will always be 0 for small numbers. Sample log1p(1.0e-20): - returns 0.0 if log1p() is approximated by using log() - returns something very near from 1.0e-20, if log1p() is supported by the underlying C library. One way to support log1p() correctly on any platform, so that the magnitude of the expected result is respected: function log1p($x) { return ($x>-1.0e-8 && $x
内容声明:本文中引用的各种信息及资料(包括但不限于文字、数据、图表及超链接等)均来源于该信息及资料的相关主体(包括但不限于公司、媒体、协会等机构)的官方网站或公开发表的信息。部分内容参考包括:(百度百科,百度知道,头条百科,中国民法典,刑法,牛津词典,新华词典,汉语词典,国家院校,科普平台)等数据,内容仅供参考使用,不准确地方联系删除处理!本站为非盈利性质站点,本着为中国教育事业出一份力,发布内容不收取任何费用也不接任何广告!)