level = read (settings, CS_LEVEL);            

index, rc = nearest_in (array, length, (int x) {
                                                 return abs (x - level); 
                                               });
