remainder method

  1. @override
i4 remainder(
  1. dynamic other
)
override

The remainder of the truncating division of this by other.

The result r of this operation satisfies: this == (this ~/ other) * other + r. As a consequence, the remainder r has the same sign as the divider this.

Implementation

@override
i4 remainder(dynamic other) {
  if (other is integer) {
    return i4(value.remainder(other.value));
  } else if (other is int) {
    return i4(value.remainder(other));
  } else if (other is double) {
    return i4((value.remainder(other)).truncate());
  } else {
    throw Exception('Invalid type for operand: ${other.runtimeType}');
  }
}