Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork5.7k
Closed
Description
This file usesNumber
s at the matrix algorithm to compute the nth number in the Fibonacci sequence. My reasons to recommendBigInt
are these:
BigInt
s can't useBinet's Formula, nor therounded 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 yieldshuge numbers,
BigInt
s are more suitable for this task. UsingNumber
s would usually returnInfinity
- 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