Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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: 19 days 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 (about 7 years ago)
- Default Branch: master
- Last Pushed: 2022-12-06T17:05:00.000Z (about 2 years ago)
- Last Synced: 2024-12-17T02:38:37.458Z (25 days ago)
- Topics: javascript, nodejs, number-round, number-systems
- Language: JavaScript
- Homepage:
- Size: 103 KB
- Stars: 6
- Watchers: 2
- 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`