Return the index in arr of the closest float value to val.

def indexOfClosest( arr, val ):
    '''Return the index in arr of the closest float value to val.'''
    i_closest = None
    for i,v in enumerate(arr):
        d = math.fabs( v - val )
        if i_closest == None or d < d_closest:
            i_closest = i
            d_closest = d
    return i_closest