4 ms·
Mod and Remainder are not the same
- theamk 6y agoMy personal rule for "%" operator is: avoid using it with any negative numbers. If you have to, comment well what kind of semantics you expect, and make sure you test this semantics. Programming is about reading the code almost as much as it is about writing it. Writing "% -12" might seem cute, but it will make it harder for the next person to understand what's going on.