operator + method

Decimal operator +(
  1. Decimal other
)

Adds two exact values and checks the supported result range.

Implementation

Decimal operator +(Decimal other) {
  final common = math.max(scale, other.scale);
  return Decimal.fromBigInt(
    coefficient * _power(common - scale) +
        other.coefficient * _power(common - other.scale),
    scale: common,
  );
}