-
Notifications
You must be signed in to change notification settings - Fork 128
Open
Description
Recursion broken (fibo.js)?
var console = require("console");
var fibonacci = function(n)
{
if (n < 2)
{
return n;
}
return fibonacci(n - 2) + fibonacci(n - 1);
};
console.log(fibonacci(1));
RESULT:
node ../nerd --run fibo.ng
[*] Generating source file
[*] Compiling with preset: speed
lto-wrapper: warning: using serial compilation of 2 LTRANS jobs
[*] Executing /root/Downloads/nerd-master/example/fibo
1
var console = require("console");
var fibonacci = function(n)
{
if (n < 2)
{
return n;
}
return fibonacci(n - 2) + fibonacci(n - 1);
};
console.log(fibonacci(44));
RESULT:
node ../nerd --run fibo.ng
[*] Generating source file
[*] Compiling with preset: speed
lto-wrapper: warning: using serial compilation of 2 LTRANS jobs
[*] Executing /root/Downloads/nerd-master/example/fibo
0
Lowest denominator:
var console = require("console");
var fibonacci = function(n)
{
if (n < 2)
{
return n;
}
return fibonacci(n - 2) + fibonacci(n - 1);
};
console.log(fibonacci(3));
node ../nerd --run fibo.ng
[*] Generating source file
[*] Compiling with preset: speed
lto-wrapper: warning: using serial compilation of 2 LTRANS jobs
[*] Executing /root/Downloads/nerd-master/example/fibo
0
Metadata
Metadata
Assignees
Labels
No labels