Talk:Fibonacci matrix-exponentiation: Difference between revisions
→Ruby's Matlix duck-typeing with Head-tail-BigNumber class
(→Ruby's Matlix duck-typeing with Head-tail-BigNumber class: new section) |
|||
(3 intermediate revisions by the same user not shown) | |||
Line 14:
== Ruby ==
Ruby's fast exponentiation operator duck-typing applied to Ruby's built-in Integer Class.
require 'matrix'
start_time = Time.now
[10,100,256, 1_000, 1024, 10_000, 2 ** 16, 100_000, 1_000_000,10_000_000
}
puts "Took #{Time.now - start_time}s"
'''Ruby''''s
[10, "2 digits", "55", "Took
[100, "21 digits", "354224848179261915075", "Took 0.
[
[
[
[
[
[
[1000000, "208988 digits", "19532821287077577316 ... 6899652683824254687", "Took 0.076104599s"]
[10000000, "2089877 digits", "11298343782253997603 ... 8699867368638054687", "Took 1.112832817s"]
Took 1.112902545s
== Ruby's Matlix duck-typeing with Head-tail-BigNumber class ==
Line 46 ⟶ 49:
Matlix exponentiation operator is fast and can apply duck-typing to HeadTailBignum.
require 'matrix'
require 'bigdecimal'
|