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.

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
5.0.0
0latest

Version History

VersionDownloads (Last 7 Days)Published
5.0.0
0
4.0.00
3.0.11
3.0.00
2.0.01
1.0.10
1.0.00

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