Closed ghost closed 7 years ago
I tried the fllow code on https://npm.runkit.com/decimal.js
var decimalJs = require("decimal.js") new decimalJs .Decimal('10') .dividedBy('3') .mul('3') .toString()
Expect: 10 Actual: "9.9999999999999999999"
Please look at the result of Decimal('10').dividedBy('3'). Mathematically, that number multiplied by 3 is 9.9999999999999999999 not 10. This library does not store values as fractions.
Decimal('10').dividedBy('3')
3
9.9999999999999999999
10
I tried the fllow code on https://npm.runkit.com/decimal.js
Expect: 10 Actual: "9.9999999999999999999"