в python использовать приведение к целому как int(x) нужно очень осторожно #python #programming #bug : https://stackoverflow.com/questions/6569528/python-float-to-int-conversion
Stack Overflow
Python float to int conversion
Basically, I'm converting a float to an int, but I don't always have the expected value.
Here's the code I'm executing:
x = 2.51
print("--------- 251.0")
y = 251.0
print(y)
print(int(y))
print(...
Here's the code I'm executing:
x = 2.51
print("--------- 251.0")
y = 251.0
print(y)
print(int(y))
print(...