News for hackers. Stuff that matters.
Re:Node-fib: Fast non-blocking fibonacci server by robinhouston on Monday October 03, 2011 @03:27PM (#3067618)
It’s tangential to this thread, but since it’s a topic close to my heart:

If you just implement this formula using doubles then it only gives the correct answer for input values up to about 70. Yes it’s pretty fast, but a static table of the first 70 Fibonacci numbers would be even faster. If you’re only interested in the first few dozen Fibonacci numbers then it doesn’t really matter what algorithm you use, as long as it isn’t naive recursion.

If you want to get correct answers for larger Fibonacci numbers, you need to work harder to use this equation. You need some sort of multiple-precision floating point arithmetic library, for example.

And once you’ve done that, the resulting algorithm is quite a lot slower than the best integer methods.

I wrote a big blog post about this back in July: http://bosker.wordpress.com/2011/07/27/computing-fibonacci-n...

There are no comments on this comment yet.