Why I ended up playing with C, Java and the Fibonacci series on the last free afternoon of the September Vacation.

Here are the times taken to use recursive Fibonacci function calls to compute the first 47 numbers in the Fibonacci series.

Using C with longs

real 2m8.373s
user 2m5.776s
sys 0m0.196s

Using Java with longs

real 1m20.120s
user 1m18.969s
sys 0m0.088s

Using Java with longs wrapped in BigIntegers.

real 23m49.209s
user 23m36.449s
sys 0m7.944s

Think about it and draw your own conclusions!

Here are the source code files used: fib.c, Fib.java and BigFib.java.

If you run the Java with longs example you will notice that the 46th value computed is negative. Why?