I have the following array:
double[] list = new double[] {0,0,100,100}
Why if I search for 29.6
I get -3
?
Array.BinarySearch(list, 29.6)
I expected +1
or -1
.
The Array.BinarySearch() documentation for the return parameter says:
The index of the specified value in the specified array, if value is found. If value is not found and value is less than one or more elements in array, a negative number which is the bitwise complement of the index of the first element that is larger than value. If value is not found and value is greater than any of the elements in array, a negative number which is the bitwise complement of (the index of the last element plus 1).
But it does not says too much to me.