Yes, thanks - I’ve changed the description of the issue.
I need an index of the biggest value in the array that is smaller than my provided value.
Right now I’m using binary search.
I’m using this Python module from the standard library:
https://docs.python.org/3/library/bisect.html 15
for binary search. Method - bisect. bisect_left.
Example of usage:
from bisect import bisect_left
nuclears = [0, 0.1, 0.15, 0.2, 0.3, 0.33, 0.5, 0.51, 0.8, 1]
x = 0.505
idx = bisect_left(nuclears, x)
idx
7

But I need to do this operation a lot of times and it slows me down.