Can someone help me understanding negative floor division? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Can someone help me understanding negative floor division?

I noticed that negative floor division behaves different than the positive one. The point I noticed that was when I saw a code when - 11// 3 = - 4 instead of 3 as I expected. So I wrote a code to compare positive and negative floor division and it seems like there is indeed a difference. Can somebody help me understand this? https://code.sololearn.com/cDMn1fLF1xoG/?ref=app

20th Sep 2020, 9:29 AM
Stefan
Stefan - avatar
1 Answer
+ 3
Yeah this I understand but shouldn't this be the same for positive and negative values? I mean if it's + oder - 4 I will divide through 3 it will be in both cases just fit in 1 time. For positive values this is true but for negative its 2.
20th Sep 2020, 9:40 AM
Stefan
Stefan - avatar