Fibonacci matrix-exponentiation: Difference between revisions

m
m (→‎{{header|Wren}}: Minor tidy)
 
Line 2,011:
{{libheader|Wren-fmt}}
A tough task for Wren which takes just under 3 minutes to process even the 1 millionth Fibonacci number. Judging by the times for the compiled, statically typed languages using GMP, the 10 millionth would likely take north of 4 hours so I haven't attempted it.
<syntaxhighlight lang="ecmascriptwren">import "./big" for BigInt
import "./fmt" for Fmt
 
var mul = Fn.new { |m1, m2|
Line 2,129:
 
Apart from the 2^16th number, the extra credit is still out of reach using this approach.
<syntaxhighlight lang="ecmascriptwren">import "./big" for BigInt
import "./fmt" for Fmt
 
var lucas = Fn.new { |n|
Line 2,211:
{{libheader|Wren-gmp}}
Ridiculously fast (under 5ms) thanks to the stuff borrowed from Sidef and Julia combined with the speed of GMP.
<syntaxhighlight lang="ecmascriptwren">import "./gmp" for Mpz, Mpf
import "./fmt" for Fmt
 
9,476

edits