pub fn binsearchdesc<T>(s: &[T], val: T) -> usize where
    T: PartialOrd<T>, 
Expand description

Binary search of an explicitly sorted list in descending order. Returns an index of the first item that is smaller than val. When none are smaller, returns s.len() (invalid index but logical). The complement index (the result subtracted from s.len()), gives the first item in ascending order that is not smaller than val. Note that both complements of binsearch and binsearchdesc, in their respective opposite orderings, refer to the same preceding item iff there exists precisely one item equal to val. However, there can be more than one such items or none. Example use: looking up cummulative probability density functions.