Why 5//-2 or -5//2 is not -2 ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
29th Aug 2019, 7:39 PM
UraL
3 Answers
+ 7
See, flooring -2.5 to the next algebraic number that is lower gives -3, but not -2
29th Aug 2019, 7:51 PM
Moses Odhiambo
Moses Odhiambo - avatar
+ 7
floor division ( // ) always rounds down, not towards 0 but down. so -32.5 == -33 32.5 == 33
29th Aug 2019, 9:31 PM
Brave Tea
Brave Tea - avatar
+ 2
floor division is always round down. For example 10//3 = 3 but in normal division you will get exact decimals like this 10/3 = 3.3333
31st Aug 2019, 6:36 AM
vamsisaikrishna
vamsisaikrishna - avatar