# mod

mod(x, y)

Modulus after division, returning in the range [0,`y`), if `y` is positive, or (`y`,0] if `y` is negative.

## Examples

1. Calculate modulus with positive divisor:

``````julia> mod(10, 3)
1``````

The `mod` function returns the remainder when `10` is divided by `3`. In this case, the result is `1`.

2. Modulus with negative divisor:

``````julia> mod(10, -3)
-2``````

When the divisor is negative, the `mod` function returns a value within the range (`y`, `0`]. In this case, the result is `-2`.

3. Modulus with floating-point numbers:

``````julia> mod(10.5, 3)
1.5``````

The `mod` function works with floating-point numbers as well. It returns the remainder when `10.5` is divided by `3`, which is `1.5`.

4. Modulus with negative dividend and divisor:
``````julia> mod(-10, -3)
-1``````

When both the dividend and divisor are negative, the `mod` function returns a value within the range [0, `y`). In this case, the result is `-1`.

Common mistake example:

``````julia> mod(10, 0)
ERROR: DivideError: integer division error``````

In this example, an error occurs because the divisor is `0`. The `mod` function cannot perform division by zero, so it's important to avoid this mistake and ensure the divisor is non-zero.