Recently, I was confused by the modulo operator, % .
It is known that a % b == aa/b*b when we have integers a and b , where a > b , and we can do this calculation manually if a and b are small enough.
However, when it comes to how the processor calculates it, does it use the same method as the previously mentioned, aa/b*b ? Maybe just by translating the division into subtraction or addition, or is there some kind of bias possible?
language-agnostic modulo
pNok
source share