operator % method

  1. @override
Number operator %(
  1. Number other
)
override

Euclidean modulo operator.

Returns the remainder of the euclidean division. The euclidean division of two integers a and b yields two integers q and r such that a == b * q + r and 0 <= r < b.abs().

The euclidean division is only defined for integers, but can be easily extended to work with doubles. In that case r may have a non-integer value, but it still verifies 0 <= r < |b|.

The sign of the returned value r is always positive.

See remainder for the remainder of the truncating division.

Implementation

@override
Number operator %(Number other) => (other is Decimal)
    ? Decimal.fromInt(value) % other
    : Integer(value % (other as Integer).value);