Fibonacci matrix-exponentiation: Difference between revisions

Content added Content deleted
No edit summary
No edit summary
Line 1,705: Line 1,705:
2^128: 15262728879740471565 ... 17229324095882654267</pre>
2^128: 15262728879740471565 ... 17229324095882654267</pre>
=={{header|Ruby}}==
=={{header|Ruby}}==
Ruby's fast exponentiation operator duck-typing applied to Ruby's built-in Integer Class.
===Matrix exponentiation by Ruby's fast exponentiation operator duck-typing applied to Ruby's built-in Integer Class===


require 'matrix'
require 'matrix'
Line 1,734: Line 1,734:
</pre>
</pre>


Ruby's Matlix#exponentiation duck-typeing with Head-tail-BigNumber class.
===Matrix exponentiation by Ruby's Matlix#exponentiation duck-typeing with Head-tail-BigNumber class===

Here, the HeadTailBignum class holds the digits of the head part in Ruby's bigDecimal class and tail part in the BigInteger class.
Here, the HeadTailBignum class holds the digits of the head part in Ruby's bigDecimal class and tail part in the BigInteger class.
and HeadTailBignum defines only the add and multply operators and the coerce method.
and HeadTailBignum defines only the add and multply operators and the coerce method.