Modulo operator %
on negative numbers is implemented in different way in python and in C. In C:
-4 % 3 = -1
, while in python:-4 % 3 = 2
.
I know how to implement python-like modulo in C. I wonder how to do the reverse, that is: easily implement a C-like modulo in python.