Computes the true modulo of a number, ensuring a non-negative result.
This function returns the remainder of the division of n by m, always yielding a result in the range [0, m), even if n is negative.
n
m
[0, m)
The dividend.
The divisor (must be a non-zero integer).
The non-negative remainder after dividing n by m.
mod(5, 3); // returns 2mod(-1, 3); // returns 2 Copy
mod(5, 3); // returns 2mod(-1, 3); // returns 2
Computes the true modulo of a number, ensuring a non-negative result.
This function returns the remainder of the division of
nbym, always yielding a result in the range[0, m), even ifnis negative.