Computes the n-th Fibonacci number using memoization and BigInt.
n
Uses an internal cache to store results for improved performance. Automatically switches to BigInt for large values.
The non-negative integer or bigint representing the position.
The n-th Fibonacci number as a BigInt.
fibonacci(10); // 55nfibonacci(100n); // 354224848179261915075n Copy
fibonacci(10); // 55nfibonacci(100n); // 354224848179261915075n
If n is negative or not an integer.
1.2.0
Computes the
n
-th Fibonacci number using memoization and BigInt.Uses an internal cache to store results for improved performance. Automatically switches to BigInt for large values.