0.1.3 • Published 6 years ago

number-roundto v0.1.3

Weekly downloads
1
License
MIT
Repository
-
Last release
6 years ago

number-roundto

NOTE: number-roundto was renamed to @extra-number/round. NPM

Round number to specific precision.

Helps to deal with number precision problems.

const roundTo = require('number-roundto');
// roundTo(<value>, [precision])

// 1. round to specific precision
roundTo(9.135, 1);
// 9
roundTo(9.135, 1e-2);
// 9.14
roundTo(9.1357, 0.05);
// 9.15

// 2. round precision errors
0.1*0.2
// 0.020000000000000004
roundTo(0.1*0.2);
// 0.02
0.1.3

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago