RockstarLang/rockstar

nth-fibonacci example contains an error.

MarijnRitzen opened this issue · 0 comments

Give back the night and my life

I think this is one of those bugs that is not so wrong that you notice it.
Running it with for example n = 19 gives 2584. This should be 4181. The reason for this is that the author of the algorithm probably thought he was adding the night and my life. However add is for boolean expressions and not for addition. Thus, in his 19th turn, the algorithm does 1597 and 2584 which (because 1597 is truthy) evaluates to 2584. This should be 1597 plus 2584 to get the correct answer of fibonacci(19) == 4181.