Modulo

The modulo (sometimes called modulus) operation finds the remainder of division of one number by another

Subtraction

Subtraction is a mathematical operation that represents the removal of an object from a collection.

Others

Example |
---|

As i said this may increase the speed especially in an environment where modulo is from question Method to find a factor of a number |

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 from question Performance of modulus operator in C |

The conditional test and subtraction is from question Modulus optimization in a program |

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 from question Condtionally create new columns based on specific numeric values (keys) from existing column |

As you can see modulo is about an order of magnitude from question Why minus is slower than mod? The reason is that the modulo is from question Numpy: Check if float array contains whole numbers |