Re:Writing a Mathematica Interpreter in Typescript
by groos on Tuesday October 22, 2024 @11:44AM
(#41915457)
This is not the Fibonoacci sequence because the first two terms are 0 and hence the entire sequence is 0.
Re:Writing a Mathematica Interpreter in Typescript
by bonzini on Tuesday October 22, 2024 @01:39PM
(#41916676)
Indeed, the Fibonacci sequence is in the original benchmark and Fib(15) is not benchmarking big integer performance. It should have the same characteristics as the always-zero function.
Re:Writing a Mathematica Interpreter in Typescript
by spinningslate on Tuesday October 22, 2024 @03:51PM
(#41918009)
I think gp's point is that bif[n_] == 0 for all n_. A 'smart' optimser would recognise this and so the time to compute would be (a) constant irrespective of the value of n_, and (b) instantaneous because the function call can be re-rewritten as the constant value 0.
Re:Writing a Mathematica Interpreter in Typescript
by bonzini on Wednesday October 23, 2024 @04:38AM
(#41923072)
Understood, and my point is that user Someone suggested "bif" as a way to avoid testing bigint performance; but fib[15] does not test bigint performance.
So using bif is unnecessary and potentially harmful if it's optimized to zero.
As a quick double-check, fib(n)< 2^(n-1) and 2^14 is 16384.