MathHelper.floorMod

Returns the floor modulus of the {@code long} and {@code int} arguments. <p> The floor modulus is {@code x - (floorDiv(x, y) * y)}, has the same sign as the divisor {@code y}, and is in the range of {@code -abs(y) < r < +abs(y)}.

<p> The relationship between {@code floorDiv} and {@code floorMod} is such that: <ul> <li>{@code floorDiv(x, y) * y + floorMod(x, y) == x} </ul> <p> For examples, see {@link #floorMod(int, int)}.

@param x the dividend @param y the divisor @return the floor modulus {@code x - (floorDiv(x, y) * y)} @throws ArithmeticException if the divisor {@code y} is zero @see #floorDiv(long, int)

  1. int floorMod(int x, int y)
  2. int floorMod(long x, int y)
    class MathHelper
    static
    int
    floorMod
    (
    long x
    ,
    int y
    )
  3. long floorMod(long x, long y)

Meta