Skip to content
Subhajit Sahu edited this page Aug 9, 2022 · 2 revisions

Find the remainder of x/y with sign of y (floored division).

Similar: rem, mod, modp.


function mod(x, y)
// x: dividend
// y: divisor

const xnumber = require('extra-number');


xnumber.mod(1, 10);
// → 1

xnumber.mod(-1, 10);
// → 9

xnumber.mod(1, -10);
// → -9


References

Clone this wiki locally