function modulo(a, b) {
  const r = a % b;
  return r * b < 0 ? r + b : r;
}
Returns the modulo of a / b, depending on the sign of b.

@param {number} a Dividend.
@param {number} b Divisor.
@return {number} Modulo.