import math
a = 100
b = 110
e = 2.71828
x = (e**-a)*(a**b)/math.factorial(b)
print round(x, 5)
當a和b是大我得到這個消息:溢出錯誤:..long詮釋過大
Traceback (most recent call last):
File "<stdin>", line 5, in <module>
OverflowError: long int too large to convert to float
'math.factorial(b)'== 198之前小! == 1.98..e370比Double.MaxValue大 – 2014-09-11 08:21:10
似乎很明顯:值太大 – sapi 2014-09-11 08:21:23
如何解決這個問題? – 2014-09-11 08:22:57