in Java or Python this function is given by the % operator. I would like to know the mathematical algorithm that uses this function.
Asked
Active
Viewed 314 times
0
-
3Read the relevant sections of the language specs, e.g. [Java](https://docs.oracle.com/javase/specs/jls/se14/html/jls-15.html#jls-15.17.3). Note that % in Java is the remainder operator, not the mod operator, and has different semantics to e.g. python. – Andy Turner Jan 12 '22 at 17:01
-
4[How does Python implement the modulo operation?](https://stackoverflow.com/questions/18198308/how-does-python-implement-the-modulo-operation) – Stef Jan 12 '22 at 17:03
-
The mod (or %) operator is usually not implemented at the language level, but invokes the native function supported by the processor itself. The processor probably uses the same machinery as for the division, but the details are not disclosed. – Jan 18 '22 at 10:04