floorDiv()
is a function of the math
package in scala that returns the largest value less than or equal to the algebraic quotient.
def floorDiv(x: Long, y: Long): Long
OR
def floorDiv(x: Int, y: Int): Int
x
is the dividend value.
y
is the divisor value.
The function returns the largest value less than or equal to the algebraic quotient. The return type of the function is either Int
or Long
.
The function throws ArithmeticException if
y
is 0.
object MainObject {def main(args: Array[String]) {println(s"Math.floorDiv(-15, 5) = ${Math.floorDiv(-15, 5)}");println(s"Math.floorDiv(29, 6) = ${Math.floorDiv(29, 6)}");// ArthimeticException will be thrown at line 6println(s"Math.floorDiv(29, 0) = ${Math.floorDiv(29, 0)}");}}