Find rightmost value less than x.
963802
def find_lt(a, x):
    """"""
    i = bs.bisect_left(a, x)
    if i: return i - 1
    raise ValueError
685305
def _limit_value(value, upper=1.0, lower=0.0):
    
    if value > upper:
        return(upper)
    if value < lower:
        return(lower)
    return value
432916
def clamp(n, lower, upper):
    
    if lower > upper:
        lower, upper = upper, lower
    return max(min(upper, n), lower)
923043
def best_fit(li, value):
    """"""

    index = min(bisect_left(li, value), len(li) - 1)

    if index in (0, len(li)):
        return index

    if li[index] - value < value - li[index-1]:
        return index
    else:
        return index-1
1188647
public static int whichMax(float[] x) {
        float m = Float.NEGATIVE_INFINITY;
        int which = 0;

        for (int i = 0; i < x.length; i++) {
            if (x[i] > m) {
                m = x[i];
                which = i;
            }
        }

        return which;
    }
682026
def minimise_xyz(xyz):
    """"""
    x, y, z = xyz
    m = max(min(x, y), min(max(x, y), z))
    return (x-m, y-m, z-m)
472382
function leftInorder(n, x) {
  if(n <= 0) {
    return 0
  }
  var r = rootInorder(n)
  if(x > r) {
    return leftInorder(n-r-1, x-r-1) + r + 1
  } else if(x === r) {
    return rootInorder(x)
  }
  return leftInorder(r, x)

}
359462
private Node<T> min(Node<T> x) {
    	do {
    		if (x.left == null) return x;
    		x = x.left;
    	} while (true);
    }
679372
def findLowest(self, symorders):
        """"""
        _range = range(len(symorders))
        stableSymorders = map(None, symorders, _range)

        # XXX FIX ME
        # Do I need to sort?
        stableSymorders.sort()
        lowest = None
        for index in _range:
            if stableSymorders[index][0] == lowest:
                return stableSymorders[index-1][1]
            lowest = stableSymorders[index][0]
        return -1
633175
function between (data, x, y) {
    if (x < y) {
      return greater(data, x) && data < y;
    }

    return less(data, x) && data > y;
  }
1021971
def find_lt(array, x):
    
    i = bisect.bisect_left(array, x)
    if i:
        return array[i - 1]
    raise ValueError
1350812
def find(value, find, start=0):
    
    l = len(value)
    if is_list(find):
        m = l
        for f in find:
            i = value.find(f, start)
            if i == -1:
                continue
            m = min(m, i)
        return m
    else:
        i = value.find(find, start)
        if i == -1:
            return l
        return i
1229310
def __find_smallest(self):
        """"""
        minval = sys.maxsize
        for i in range(self.n):
            for j in range(self.n):
                if (not self.row_covered[i]) and (not self.col_covered[j]):
                    if minval > self.C[i][j]:
                        minval = self.C[i][j]
        return minval
1062413
function (x, min, max) {
    if (x <= min) {
      return 0;
    }
    if (x >= max) {
      return 1;
    }
    x = (x - min) / (max - min);
    return x * x * (3 - 2 * x);
  }
1270194
private int rightmostDip() {
		for (int i=n-2; i>=0; i--)
			if (index[i] < index[i+1])
				return i;
		return -1;
	}
538818
def _min(self):
        """"""
        return (
            self.range[0] if (self.range and self.range[0] is not None) else
            (min(self.yvals) if self.yvals else None)
        )
894043
def find_range(coeffs):
    '''
    
    '''

    coeffs = [float(x) != 0 for x in coeffs]
    first = coeffs.index(True)
    coeffs.reverse()
    last = len(coeffs) - coeffs.index(True) - 1
    return first, last