roundToLong

expect fun Double.roundToLong(): Long(source)

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

Special cases:

  • x.roundToLong() == Long.MAX_VALUE when x > Long.MAX_VALUE

  • x.roundToLong() == Long.MIN_VALUE when x < Long.MIN_VALUE

Since Kotlin

1.2

Throws

when this value is NaN


expect fun Float.roundToLong(): Long(source)

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

Special cases:

  • x.roundToLong() == Long.MAX_VALUE when x > Long.MAX_VALUE

  • x.roundToLong() == Long.MIN_VALUE when x < Long.MIN_VALUE

Since Kotlin

1.2

Throws

when this value is NaN

actual fun Double.roundToLong(): Long(source)

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

Special cases:

  • x.roundToLong() == Long.MAX_VALUE when x > Long.MAX_VALUE

  • x.roundToLong() == Long.MIN_VALUE when x < Long.MIN_VALUE

Since Kotlin

1.2

Throws

when this value is NaN


actual inline fun Float.roundToLong(): Long(source)

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

Special cases:

  • x.roundToLong() == Long.MAX_VALUE when x > Long.MAX_VALUE

  • x.roundToLong() == Long.MIN_VALUE when x < Long.MIN_VALUE

Since Kotlin

1.2

Throws

when this value is NaN

actual fun Double.roundToLong(): Long(source)

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

Special cases:

  • x.roundToLong() == Long.MAX_VALUE when x > Long.MAX_VALUE

  • x.roundToLong() == Long.MIN_VALUE when x < Long.MIN_VALUE

Since Kotlin

1.2

Throws

when this value is NaN


actual fun Float.roundToLong(): Long(source)

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

Special cases:

  • x.roundToLong() == Long.MAX_VALUE when x > Long.MAX_VALUE

  • x.roundToLong() == Long.MIN_VALUE when x < Long.MIN_VALUE

Since Kotlin

1.2

Throws

when this value is NaN