Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
uberneo
on July 25, 2019
|
parent
|
context
|
favorite
| on:
Cryptocurrency trading bot in ~40 lines of JavaScr...
This will work!!
parseFloat((0.2 * 0.1).toFixed(10))
treve
on July 25, 2019
[–]
The issue is more obvious when rounding something like 0.5, which, due to lack of precision can become either 0 or 1.
Shameless plug: use
https://www.npmjs.com/package/bigint-money
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search:
parseFloat((0.2 * 0.1).toFixed(10))