News for hackers. Stuff that matters.
Re:Code and Trust: Vibrators to Pacemakers by amluto on Thursday July 10, 2025 @01:50AM (#44517704)
One can reasonably debate where the Fibonacci sequence starts. Their fib implementation is unquestionably broken for negative inputs, but fortunately they don’t supply negative inputs.

But try reading the code that calls fib. It’s so outrageously wrong that it’s fairly easy to read it and pretend they wrote something sensible. Never mind that there isn’t actually a straightforward single-line fix - next_fib would be an entirely different beast from fib.

If they had started with frequency = 4, the real effect of the code would have been to send a couple pulses and then to spend very rapidly (worse than exponentially) increasing time and stack space trying to compute fib.

Re:Code and Trust: Vibrators to Pacemakers by maxbond on Thursday July 10, 2025 @01:54AM (#44517734)
I had missed that, thanks. That is whack. (The input to fibonacci() is it's last output.)
Re:Code and Trust: Vibrators to Pacemakers by maxbond on Sunday July 13, 2025 @04:33AM (#44548578)
This doesn't really matter but it does occur to me that you can't really reasonably debate where the Fibonacci sequence starts, because if it started at 2, then 1 wouldn't be a Fibonacci number. But indeed, it's not only a Fibonacci number, but the only one to be in the sequence twice. (You can of course skip ahead if you have some need to do so.)