exp()方法返回指數x: ex.
語法
以下是exp()方法的語法:
import mathmath.exp( x )
注意:此函數是無法直接訪問的,所以我們需要導入math模塊,然后需要用math的靜態對象來調用這個函數。
參數
返回值
此方法返回指數x: ex.
例子
下面的例子顯示了exp()方法的使用。
#!/usr/bin/pythonimport math # This will import math moduleprint "math.exp(-45.17) : ", math.exp(-45.17)print "math.exp(100.12) : ", math.exp(100.12)print "math.exp(100.72) : ", math.exp(100.72)print "math.exp(119L) : ", math.exp(119L)print "math.exp(math.pi) : ", math.exp(math.pi)
當我們運行上面的程序,它會產生以下結果:
math.exp(-45.17) : 2.41500621326e-20math.exp(100.12) : 3.03084361407e+43math.exp(100.72) : 5.52255713025e+43math.exp(119L) : 4.7978133273e+51math.exp(math.pi) : 23.1406926328
新聞熱點
疑難解答