just for you Pete, here's the Ramanujan formula simplified
to calculate Pi to 1 million digits using Ramanujan would take 125000 iterations, it would take 20 iterations with the Gauss–Legendre algorithm
Code: (Select All)
Function Ramanujan# ()
Dim As Double sum, f, f4, f4k, c1, c2, c3, c4, c34k
Dim As Long k, k4
c1 = 1103
c2 = 26390
c3 = 396
f = 1
f4k = 1
sum = 1103
c34k = 1
k4 = 0
c4 = c3 * c3: c4 = c4 * c4
For k = 1 To 2
f = f * k
f4 = f * f: f4 = f4 * f4
c34k = c34k * c4
f4k = f4k * (k4 + 1) * (k4 + 2) * (k4 + 3) * (k4 + 4): k4 = k4 + 4
sum = sum + (f4k * (c1 + c2 * k)) / (f4 * c34k)
Next
Ramanujan = 1 / (2 * Sqr(2) / 9801 * sum)
End Function