We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8bb0d16 commit 281f491Copy full SHA for 281f491
include/boost/math/special_functions/fibonacci.hpp
@@ -32,8 +32,8 @@ inline BOOST_CXX14_CONSTEXPR T unchecked_fibonacci(unsigned long long n) noexcep
32
if (n <= 2) return n == 0 ? 0 : 1;
33
/*
34
* This is based on the following identities by Dijkstra:
35
- * F(2*n) = F(n)^2 + F(n+1)^2
36
- * F(2*n+1) = (2 * F(n) + F(n+1)) * F(n+1)
+ * F(2*n-1) = F(n-1)^2 + F(n)^2
+ * F(2*n) = (2*F(n-1) + F(n)) * F(n)
37
* The implementation is iterative and is unrolled version of trivial recursive implementation.
38
*/
39
unsigned long long mask = 1;
0 commit comments