16 lines
325 B
Text
16 lines
325 B
Text
call iterate()
|
|
end
|
|
|
|
subroutine iterate()
|
|
iter = 0
|
|
phi0 = 1.0
|
|
do
|
|
phi1 = 1.0 + (1.0 / phi0)
|
|
diferencia = abs(phi1 - phi0)
|
|
phi0 = phi1
|
|
iter += 1
|
|
until (1.0e-5 > diferencia)
|
|
|
|
print "Result: "; phi1; " after "; iter; " iterations"
|
|
print "The error is approximately "; phi1 - (0.5 * (1.0 + sqrt(5.0)))
|
|
end subroutine
|