Skip to content
Subhajit Sahu edited this page Aug 8, 2022 · 1 revision

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

Clone this wiki locally