Python:OverflowError:数学范围错误 [英] Python: OverflowError: math range error

查看:121
本文介绍了Python:OverflowError:数学范围错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试此计算时出现溢出错误,但我不知道为什么.

I get a Overflow error when i try this calculation, but i cant figure out why.

1-math.exp(-4*1000000*-0.0641515994108)

推荐答案

您要让math.exp计算的数字以十进制表示,超过110,000个数字.这稍微超出了double的范围,因此会导致溢出.

The number you're asking math.exp to calculate has, in decimal, over 110,000 digits. That's slightly outside of the range of a double, so it causes an overflow.

这篇关于Python:OverflowError:数学范围错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆