mod

Platform and version requirements: JVM (1.5), JS (1.5), Native (1.5)
fun Byte.mod(other: Byte): Byte
fun Byte.mod(other: Short): Short
fun Byte.mod(other: Int): Int
fun Byte.mod(other: Long): Long
fun Short.mod(other: Byte): Byte
fun Short.mod(other: Short): Short
fun Short.mod(other: Int): Int
fun Short.mod(other: Long): Long
fun Int.mod(other: Byte): Byte
fun Int.mod(other: Short): Short
fun Int.mod(other: Int): Int
fun Int.mod(other: Long): Long
fun Long.mod(other: Byte): Byte
fun Long.mod(other: Short): Short
fun Long.mod(other: Int): Int
fun Long.mod(other: Long): Long

Calculates the remainder of flooring division of this value by the other value.

The result is either zero or has the same sign as the divisor and has the absolute value less than the absolute value of the divisor.

Platform and version requirements: JVM (1.5), JS (1.5), Native (1.5)
fun Float.mod(other: Float): Float
fun Float.mod(other: Double): Double
fun Double.mod(other: Float): Double
fun Double.mod(other: Double): Double

Calculates the remainder of flooring division of this value by the other value.

The result is either zero or has the same sign as the divisor and has the absolute value less than the absolute value of the divisor.

If the result cannot be represented exactly, it is rounded to the nearest representable number. In this case the absolute value of the result can be less than or equal to the absolute value of the divisor.

© 2010–2021 JetBrains s.r.o. and Kotlin Programming Language contributors
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/mod.html