floorDiv

inline fun floorDiv(other: UByte): UInt(source)
inline fun floorDiv(other: UShort): UInt(source)
inline fun floorDiv(other: UInt): UInt(source)
inline fun floorDiv(other: ULong): ULong(source)

Divides this value by the other value, flooring the result to an integer that is closer to negative infinity.

For unsigned types, the results of flooring division and truncating division are the same.

Since Kotlin

1.5

Samples

import kotlin.test.assertFailsWith

fun main() { 
   //sampleStart 
   // Unsigned types have no negative values, so floorDiv produces the
// same result as the / operator
println(7u.floorDiv(3u)) // 2
println(7u / 3u) // 2

// Dividing by zero throws
// 1u.floorDiv(0u) // will fail with ArithmeticException 
   //sampleEnd
}