Round a number down (towards zero) to the nearest multiple of significance.
This is just like the FLOOR
function in Microsoft Excel.
const sigFloor = require('sig-floor');
// round to the nearest multiple of 2
sigFloor(2.5, 2);
// => 2
// round to the nearest multiple of -2
sigFloor(-2.5, -2);
// => -2
// round to the nearest multiple of 0.1
sigFloor(1.5, 0.1);
// => 1.5
// round to the nearest multiple of 0.01
sigFloor(0.234, 0.01);
// => 0.23
$ npm install sig-floor
const sigFloor = require('sig-floor');
Given the Number number
that you want to round, returns the floor of
number
to the Number significance
multiple.