floor dichotomy to find proper index
plotting function