https://github.com/sunopar/round-js
Dealing with JavaScript's numerical round problems
https://github.com/sunopar/round-js
javascript nodejs number-round number-systems
Last synced: 3 months ago
JSON representation
Dealing with JavaScript's numerical round problems
- Host: GitHub
- URL: https://github.com/sunopar/round-js
- Owner: sunopar
- License: mit
- Created: 2017-11-05T01:28:23.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2022-12-06T17:05:00.000Z (over 2 years ago)
- Last Synced: 2025-04-12T05:44:02.576Z (3 months ago)
- Topics: javascript, nodejs, number-round, number-systems
- Language: JavaScript
- Homepage:
- Size: 103 KB
- Stars: 6
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# round-js
Dealing with JavaScript's round problem## why use round-js
when we want to round a number with float, something will go that doesn't what we expect if use `Number.toFixed`. Consider the situation below:```
10.145.toFixed(2) --> 10.14
```
the equation will return 10.14, but what we expect is 10.15.## how to use round-js
```
npm install --save so-round
```
in file```
import round from 'so-round'
round(10.145,2) ---> 10.15
```more detail can be inspect from `test/round.test.js`