Try it yourself:


rem(): Division Remainder

rem() returns the remainder after division. For rem(17, 5), the result is 2. It is useful for cycles, divisibility checks, and wrapping positions.

Signs and zero

The divisor must not be zero. Remainder sign conventions can matter with negative operands, so test the behavior required by your application. Use divide() for the quotient and mod() when a modulo convention is specifically needed.

Check divisibility with equal(): rem(n, d) equal to zero means d divides n. Pair with floor() when constructing quotient-and-remainder calculations.

All functions