(a, b, prec)
return a
Fixed-point computation of agm(a,b), assuming
    a, b both close to unit magnitude.
Fixed-point computation of agm(a,b), assuming
    a, b both close to unit magnitude.
Fixed - point computation of agm ( a b ) assuming a b both close to unit magnitude .
def agm_fixed(a, b, prec):
    """
    Fixed-point computation of agm(a,b), assuming
    a, b both close to unit magnitude.
    """
    i = 0
    while 1:
        anew = (a+b)>>1
        if i > 4 and abs(a-anew) < 8:
            return a
        b = isqrt_fast(a*b)
        a = anew
        i += 1
    return a
def agm_fixed ( a , b , prec ) : i = 0 while 1 : anew = ( a + b ) >> 1 if i > 4 and abs ( a - anew ) < 8 : return a b = isqrt_fast ( a * b ) a = anew i += 1 return a