You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file uses Numbers at the matrix algorithm to compute the nth number in the Fibonacci sequence. My reasons to recommend BigInt are these:
BigInts can't use Binet's Formula, nor the rounded and simpler variant because that requires arbitrary-precision floating-point computation
The repeated-addition algo is more suitable for generator functions, but the matrix algo is used to get as fast as possible to the nth term in the sequence, regardless of the exponent value, without sequentially "touching" every term in the sequence
Exponentiation (matrix or not) usually yields huge numbers, BigInts are more suitable for this task. Using Numbers would usually return Infinity
All numbers used are integers, no need for floating-point or fixed-point
I want to make a PR, but I opened this issue to wait for approval
The text was updated successfully, but these errors were encountered:
This file uses
Number
s at the matrix algorithm to compute the nth number in the Fibonacci sequence. My reasons to recommendBigInt
are these:BigInt
s can't use Binet's Formula, nor the rounded and simpler variant because that requires arbitrary-precision floating-point computationBigInt
s are more suitable for this task. UsingNumber
s would usually returnInfinity
I want to make a PR, but I opened this issue to wait for approval
The text was updated successfully, but these errors were encountered: