COSMIT: Use searchsorted in weighted_percentile