max*_*max 1 python floating-point python-3.x
作为其他一些计算的一部分,我注意到我有时应用float()然后int()函数为整数输入.可以安全地假设:
int(float(x)) == x
Run Code Online (Sandbox Code Playgroud)
如果x是整数?
为什么?(或者为什么不呢?)它是否记录在任何地方?
如果x需要比双精度浮点数提供的精度更高的精度,则比较将失败.
>>> int(float(10**23))
99999999999999991611392L
Run Code Online (Sandbox Code Playgroud)