Python, unlike C, has the mod operator always return a positive number
Doesn’t C just do whatever the underlying hardware does for modulo w negative numbers? I have always worked around this by adding N to numerator:<p><pre><code>    r = (i + N) % N
</code></pre>
which handles cases where i >= -N which is mostly what I run into when i is negative.<p>I remember Ada having two different operators REM and MOD which I think is the best language choice.