bignumber.js
bignumber.js copied to clipboard
Not able to calculate negative pow greater than 20
I found that if the pow is -21
, the library returns 0.
> BigNumber(10).pow( -20 ).toFixed()
"0.00000000000000000001"
> BigNumber(10).pow( -21 ).toFixed()
"0"
I know this is old, but I'm putting this here in case somebody else runs into a similar problem.
BigNumber.Config.DECIMAL_PLACES
defaults to 20, so anything below that gets rounded by BigNumber.ROUND_HALF_UP
, which results in 0.