How to simulate C style integer division?

Paul Rubin no.email at nospam.invalid
Thu Jan 21 04:43:47 EST 2016


Ben Finney <ben+python at benfinney.id.au> writes:
> I'm not sure I know exactly what behaviour you want (“C style” may mean
> different things to each of us).

I thought he meant trunc-division, so -5 / 2 = -2 and -5 % 2 = -1.
Python specifies floor division but C leaves it unspecified, I thought.



More information about the Python-list mailing list