Index: /branches/eam_branches/ohana.20170822/src/libohana/include/ohana.h
===================================================================
--- /branches/eam_branches/ohana.20170822/src/libohana/include/ohana.h	(revision 40175)
+++ /branches/eam_branches/ohana.20170822/src/libohana/include/ohana.h	(revision 40176)
@@ -485,4 +485,5 @@
 /* in bisection.c */
 int ohana_bisection_double (double *values, int Nvalues, double threshold);
+int ohana_bisection_int (int *values, int Nvalues, int threshold);
 
 unsigned int sprintf_float (char *output, float value);
Index: /branches/eam_branches/ohana.20170822/src/libohana/src/bisection.c
===================================================================
--- /branches/eam_branches/ohana.20170822/src/libohana/src/bisection.c	(revision 40175)
+++ /branches/eam_branches/ohana.20170822/src/libohana/src/bisection.c	(revision 40176)
@@ -32,2 +32,34 @@
   return (N);
 }
+
+// return the index of the last value < threshold 
+int ohana_bisection_int (int *values, int Nvalues, int threshold) {
+
+  int Nlo = 0; 
+  int Nhi = Nvalues - 1;
+
+  if (Nvalues < 1) return (-1);
+  if (values[Nlo] > threshold) return (-1);
+
+  if (Nvalues < 2) return (0);
+  if (values[Nhi] < threshold) return (Nhi);
+
+  int N;
+  while (Nhi - Nlo > 4) {
+    N = 0.5*(Nlo + Nhi);
+    if (values[N] < threshold) {
+      Nlo = MAX(N, 0);
+    } else {
+      Nhi = MIN(N + 1, Nvalues - 1);
+    }
+  }
+  // values[Nlo] < threshold 
+  // values[Nhi] >= threshold 
+
+  for (N = Nlo; N < Nhi; N++) {
+    if (values[N] >= threshold) {
+      return (N-1);
+    }
+  }
+  return (N);
+}
