def mpc_agm(a, b, prec, rnd=round_fast):
    if mpc_is_infnan(a) or mpc_is_infnan(b):
        return fnan, fnan
    if mpc_zero in (a, b):
        return fzero, fzero
    if mpc_neg(a) == b:
        return fzero, fzero
    wp = prec+20
    eps = mpf_shift(fone, -wp+10)
    while 1:
        a1 = mpc_shift(mpc_add(a, b, wp), -1)
        b1 = mpc_sqrt(mpc_mul(a, b, wp), wp)
        a, b = a1, b1
        size = mpf_min_max([mpc_abs(a,10), mpc_abs(b,10)])[1]
        err = mpc_abs(mpc_sub(a, b, 10), 10)
        if size == fzero or mpf_lt(err, mpf_mul(eps, size)):
            return a
Adds some useful headers to the given HttpResponse object:
dataset/ETHPy150Open fredrik-johansson/mpmath/mpmath/libmp/libhyper.py/mpc_agm--crossover with--dataset/ETHPy150Open adieu/django-nonrel/django/utils/cache.py/patch_response_headers