Tamura-Kanada Circuit Method

Algorithm
The following algorithm can be used to calculate $\pi$ (pi):


 * $(1): \quad$ Set $A = X = 1$, set $B = \dfrac 1 {\sqrt 2}$, and set $C = \dfrac 1 4$


 * $(2): \quad$ Set $Y = A$.


 * $(3): \quad$ Set $A = \dfrac {A + B} 2$


 * $(4): \quad$ Set $B = \sqrt {B Y}$.


 * $(5): \quad$ Set $C = C - X \paren {A - Y}^2$


 * $(6): \quad$ Set $X = 2 X$


 * $(7): \quad$ Output $\dfrac {\paren {A + B}^2} {4 C}$ as an approximation to $\pi$.


 * $(8): \quad$ For a better approximation to $\pi$, set $Y$ equal to the output, return to step $(2)$ and continue.