def findbin(value,bins):
    """Return the bin where value belongs.
    
    Parameters:
    1. value: a value whose bin to know
    2. bins: an array of bins. bins[i] represents a bin of bins[i]<= <bins[i+1]. 
    
    Return
    i: if i==-1, value is less than bins[0]. If i==len(bins), value >=bins[-1].
    
    """
    
    if value < bins[0]: return -1
    elif value >= bins[-1]: return len(bins)
    else:
        i=0
        while bins[i]<value:
            i+=1
        return i-1