rounded method

Decimal rounded(
  1. int scale, {
  2. DecimalRounding rounding = DecimalRounding.exact,
})

Rounds to an explicit scale; the default rejects lost precision.

Implementation

Decimal rounded(
  int scale, {
  DecimalRounding rounding = DecimalRounding.exact,
}) {
  validateScale(scale);
  if (scale >= this.scale) return this;
  return _quotient(coefficient, _power(this.scale - scale), scale, rounding);
}