MikeMcl / decimal.js

An arbitrary-precision Decimal type for JavaScript
http://mikemcl.github.io/decimal.js
MIT License
6.35k stars 480 forks source link

Possible computation bug? #192

Closed yovanoc closed 2 years ago

yovanoc commented 2 years ago

Idk if I miss something but found an interesting bug today with the latest version.

const res = new Decimal(1).div(70000).sub(new Decimal(1).div(75000));
console.log(res.eq(0.000000952380952), res);

log

false 9.52380952380952381e-7

same numbers but with 12 in front