modulusI function

int modulusI(
  1. int dividend,
  2. int divisor
)

Canonical Modulus. The result has the sign of the divisor.

Implementation

int modulusI(int dividend, int divisor) =>
    ((dividend % divisor) + divisor) % divisor;