in reply to Re^4: fibonacci numbers using subroutine?
in thread fibonacci numbers using subroutine?

timethese() got used instead of cmpthese() because I just cut-n-pasted into some other boiler plate that I had. I also like the cmpthese() format better.

I guess you must have a 64bit processor? I can't represent fib(100) as an int without resorting to some bigger than normal integer strategy.

  • Comment on Re^5: fibonacci numbers using subroutine?

Replies are listed 'Best First'.
Re^6: fibonacci numbers using subroutine?
by JavaFan (Canon) on Aug 20, 2010 at 13:13 UTC
    2**68 < Fib(100) == 354224848179261915075 < 2**69
Re^6: fibonacci numbers using subroutine?
by BrowserUk (Patriarch) on Aug 20, 2010 at 13:23 UTC

    I do have 64-bit ints, but that shouldn't stop you from doing fib(100). It just rolls over to using floats (with loss of accuracy obviously). You should be able to go all the way to 1476:

    1 : 1 2 : 1 3 : 2 4 : 3 5 : 5 6 : 8 7 : 13 98 : 135301852344706760000 99 : 218922995834555200000 100 : 354224848179262000000 ... 1476 : 1306989223763398700000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000 1477 : 1