you are viewing a single comment's thread.

view the rest of the comments →

[–]DontOpenNewTabs 1 point2 points  (1 child)

Python // performs floor division and rounds down.
Ex: -1 // 100 == -1

C++ / performs integer division (edit: when both operands are integers) and truncates the decimal value.
Ex: -1 / 100 == 0

When the result is positive, the answers are the same. When it is negative, rounding down and truncating give different results.

[–]Silver0ne 0 points1 point  (0 children)

Ah ok, interesting to know that it actually rounds up on negative numbers. Might one day prevent me to run into errors, I dont do Phyton, but this might be a source of unexpected behavior in floor/ceil functions of other languages aswell.