I wanted to ask here a question about a simple algoirhtm to compute
a div d and
a mod d. My doubt specifically depend on negative numbers:
Doesn't the algorithm get wrong results for $-4$ and $2$ for instance, since the reminder of that division is 0? In this case the algorithm should give a quotient of $2$, But i image it should be $-2$, am i right?