08-15-2022, 04:40 PM
@Pete, I think your path is a dead end. There are several formulas for calculating pi, one of which seems quite workable to me - if the program works. It is the formel by Ramanujan.
Maybe someone will find the error in the calculation?
Ramanujan’s Formula for Pi and Kreiszahl Wikipedia - below
Maybe someone will find the error in the calculation?
Ramanujan’s Formula for Pi and Kreiszahl Wikipedia - below
Code: (Select All)
'pi berechnen - 15. Aug. 2022
Dim n As Integer
Dim pi, pir, x As Double
Dim rampi As _Integer64
Print
pir = Sqr(2) * (9801 / 4412)
Print Using "pi SR = ###.########"; pir
Print
n = 2
'Nach Wikipedia - Ramanujan -- correct
pi = (Sqr(n) * (9801) / (4412))
Print Using "Wiki pi = ###.#######"; pi
Print
'Where is the mistake?
pi = (0.0002885855652225477 + (24 * (1103 + 26390)) / (1 * 24591257856))
Print Using "Ramanu ausgerechnet pi = ###.#######"; pi
Print
pi = (Sqr(8) / 9801) + ((24 * (1103 + 26390)) / (1 * (396 ^ 4)))
Print Using "Ramanu pi = ###.#######"; pi
Print
x = 396 ^ 4
Print "x = "; x