operator - method

Decimal operator -(
  1. Decimal other
)

Calculates difference of this and the argument.

The return value will have fractionDigits that's max(this.fractionDigits, other.fractionDigits).

Implementation

Decimal operator -(Decimal other) {
  var a = nominator;
  var b = denominator;
  var otherA = other.nominator;
  final otherB = other.denominator;
  if (b < otherB) {
    a *= (otherB ~/ b);
    b = otherB;
  } else if (b > otherB) {
    otherA *= (b ~/ otherB);
  }
  a -= otherA;
  return _IntDecimal(a, b);
}