Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
carlob
on Feb 12, 2013
|
parent
|
context
|
favorite
| on:
Julia, I love you (2012)
Can't you do it in O(1) if you limit yourself to floats? Arbitrary n but not arbitrary precision?
mikeash
on Feb 12, 2013
[–]
I imagine the table would still be of reasonable size then. Of course, this is still technically restricting the output to 32 or 64-bit numbers.
gamegoblin
on Feb 12, 2013
|
parent
[–]
No need for a table lookup. There is a closed form formula. Of course this is only as accurate as your float precision. You can get out pretty far, though, with some clever rounding.
http://en.wikipedia.org/wiki/Fibonacci_number#Closed-form_ex...
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: