in reply to phi div by 0 error
Simplify! :-)
#! perl use strict; use warnings; use bignum; my ($even, $odd) = (1, 1); for (1 .. 47) { $even += $odd; $odd += $even; print "phi = ", ($odd / $even), "\n"; }
47 iterations gives phi correct to 38 decimal places:
phi = 1.61803398874989484820458683436563811772
Update: Timed (with Time::HiRes) at less than 0.3 seconds.
Hope that helps,
| Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
|
|---|