Skip to content
Advertisement

Tag: integer-division

What’s the mathematical reason behind Python choosing to round integer division toward negative infinity?

I know Python // rounds towards negative infinity and in C++ / is truncating, rounding towards 0. And here’s what I know so far: But why Python // choose to round towards negative infinity? I didn’t find any resources explain that, but only find and hear people say vaguely: “for mathematics reasons”. For example, in Why is -1/2 evaluated to

Advertisement