如何在 python 中输入浮点无穷大字面量?
听说过
inf = float('inf')
是不可移植的。因此,我有以下建议:
inf = 1e400
这些是标准的还是可移植的?最佳做法是什么?
最佳答案
在 python 2.6如果 CPU 支持,它是可移植的
The float() function will now turn the string nan into an IEEE 754 Not A Number value, and +inf and -inf into positive or negative infinity. This works on any platform with IEEE 754 semantics.
关于python - 如何在python中输入浮点无穷大文字,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2919754/