def print_iteration(it, res, error, extra='', threshold=0.1):
    """ Checks the size of the result to select between
    scientific notation and floating point notation """
    if res < threshold:
        print(f'Result for iteration {it}: {res:.3e} +/- {error:.3e}' + extra)
    else:
        print(f'Result for iteration {it}: {res:.4f} +/- {error:.4f}' + extra)
