Python - np.inf 不大于数字 [英] Python - np.inf not larger than number
本文介绍了Python - np.inf 不大于数字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
为什么 np.inf >1e999
返回 False?
Why np.inf > 1e999
returns False?
我使用的是 Python 3.7
I'm using Python 3.7
推荐答案
符号 1e999
导致浮点数 -- 而这个浮点数大于可能的最大值.所以 1e999
变成了 inf
.
The notation 1e999
results in a float -- and this float is larger than the maximum possible value. So 1e999
becomes inf
.
Ipython 中的快速测试:
A quick test in Ipython:
In [11]: 1e999 == np.inf
Out[11]: True
这篇关于Python - np.inf 不大于数字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文