0

Full division on negative numbers

Heya, Can someone explain to me the logic behind : print(-11//3) -4 ??why a full division of -11 by 3 is -4 and not -3? Thanks in advance.

23rd Apr 2017, 3:24 PM
matan
3 Answers
+ 6
Floor division works this way - it does not round to zero. Rather, it always returns the *next lower* integer, whether positive or negative. BTW, that's why it's called *floor* not "integer" or something.
23rd Apr 2017, 3:31 PM
Kuba SiekierzyƄski
Kuba SiekierzyƄski - avatar
+ 1
-11/3 is -3.6666666 ... // is floor division and floor division rounds down.. It rounded down to -4
23rd Apr 2017, 3:29 PM
LordHill
LordHill - avatar
+ 1
I see I see, thanks!
24th Apr 2017, 11:45 AM
matan