domainslib icon indicating copy to clipboard operation
domainslib copied to clipboard

fibonacci example

Open sanette opened this issue 2 years ago • 1 comments

Just a stupid remark about the README file. I know this is just for illustration, but choosing fib is could lead to questions here; maybe somewhere in the README one could mention that the usual sequential code is much faster

let fib n = let rec loop n = if n < 1 then (0, 1) else let x, y = loop (n-1) in y, (x+y) in snd (loop n);;

sanette avatar Jan 09 '23 22:01 sanette

Actually, the 92th fibonacci number is 2880067194370816120 and next one exceeds max_int. So for production-ready performant implementation a lookup table should be recommended :)

Kakadu avatar Mar 11 '24 11:03 Kakadu