Skip to main content

Timeline for Python 3 - Fibonacci Implementation

Current License: CC BY-SA 3.0

16 events
when toggle format what by license comment
Dec 22, 2017 at 16:07 comment added Eric Duminil @Snowbody you're correct
Dec 22, 2017 at 16:05 comment added 13ros27 Does anyone know how to get a more accurate value of Phi
Dec 22, 2017 at 16:04 comment added Snowbody @EricDuminil that's not it. Once n is large enough the second term is near-zero and has no contribution to the formula. The bigger problem is that the small inaccuracy in Phi due to limited precision gets magnified when exponentiated. Phi is actually off the correct value by sys.float_info.epsilon or so. On my machine Phi is real Phi + around 4e-16 = real Phi*(1+2.45e-16). So n=72 seems about the right place.
Dec 20, 2017 at 12:35 history edited 13ros27 CC BY-SA 3.0
Corrected spelling
Dec 20, 2017 at 12:35 comment added 13ros27 It is the value of Phi, it loses accuracy the larger the number you are finding
Dec 20, 2017 at 12:34 comment added Eric Duminil The main problem is that this calculates the difference of a huge number and a very small number. There's still a typo in your function name BTW.
Dec 20, 2017 at 10:39 history edited 13ros27 CC BY-SA 3.0
Corrected spelling
Dec 20, 2017 at 10:33 comment added Eric Duminil It's Fibonacci, not Fibonnacci or Fibonnaci. While it's good to know that this formula exists and is correct in theory, it's already returning wrong values for n=72.
Dec 20, 2017 at 10:22 history edited Graipher CC BY-SA 3.0
added 1 character in body; edited body
Dec 20, 2017 at 10:10 history edited 13ros27 CC BY-SA 3.0
Added a note
Dec 20, 2017 at 10:09 comment added 13ros27 Good point, I will add it
Dec 20, 2017 at 9:37 history edited Konrad Rudolph CC BY-SA 3.0
typo, formatting (PEP8)
Dec 20, 2017 at 9:24 comment added Ziyad Edher Would it not be better to once-compute math.sqrt(5) at the start, if we are looking to get the most performance, or does it get automatically get cached?
Dec 20, 2017 at 9:07 history edited hjpotter92 CC BY-SA 3.0
use tex for mathematical formula
Dec 20, 2017 at 8:41 history edited 13ros27 CC BY-SA 3.0
Corrected code
Dec 20, 2017 at 7:58 history answered 13ros27 CC BY-SA 3.0