Created
January 5, 2019 17:51
-
-
Save SpineyPete/3d9817b1d8e97b57be2f8fe8bbbdeca2 to your computer and use it in GitHub Desktop.
Revisions
-
Pieter Verhoeven created this gist
Jan 5, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,6 @@ double fib(int n) { const double sqrt5 = sqrt(5); const double phi_a = (1 + sqrt5)/2; const double phi_b = (1 - sqrt5)/2; return (pow(phi_a, n) - pow(phi_b, n))/sqrt5; }