跳到主內容

//ERDDAP/com.cohort.util/ScriptMath2/binaryFindClosest

binaryFindClosest

[JVM]
open fun binaryFindClosest(dar: Array<Double>, x: Double): Int

Find the closest element to x in an ascending sorted array.

Return

the index of the index of the element closest to x. If x is NaN, this returns -1.

Parameters

JVM

daran ascending sorted double[]. It the array has duplicates and x equals one of them, it isn't specified which duplicate's index will be returned.
x