The modulo (sometimes called modulus) operation finds the remainder of division of one number by another
Subtraction is a mathematical operation that represents the removal of an object from a collection.
"With regard to implementation it also takes advantage of a bit of a non-obvious property of r precedence rules actually this is true of other languages as well such as c c++ and java namely that unary negative is higher than modulo which is higher than binary subtraction thus the calculation for is equivalent to"
from question "Condtionally create new columns based on specific numeric values (keys) from existing column"
"The reason is that the modulo is slower than subtraction"
from question "Numpy: Check if float array contains whole numbers"
"As you can see modulo is about an order of magnitude slower than subtraction"
from question "Why minus is slower than mod?"
"That is essentially the one case in which repeated subtraction 0 or 1 times a special case of repeated subtraction can be and commonly is but not necessarily faster than division-based modulo"
from question "Performance of modulus operator in C"
"The conditional test and subtraction is typically less expensive than a modulo especially if the sum does not frequently exceed mod"
from question "Modulus optimization in a program"
"As i said this may increase the speed especially in an environment where modulo is more expensive than simple subtraction but you would want to actually benchmark it to be certain"
from question "Method to find a factor of a number"