I was doing a project Euler problem where I needed to find several Fibonacci numbers, but their index was so large that I could not use the typical recursive method. Instead, I used Binet's rule:
$$ F_n = \frac{\phi^n - \psi^n}{\sqrt{5}}$$
But since phi and psi and root 5 are all irrational, I didn't know how many digits past the decimal place I needed to drag them out, especially since the Fibonacci numbers were hundreds or thousands of digits long. I ended up making the irrational numbers obscenely accurate to 1000 or 10000 decimal places just to be safe.
Is there some kind of rule like "x amount of precision before will result in y amount of precision in the answer"?
I have already solved the problem just fine, I was just wondering about the precision part.
You do not really need to work in floating point: Fibonacci numbers fulfill interesting duplication identities, so there are fast algorithms in integer arithmetic, as Brevan Ellefsen mentioned.
Here it is some $\text{Maxima}$ code for the fast computation of the $n$-th Fibonacci number.
/* Fast Fibonacci Numbers Computation */ fastfib(n):=block([O:2,L:?integer\-length(n),i,f0:2,f1:1,u,v], for i:1 thru L do ( u:f0^2, v:f1^2, if ?logbitp(L-i,n) then (f1:v+O, f0:f1-u+O, O:-2 ) else (f0:u-O, f1:v+O-f0, O:2 )), return((?ash(f1,1)-f0)/5) );This is included in the $\text{gf}$ package. In order to compute $F_n$, we just need to compute $2\log_2(n)$ squares. With Karatsuba algorithm (invoked in $\text{Maxima}$ through the $\text{fasttimes}$ command) or similar approaches the computation of $m^2$ requires just $\log_2(m)^{1.585}$ elementary operations.
This is pretty efficient. Here it is some test on my machine:
Back to the actual question: since $\phi^n=\exp(n\log\phi)$ and $\frac{d}{dx}x^n = n x^{n-1}$, we roughly have $(\phi+\varepsilon)^n \approx \phi^n+n\varepsilon\phi^{n-1}$, so a good accuracy is achieved as soon as $\varepsilon\ll\frac{1}{n\phi^{n-1}}$, and we need to store $\approx 0.7n$ binary digits of $\varphi$ to compute $\varphi^n$ with decent accuracy.