3 ms·
Javascript integers can only reliably represent values up to 2^53, as they are implemented by 64-bit floats [1]. This means that fib(73) and below are correct,
by shoo 15y ago
Javascript integers can only reliably represent values up to 2^53, as they are implemented by 64-bit floats [1]. This means that fib(73) and below are correct, but fib(74) and onwards are almost certainly going to be wrong.
The one-millionth fibonacci number, fib(1000000), has 208988 digits when written as a decimal. It takes about a minute to compute fib(1000000) with python 2.6 and write it to file.
I am completely missing the point, but this does amuse me. Framework/language pissing match descends into performance benchmark battle where no-one cares about correctness?
1. http://www.jwz.org/blog/2010/10/every-day-i-learn-something-new-and-stupid/ http://www.jwz.org/blog/2010/10/every-day-i-learn-something-...
- d0mine 15y agoMinute is too long: $ time curl -s http://localhost:1597/sicpfib/1000000 >sicp.out real 0m1.856s user 0m0.000s sys 0m0.000s $ wc sicp.out 0 1 208988 sicp.out https://github.com/zed/txfib https://github.com/zed/txfib