Handbook
Glossary
matrix-fib ( m -- n )
Vocabulary
benchmark
.
fib7
Inputs
m
an
object
Outputs
n
an
object
Definition
USING:
kernel
math
math.parser
sequences
;
IN:
benchmark.fib7
::
matrix-fib
( m -- n )
m 0
>=
[
m
throw
]
unless
m 2
>base
[
49
=
]
{
}
map-as
:>
bits 1
:>
a! 0
:>
b! 1
:>
c! bits
[
[
a c
+
b
*
b
sq
c
sq
+
]
[
a
sq
b
sq
+
a c
+
b
*
]
if
b! a! a b
+
c!
]
each
b
;