roundToInt

expect fun Double.roundToInt(): Int(source)

Rounds this Double value to the nearest integer and converts the result to Int. Ties are rounded towards positive infinity.

Special cases:

  • x.roundToInt() == Int.MAX_VALUE when x > Int.MAX_VALUE

  • x.roundToInt() == Int.MIN_VALUE when x < Int.MIN_VALUE

Since Kotlin

1.2

Throws

when this value is NaN


expect fun Float.roundToInt(): Int(source)

Rounds this Float value to the nearest integer and converts the result to Int. Ties are rounded towards positive infinity.

Special cases:

  • x.roundToInt() == Int.MAX_VALUE when x > Int.MAX_VALUE

  • x.roundToInt() == Int.MIN_VALUE when x < Int.MIN_VALUE

Since Kotlin

1.2

Throws

when this value is NaN

actual fun Double.roundToInt(): Int(source)

Rounds this Double value to the nearest integer and converts the result to Int. Ties are rounded towards positive infinity.

Special cases:

  • x.roundToInt() == Int.MAX_VALUE when x > Int.MAX_VALUE

  • x.roundToInt() == Int.MIN_VALUE when x < Int.MIN_VALUE

Since Kotlin

1.2

Throws

when this value is NaN


actual inline fun Float.roundToInt(): Int(source)

Rounds this Float value to the nearest integer and converts the result to Int. Ties are rounded towards positive infinity.

Special cases:

  • x.roundToInt() == Int.MAX_VALUE when x > Int.MAX_VALUE

  • x.roundToInt() == Int.MIN_VALUE when x < Int.MIN_VALUE

Since Kotlin

1.2

Throws

when this value is NaN

actual fun Double.roundToInt(): Int(source)

Rounds this Double value to the nearest integer and converts the result to Int. Ties are rounded towards positive infinity.

Special cases:

  • x.roundToInt() == Int.MAX_VALUE when x > Int.MAX_VALUE

  • x.roundToInt() == Int.MIN_VALUE when x < Int.MIN_VALUE

Since Kotlin

1.2

Throws

when this value is NaN


actual fun Float.roundToInt(): Int(source)

Rounds this Float value to the nearest integer and converts the result to Int. Ties are rounded towards positive infinity.

Special cases:

  • x.roundToInt() == Int.MAX_VALUE when x > Int.MAX_VALUE

  • x.roundToInt() == Int.MIN_VALUE when x < Int.MIN_VALUE

Since Kotlin

1.2

Throws

when this value is NaN

actual fun Double.roundToInt(): Int(source)

Rounds this Double value to the nearest integer and converts the result to Int. Ties are rounded towards positive infinity.

Special cases:

  • x.roundToInt() == Int.MAX_VALUE when x > Int.MAX_VALUE

  • x.roundToInt() == Int.MIN_VALUE when x < Int.MIN_VALUE

Since Kotlin

1.3

Throws

when this value is NaN


actual fun Float.roundToInt(): Int(source)

Rounds this Float value to the nearest integer and converts the result to Int. Ties are rounded towards positive infinity.

Special cases:

  • x.roundToInt() == Int.MAX_VALUE when x > Int.MAX_VALUE

  • x.roundToInt() == Int.MIN_VALUE when x < Int.MIN_VALUE

Since Kotlin

1.3

Throws

when this value is NaN

actual fun Double.roundToInt(): Int(source)

Rounds this Double value to the nearest integer and converts the result to Int. Ties are rounded towards positive infinity.

Special cases:

  • x.roundToInt() == Int.MAX_VALUE when x > Int.MAX_VALUE

  • x.roundToInt() == Int.MIN_VALUE when x < Int.MIN_VALUE

Since Kotlin

1.8

Throws

when this value is NaN


actual fun Float.roundToInt(): Int(source)

Rounds this Float value to the nearest integer and converts the result to Int. Ties are rounded towards positive infinity.

Special cases:

  • x.roundToInt() == Int.MAX_VALUE when x > Int.MAX_VALUE

  • x.roundToInt() == Int.MIN_VALUE when x < Int.MIN_VALUE

Since Kotlin

1.8

Throws

when this value is NaN

actual fun Double.roundToInt(): Int(source)

Rounds this Double value to the nearest integer and converts the result to Int. Ties are rounded towards positive infinity.

Special cases:

  • x.roundToInt() == Int.MAX_VALUE when x > Int.MAX_VALUE

  • x.roundToInt() == Int.MIN_VALUE when x < Int.MIN_VALUE

Since Kotlin

1.8

Throws

when this value is NaN


actual fun Float.roundToInt(): Int(source)

Rounds this Float value to the nearest integer and converts the result to Int. Ties are rounded towards positive infinity.

Special cases:

  • x.roundToInt() == Int.MAX_VALUE when x > Int.MAX_VALUE

  • x.roundToInt() == Int.MIN_VALUE when x < Int.MIN_VALUE

Since Kotlin

1.8

Throws

when this value is NaN