add method

LexoInteger add(
  1. LexoInteger other
)

Implementation

LexoInteger add(LexoInteger other) {
  checkSystem(other);
  if (isZero()) {
    return other;
  }
  if (other.isZero()) {
    return this;
  }
  if (!identical(sign, other.sign)) {
    var pos;
    if (identical(sign, -1)) {
      pos = negate();
      final val = pos.subtract(other);
      return val.negate();
    }
    pos = other.negate();
    return subtract(pos);
  }
  final result = LexoInteger.Add(sys, mag, other.mag);
  return LexoInteger.make(sys, sign, result);
}