(50g) Nth Fibonacci Number
|
02-22-2015, 09:48 AM
Post: #2
|
|||
|
|||
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 FPTR2 ^RADDext 3PICK FPTR2 ^RADDext 3UNROLL FPTR2 ^RADDext SWAPROT FPTR2 ^RADDext 3PICK ISTOP-INDEX #1- FPTR2 ^ZBit? SWAPDROP ITE :: DUPUNROT FPTR2 ^QAdd Z-2_ ; Z2_ 3UNROLL LOOP ; 4UNROLL3DROP ; ; |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 2 Guest(s)