5.0.0 • Published 8 months ago

sig-floor v5.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
8 months ago

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.

5.0.0

8 months ago

4.0.0

1 year ago

3.0.1

2 years ago

3.0.0

3 years ago

2.0.0

4 years ago

1.0.1

8 years ago

1.0.0

9 years ago