floorMod

fun floorMod(x: Long, y: Long): Long

Returns the floor modulus of the long arguments.

The floor modulus is r = x - (floorDiv(x, y) * y), has the same sign as the divisor y or is zero, and is in the range of -abs(y) < r < +abs(y).

The relationship between floorDiv and floorMod is such that:

  • floorDiv(x, y) * y + floorMod(x, y) == x

For examples, see .floorMod.

Return

the floor modulus x - (floorDiv(x, y) * y)

Since

1.8

Parameters

x

the dividend

y

the divisor

See also

.floorDiv

Throws

if the divisor y is zero