title: BinarySearch how to find the value in the array between the two neighbors?
body: <p>I have a sorted array <strong>double</strong>.
  The goal is to Find the index in the Array. 
  Which contains the value of &lt;= the value of search.</p>
  
  <p>For example the array contains numbers <code>{0, 5, 12, 34, 100}</code> with index range [0 .. 4].</p>
  
  <p>Search for the value=25. And I want to get the index=2 (range of occurrences of between 12 and 34)</p>
  
  <p>I do not understand how in this case will run a binary search.</p>
  
  <pre><code>   public class MyComparer : IComparer&lt;double&gt;
      {
          public int Compare(double x, double y)
          {
              //&lt;-------- ???
          }
      }
  
      public double[] spline_x;
  
      MyComparer cmpc = new MyComparer();
      int i=Array.BinarySearch(spline_x, x, cmpc);
  </code></pre>