subtract method

LexoDecimal subtract(
  1. LexoDecimal other
)

Implementation

LexoDecimal subtract(LexoDecimal other) {
  var thisMag = mag;
  var thisSig = sig;
  var otherMag = other.mag;
  num otherSig;
  for (otherSig = other.sig; thisSig < otherSig; ++thisSig) {
    thisMag = thisMag.shiftLeft();
  }
  while (thisSig > otherSig) {
    otherMag = otherMag.shiftLeft();
    ++otherSig;
  }
  return LexoDecimal.make(thisMag.subtract(otherMag), thisSig);
}