operator + method

FdcDecimal operator +(
  1. Object other
)

Adds other to this decimal and keeps the larger operand scale.

Implementation

FdcDecimal operator +(Object other) {
  final right = _coerceOperand(other, operation: '+');
  final commonScale = scale > right.scale ? scale : right.scale;
  final leftScaled = _rescaleExact(
    scaledValue,
    fromScale: scale,
    toScale: commonScale,
  );
  final rightScaled = _rescaleExact(
    right.scaledValue,
    fromScale: right.scale,
    toScale: commonScale,
  );
  return FdcDecimal.fromScaled(leftScaled + rightScaled, scale: commonScale);
}