Function modulo

  • Implemented with the % operator, so it follows the JavaScript specification that the sign of a % b is the sign of a, and values are not required to be integers. See mathModulo for a function that follows Knuth's definition, better reflecting the use of mod in mathematics.

    Example

    import * as N from "flurp/number";

    const modTen = N.modulo(10);
    modTen(12); // 2.5
    modTen(-12.5); // -2.5

    Parameters

    • y: number

    Returns ((x: number) => number)

      • (x: number): number
      • Parameters

        • x: number

        Returns number