I would love to use bignumber.js to perform a lot of financial calculations including many-many fixation to several digits.
I see the toFixed function which makes the magic but it convers the number to String.
When I multiple then fix, then substract another value then fix again means a lot of string conversion and parse. Is there a way to eliminate the string-based operation?
balance.Physical = new BigNumber(balance.Debit).minus(balance.Credit).times(multiplier).toFixed( rounding )
balance.Available = new BigNumber(balance.Physical).minus(balance.Blocked).toFixed( rounding )
Current code contains 2 fix. 2 string conversion and parse which should be eliminated.:)
Hey,
I would love to use bignumber.js to perform a lot of financial calculations including many-many fixation to several digits. I see the toFixed function which makes the magic but it convers the number to String. When I multiple then fix, then substract another value then fix again means a lot of string conversion and parse. Is there a way to eliminate the string-based operation?
Current code contains 2 fix. 2 string conversion and parse which should be eliminated.:)
Thanks!