用法:
math.expm1(x)
返回
e
的冪x
,減 1。這裏e
是自然對數的底。對於小浮點數x
,exp(x) - 1
中的減法可能會導致 significant loss of precision ;expm1()
函數提供了一種以全精度計算此數量的方法:>>> from math import exp, expm1 >>> exp(1e-5) - 1 # gives result accurate to 11 places 1.0000050000069649e-05 >>> expm1(1e-5) # result accurate to full precision 1.0000050000166668e-05
3.2 版中的新函數。
相關用法
- Python math.exp()用法及代碼示例
- Python math.erf用法及代碼示例
- Python math.cos()用法及代碼示例
- Python math.cosh()用法及代碼示例
- Python math.acosh()用法及代碼示例
- Python math.fmod()用法及代碼示例
- Python math.fsum()用法及代碼示例
- Python math.factorial()用法及代碼示例
- Python math.remainder()用法及代碼示例
- Python math.asinh()用法及代碼示例
- Python math.prod()用法及代碼示例
- Python math.atanh()用法及代碼示例
- Python math.fabs()用法及代碼示例
- Python math.log1p()用法及代碼示例
- Python math.gcd()用法及代碼示例
- Python math.frexp()用法及代碼示例
- Python math.isqrt()用法及代碼示例
- Python math.ldexp()用法及代碼示例
- Python math.acos()用法及代碼示例
- Python math.sin()用法及代碼示例
注:本文由純淨天空篩選整理自python.org大神的英文原創作品 math.expm1。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。