floor - nodef/extra-math GitHub Wiki

Round down a number to specific precision.

Similar: floor, ceil, round.

function floor(x, pre?)
// x:   a number
// pre: to precision (1)
const xmath = require('extra-math');


xmath.floor(9.161, 1);
// → 9

xmath.floor(9.161, 0.01);
// → 9.16

xmath.floor(9.1617, 0.05);
// → 9.15

References