Does PEMDAS rule not apply to the bigNumber library? #3063
Webster1234
started this conversation in
General
Replies: 1 comment
-
BigNumber does not perform symbolic computation, if that’s what you mean? Methods are evaluated left-to-right; this is part of JavaScript method invocation (and I think all OO and OO-adjacent languages?). Also, keep in mind that BigNumber is only for integer maths, so there would never be any decimal component. Does that make sense? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Does PEMDAS rule not apply to the bigNumber library?
console.log(ethers.BigNumber.from('2').add(ethers.BigNumber.from('4')).div(ethers.BigNumber.from('6')))
And I got 1 not 2.66666666667
Beta Was this translation helpful? Give feedback.
All reactions