def index_next_crossing(value, array, starting_index=<NUM_LIT:0>, direction=<NUM_LIT:1>):
for n in range(starting_index, len(array)-<NUM_LIT:1>):<EOL><INDENT>if  (value-array[n]  )*direction >= <NUM_LIT:0>and (value-array[n+<NUM_LIT:1>])*direction <  <NUM_LIT:0>: return n<EOL><DEDENT>return -<NUM_LIT:1><EOL>
starts at starting_index, and walks through the array until
it finds a crossing point with value

set direction=-1 for down crossing