Closed riverfrot closed 4 years ago
In the example code, i do not see you initialising receivedvalue. Moreover, you are not using it as expected. Your data is not a string or bigdecimal.
Here is a working example:
var big = require("js-big-decimal")
a = new big('1e21');
b = new big('1e18')
console.log(a)
console.log(b)
console.log(a.divide(b))
Describe the bug A clear and concise description of what the bug is.
An error occurs when dividing with a number greater than 1e21.
To Reproduce Steps to reproduce the behavior, preferably with sample code.
const data = 1e21 multiplier = new bigDecimal(Math.pow(10, 18)); console.log(data / multiplier.value) let divideAsset = bigDecimal.divide(received.toString(), multiplier.value, 18) console.log('divideAsset') console.log(divideAsset) ===> 10.000000000000000000(error)
Expected behavior A clear and concise description of what you expected to happen. ===> 1000.0000000000000000(Normal case)
Additional context Add any other context about the problem here.