modp - nodef/extra-math GitHub Wiki

Find the remainder of x/y with +ve sign (euclidean division).

Similar: rem, mod, modp.

function modp(x, y)
// x: dividend
// y: divisor
const xmath = require('extra-math');


xmath.modp(1, 10);
// → 1

xmath.modp(-1, 10);
// → 9

xmath.modp(1, -10);
// → 1

References