Python/ref math log1p
来自菜鸟教程
<languages />
Python math.log1p()方法
例
查找不同数字的对数(1+数字)
# Import math Library
import math
# Return the log(1+number) for different numbers
print(math.log1p(2.7183))
print(math.log1p(2))
print(math.log1p(1))
定义和用法
The
math.log1p()
方法返回log(1 + number),即使number的值接近于零,也以准确的方式进行计算。
句法
math.log1p(x)
参数值
| 参数 | 描述 |
|---|---|
| x | 需要。指定要处理的号码。如果该值为负数,则返回ValueError。如果该值不是数字,则返回TypeError |
技术细节
| 返回值: | A
|
| Python版本: | 2.6 |