File:  [gforth] / gforth / fib.fs
Revision 1.2: download - view: text, annotated - select for diffs
Wed Jan 18 12:56:12 2006 UTC (13 years, 7 months ago) by anton
Branches: MAIN
CVS tags: v0-7-0, HEAD
documented S>NUMBER? S>UNUMBER?
minor changes

    1: \ Note: This is incorrect ("n fib" produces the result for fib(n+1)),
    2: \ but we do not change it to ensure that future timing results are
    3: \ comparable to older timing results.
    4: 
    5: : fib ( n1 -- n2 )
    6:     dup 2 < if
    7: 	drop 1
    8:     else
    9: 	dup
   10: 	1- recurse
   11: 	swap 2 - recurse
   12: 	+
   13:     then ;
   14: 
   15: : main 34 fib drop ;

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>