operator + method

PgDecimal operator +(
  1. PgDecimal other
)

Implementation

PgDecimal operator +(PgDecimal other) {
  if (_kind != _finite || other._kind != _finite) {
    if (_kind == _nan || other._kind == _nan) return nan;
    if (_kind == _finite) return other;
    if (other._kind == _finite) return this;
    return _kind == other._kind ? this : nan;
  }
  final scale = _scale > other._scale ? _scale : other._scale;
  return PgDecimal._finiteValue(
      _upscale(_unscaled, _scale, scale) +
          _upscale(other._unscaled, other._scale, scale),
      scale);
}