【发布时间】:2013-04-23 16:20:50
【问题描述】:
我尝试在 python 中计算泊松分布如下:
p = math.pow(3,idx)
depart = math.exp(-3) * p
depart = depart / math.factorial(idx)
idx 范围为 0
但我得到了OverflowError: long int too large to convert to float
我尝试将离开转换为float,但没有结果。
【问题讨论】:
-
阶乘变得真的大,真的快
-
遇到此错误时 idx 的值是多少?
-
当你想计算阶乘时,用对数代替