mirror of
https://github.com/TheAlgorithms/Python.git
synced 2024-11-30 16:31:08 +00:00
Rewrite maths/fibonacci.py (#5734)
* Rewrite parts of Vector and Matrix methods * Refactor determinant method and add unit tests Refactor determinant method to create separate minor and cofactor methods. Add respective unit tests for new methods. Rename methods using snake case to follow Python naming conventions. * Reorganize Vector and Matrix methods * Update linear_algebra/README.md Co-authored-by: John Law <johnlaw.po@gmail.com> * Fix punctuation and wording * Apply suggestions from code review Co-authored-by: John Law <johnlaw.po@gmail.com> * Deduplicate euclidean length method for Vector * Add more unit tests for Euclidean length method * Fix bug in unit test for euclidean_length * Remove old comments for magnitude method * Rewrite maths/fibonacci.py * Rewrite timer and add unit tests * Fix typos in fib_binet unit tests * Fix typos in fib_binet unit tests * Clean main method Co-authored-by: John Law <johnlaw.po@gmail.com>
This commit is contained in:
parent
68ca61ecb7
commit
84cca2119c
|
@ -95,8 +95,8 @@ def fib_binet(n: int) -> list[int]:
|
||||||
NOTE 1: this function diverges from fib_iterative at around n = 71, likely
|
NOTE 1: this function diverges from fib_iterative at around n = 71, likely
|
||||||
due to compounding floating-point arithmetic errors
|
due to compounding floating-point arithmetic errors
|
||||||
|
|
||||||
NOTE 2: this function overflows on n >= 1475 because of the size limitations
|
NOTE 2: this function doesn't accept n >= 1475 because it overflows
|
||||||
of Python floats
|
thereafter due to the size limitations of Python floats
|
||||||
>>> fib_binet(0)
|
>>> fib_binet(0)
|
||||||
[0]
|
[0]
|
||||||
>>> fib_binet(1)
|
>>> fib_binet(1)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user