typelevel/spire

Searching API needs better documentation

Open

#786 aperta il 3 apr 2019

Vedi su GitHub
 (0 commenti) (0 reazioni) (0 assegnatari)Scala (238 fork)batch import
good first issue

Metriche repository

Star
 (1775 star)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

We state

  /** Performs a binary search, returns an index using the same convention as java.util.Arrays.binarySearch. */
final def search[@sp A: Order](as: Array[A], item: A, lower: Int, upper: Int): Int = {

However, our convention is to search the interval [lower, upper] inclusive, whereas java.util.Arrays.binarySearch excludes the upper bound.

Guida contributor