sig-floor

5.0.0 • Public • Published

sig-floor

Round a number down (towards zero) to the nearest multiple of significance. This is just like the FLOOR function in Microsoft Excel.

Example

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

Installation

$ npm install sig-floor

API

const sigFloor = require('sig-floor');

sigFloor(number, significance)

Given the Number number that you want to round, returns the floor of number to the Number significance multiple.

Dependencies (0)

    Dev Dependencies (8)

    Package Sidebar

    Install

    npm i sig-floor

    Weekly Downloads

    2

    Version

    5.0.0

    License

    MIT

    Unpacked Size

    2.96 kB

    Total Files

    4

    Last publish

    Collaborators

    • kenan