matician - v2.0.0
    Preparing search index...

    Function modulo

    • Returns the remainder after dividing a by b.

      This is the modulo operation, which follows the sign of the dividend (a).

      Parameters

      • a: number

        The dividend.

      • b: number

        The divisor.

      Returns number

      The remainder of a divided by b.

      Will throw an error if b is zero.

      modulo(10, 3);  // returns 1
      modulo(-10, 3); // returns -1
      modulo(10, -3); // returns 1