operator + method

Fixed operator +(
  1. Fixed addition
)

Returns this + addition

The resulting scale is the larger scale of the two operands.

Implementation

Fixed operator +(Fixed addition) {
  final targetScale = max(scale, addition.scale);

  final scaledThis =
      _rescale(minorUnits, existingScale: scale, targetScale: targetScale);
  final scaledAddition = _rescale(addition.minorUnits,
      existingScale: addition.scale, targetScale: targetScale);

  return Fixed.fromBigInt(scaledThis + scaledAddition, scale: targetScale);
}