As per the docs, you can only set the precision globally.
Would it not make sense to be able to set the precision for a particular instance or operation?
For example, if precision is set globally to 4, but I have the following operation:
const a = new Decimal(7.2923)
const b = new Decimal(0.0255)
Decimal.add(a, b) // Result: 7.318, Expected: 7.3128
This is NOT what I want, but I'm setting the precision in my application in such a way that I cannot control its current value accurately. It would be much more desirable to control it at instance level (on new Decimal declaration).
Would it be possible to add it as a constructor option?
As per the docs, you can only set the precision globally.
Would it not make sense to be able to set the precision for a particular instance or operation?
For example, if precision is set globally to 4, but I have the following operation:
This is NOT what I want, but I'm setting the precision in my application in such a way that I cannot control its current value accurately. It would be much more desirable to control it at instance level (on
new Decimal
declaration).Would it be possible to add it as a constructor option?