Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: Fibonaccio - Was: Report on WinCE Rebol --- Speed Comparison

From: joel::neely::fedex::com at: 28-Jun-2001 23:55

Hi, Bard, Bard Papegaaij wrote:
> David Ness wrote: > > > > >If one were actually interested in generating fibonacci > > numbers then neither recursion nor iteration nor memory > > functions are needed as there is, IIRC, a straightforward > > closed form for the fibonnaci which would evaluate for > > any N at the cost of a couple of logs and a couple of > > exponentials. > > Mmmmm. I didn't know about that one? Any pointers I could > follow up? >
How about the function? ;-) fibr: func [n [integer!] /local sr5] [ sr5: square-root 5.0 ((0.5 * (1.0 + sr5)) ** n) - ((0.5 * (1.0 - sr5)) ** n) / sr5 ] (Remember that REBOL ignores operator precedence, so the division is applied to the difference.) -jn- -- ------------------------------------------------------------ Programming languages: compact, powerful, simple ... Pick any two! joel'dot'neely'at'fedex'dot'com