Skip to content

roundDiv

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

Perform rounded-divison of two numbers.

Similar: floorDiv, ceilDiv, roundDiv.


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

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


xnumber.roundDiv(15, 4);
// → 4

xnumber.roundDiv(2, 2);
// → 1

xnumber.roundDiv(-15, 4);
// → -4


References