Running the following code in Python produces a somewhat unexpected result. Now, I might have understood the discrepancy if both results were the same, because of how floating point numbers are stored in binary. The question is why is the second result different from the first one? Is there a difference in how / and // work besides the latter
Tag: floor-division
How is floor division not giving result according to the documented rule?
Why floor division is not working according to the rule in this case? p.s. Here Python is treating 0.2 as 0.20000000001 in the floor division case So (12/0.2000000001) is resulting in 59.999999… And floor(59.999999999) outputting 59 But don’t know why python is treating 0.2 as 0.2000000001in the floor division case but not in the division case? Answer The reason why