ssim/tardis — pull request #12 by mklauser (2014-12-05 20:44:25+00:00)
Title: updated binary search

Here is the Python version for Testing:

def bins(x, x_insert, imin, imax):
if (x_insert < x[imin] or x_insert > x[imax]):
print('out of bounds')
else:
while (imin <= imax):
imid = imin + (imax - imin) / 2
if (x[imid] > x_insert):
imax = imid - 1
else:
imin = imid + 1
return imin - 1