I have a list of items like
A= 0.992688 0.892195 0.889151 0.380672 0.180576 0.685028 0.58195
Given an input element, e.g. 0.4, how can I find an index that contains the number closest to that number. For example, A[4] = 0.380672 is closest to 0.4. Therefore he must return to 4
source share