+ 4
A bug I think, in python math operations.
Can someone plz help me on this topic. I ran the following code : >>> print(80230405525183383738%3) print(80230405525183383738.0%3) >>> I expected both answers to be 0, cuz 80230405525183383738 is divisible by 3 i.e. the remainder is supposed to be 0. But the reasult is : >>> 0 1.0 >>> I cannot understand why.
2 Respuestas
+ 3
Maybe it has problem with converting to binary. It calculate in binary each operation. It's recommended to work with integer type if you use big amount of number. In float type it can do mistake like:
print(33333333333333318.0%3)
>>> 2.0
print(333333333333333318.0%3)
>>>0.0
+ 3
Thank you, Merdan Atamyradow.