18 lines
269 B
Plaintext
18 lines
269 B
Plaintext
sum := 0.0
|
|
k := 0
|
|
|
|
iterations := 100
|
|
|
|
while k < iterations {
|
|
k_f := float(k)
|
|
sum = sum + 1.0 / pow(16.0, k_f) *
|
|
(4.0 / (8.0 * k_f + 1.0) -
|
|
2.0 / (8.0 * k_f + 4.0) -
|
|
1.0 / (8.0 * k_f + 5.0) -
|
|
1.0 / (8.0 * k_f + 6.0))
|
|
k = k + 1
|
|
}
|
|
|
|
put("π ≈ ")
|
|
putln(sum)
|