nextTowards

Common
JVM
JS
Native
1.2
fun Double.nextTowards(to: Double): Double
(Common source) (JVM source) (JS source) (Native source)

Returns the Double value nearest to this value in direction from this value towards the value to.

Special cases:

  • x.nextTowards(y) is NaN if either x or y are NaN
  • x.nextTowards(x) == x
JVM
Native
1.2
fun Float.nextTowards(to: Float): Float
(JVM source) (Native source)

Returns the Float value nearest to this value in direction from this value towards the value to.

Special cases:

  • x.nextTowards(y) is NaN if either x or y are NaN
  • x.nextTowards(x) == x