roundToInt
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
whenx > Int.MAX_VALUE
x.roundToInt() == Int.MIN_VALUE
whenx < Int.MIN_VALUE
Since Kotlin
1.2Throws
when this value is NaN
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
whenx > Int.MAX_VALUE
x.roundToInt() == Int.MIN_VALUE
whenx < Int.MIN_VALUE
Since Kotlin
1.2Throws
when this value is NaN
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
whenx > Int.MAX_VALUE
x.roundToInt() == Int.MIN_VALUE
whenx < Int.MIN_VALUE
Since Kotlin
1.2Throws
when this value is NaN
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
whenx > Int.MAX_VALUE
x.roundToInt() == Int.MIN_VALUE
whenx < Int.MIN_VALUE
Since Kotlin
1.2Throws
when this value is NaN
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
whenx > Int.MAX_VALUE
x.roundToInt() == Int.MIN_VALUE
whenx < Int.MIN_VALUE
Since Kotlin
1.2Throws
when this value is NaN
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
whenx > Int.MAX_VALUE
x.roundToInt() == Int.MIN_VALUE
whenx < Int.MIN_VALUE
Since Kotlin
1.2Throws
when this value is NaN