The complete elliptic integral of the first kind
$K(m)=\int_0^{\pi/2}\frac{\mathrm{d}t}{\sqrt{1-m\sin^2t}}$
is easily computed via the arithmetic-geometric mean iteration; to wit,
$K(m)=\frac{\pi}{2M(1,\sqrt{1-m})}$
where $M(a,b)$ is the arithmetic-geometric mean of $a$ and $b$. With a little more trickery, the iteration can be hijacked to compute the complete elliptic integral of the second kind $E(m)$ as well.
In a number of applications, it happens that one needs both the values of $K(m)$ and its complement $K(1-m)$ (and sometimes similarly for $E(m)$ and $E(1-m)$).
My question is, apart from having to do an AGM iteration for each of $K(m)$ and $K(1-m)$, is there an algorithm (maybe a modification of the basic AGM iteration) that simultaneously generates both $K(m)$ and its complement? I would also be interested in seeing also an extension of this algorithm, if one exists, for computing $E(m)$ as well (after which $E(1-m)$ is easily computed via Legendre's relation).