Closed bendavies closed 2 years ago
Hi,
Is there anyway to accept any resulting scale without doing an rounding? Best with an example:
BigDecimal::of('1')->dividedBy('1000');
will result in RoundingNecessaryException, but really i want to allow the scale to be set to whatever is necessary. i.e i want to result to be:
RoundingNecessaryException
BigDecimal::ofUnscaledValue(1, 3)
My work around at the moment is:
BigRational::of('1/1000')->toBigDecimal();
which gets me the result i want.
Thanks!
i found BigDecimal::exactlyDividedBy()!
BigDecimal::exactlyDividedBy()
Hi,
Is there anyway to accept any resulting scale without doing an rounding? Best with an example:
will result in
RoundingNecessaryException
, but really i want to allow the scale to be set to whatever is necessary. i.e i want to result to be:My work around at the moment is:
which gets me the result i want.
Thanks!