(50g) Nth Fibonacci Number
02-22-2015, 09:48 AM
Post: #2
 Gerald H Senior Member Posts: 1,461 Joined: May 2014
RE: (50g) Nth Fibonacci Number
Another way to do it for integer input:

::
CK1&Dispatch
# FF
::
::
DUP
Z2_
Z<
case
::
BINT4
NDUPN
DROP
;
FPTR2 ^Z>ZH
Z-2_
Z0Z1_
4PICK
FPTR2 ^ZBits
SWAPDROP#1-_
ZERO_DO
FPTR2 ^ZSQ_
SWAP
FPTR2 ^ZSQ_
2DUP
FPTR2 ^RSUBext
DUP
3PICK
3UNROLL
SWAPROT
3PICK
ISTOP-INDEX
#1-
FPTR2 ^ZBit?
SWAPDROP
ITE
::
DUPUNROT
Z-2_
;
Z2_
3UNROLL
LOOP
;
4UNROLL3DROP
;
;
 « Next Oldest | Next Newest »

 Messages In This Thread (50g) Nth Fibonacci Number - Eddie W. Shore - 02-21-2015, 03:31 PM RE: (50g) Nth Fibonacci Number - Gerald H - 02-22-2015 09:48 AM RE: (50g) Nth Fibonacci Number - Joe Horn - 02-22-2015, 09:06 PM RE: (50g) Nth Fibonacci Number - Offroad - 02-23-2015, 03:07 AM RE: (50g) Nth Fibonacci Number - rprosperi - 02-26-2015, 01:42 PM RE: (50g) Nth Fibonacci Number - Han - 02-26-2015, 07:39 PM RE: (50g) Nth Fibonacci Number - rprosperi - 02-26-2015, 08:23 PM RE: (50g) Nth Fibonacci Number - Joe Horn - 02-26-2015, 10:19 PM RE: (50g) Nth Fibonacci Number - Thomas Klemm - 02-26-2015, 10:45 PM RE: (50g) Nth Fibonacci Number - Han - 02-27-2015, 03:29 AM RE: (50g) Nth Fibonacci Number - rprosperi - 02-27-2015, 01:31 PM RE: (50g) Nth Fibonacci Number - Thomas Klemm - 02-26-2015, 11:04 PM RE: (50g) Nth Fibonacci Number - Thomas Klemm - 02-27-2015, 05:10 AM RE: (50g) Nth Fibonacci Number - rprosperi - 02-27-2015, 01:43 PM RE: (50g) Nth Fibonacci Number - Thomas Klemm - 02-27-2015, 05:58 AM RE: (50g) Nth Fibonacci Number - rprosperi - 02-27-2015, 01:48 PM RE: (50g) Nth Fibonacci Number - Han - 02-27-2015, 02:22 PM RE: (50g) Nth Fibonacci Number - Gerald H - 02-27-2015, 03:27 PM RE: (50g) Nth Fibonacci Number - Thomas Klemm - 03-02-2015, 02:11 AM

User(s) browsing this thread: 1 Guest(s)