Commit 5252ba20 authored by Bernd Paysan's avatar Bernd Paysan

Added O(1) fib in comment

parent 550adaa4
......@@ -12,4 +12,13 @@
then ;
: main 34 fib drop ;
\ No newline at end of file
: main 34 fib drop ;
\ The problem with fib is that it really is O(1)...
0 [IF]
5e fsqrt fdup 1/f fconstant /sqrt5
1e f+ f2/ fln fconstant gbase
: fib ( n -- f )
dup s>f gbase f* fdup fexp fswap fnegate fexp
1 and IF f+ ELSE f- THEN /sqrt5 f* ;
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment