2
floor(3 / .1) == 30  
int(3 / .1) ==  30  
3 // .1 == 29

Why is this? Should I be careful when using // then? I have always assumed it is the same as int(x / y)...

Similarly found this for .1 .01 etc.

Bill Lynch
  • 80,138
  • 16
  • 128
  • 173
  • 2
    Albert appears to understand floating point math to some degree. I think his question here is why doesn't `3 // .1` act the same as `int(3 / .1)`, which is a reasonable question not covered by the global "go learn about floating point math" duplicate. – Bill Lynch Mar 16 '23 at 05:22
  • @BillLynch It's a duplicate. I was in the process of finding more links, such as [this one](https://stackoverflow.com/q/71267583/12299000) and [this one](https://stackoverflow.com/q/69421474/12299000), but I can't now since I am not allowed to close the question more than once. So now it will be open and probably attract superfluous answers. – kaya3 Mar 16 '23 at 05:24
  • @Amadan Yes, I just wasn't able to do so when the question had been re-opened. – kaya3 Mar 16 '23 at 05:29

0 Answers0