Skip to content

Commit

Permalink
Fibonacci should only be calculated for values bigger than 2. In this…
Browse files Browse the repository at this point in the history
… case, ther should be a less or equal comparison, instead of less than.
  • Loading branch information
hardliner66 committed Apr 8, 2016
1 parent cb2da7a commit 1777e45
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion std/functional.d
Original file line number Diff line number Diff line change
Expand Up @@ -1067,7 +1067,7 @@ unittest
{
ulong fib(ulong n)
{
return n < 2 ? 1 : memoize!fib(n - 2) + memoize!fib(n - 1);
return n <= 2 ? 1 : memoize!fib(n - 2) + memoize!fib(n - 1);
}
assert(fib(10) == 89);
}
Expand Down

0 comments on commit 1777e45

Please sign in to comment.