def body(state):
    (low, high) = state
    midpoint = (0.5 * (low + high))
    update_upper = (func(midpoint) > 0)
    low = jnp.where(update_upper, low, midpoint)
    high = jnp.where(update_upper, midpoint, high)
    return (low, high)
def body(state):
    (low, high) = state
    midpoint = (0.5 * (low + high))
    update_upper = (func(midpoint) > 0)
    low = jnp.where(update_upper, low, midpoint)
    high = jnp.where(update_upper, midpoint, high)
    return (low, high)