Hopefully in 2036 I'm not calling 2021-me an idiot, too. Here's an interesting old bug situation:
Dan Worrall posted a video on the 1175 JSFX, which was written by
Scott Stillwell, way back in 2006, and graciously provided for inclusion with REAPER. In this video, Dan finds that the ratio control is completely broken, and posits a fix to it (adding a division by 2.1).
Sure enough, the code was broken. I went looking through the code
1 to see why, and sure enough, there's a line which includes a multiply by 2.08136898, which seems completely arbitrary and incorrect! OK, so we see the bug
2. How did that constant get there?
When the 1175 JSFX was originally written, REAPER and JSFX were very young, and the JSFX log() (natural log, we'll call it by ln() from now on) and log10() implementations were broken. On a 8087 FPU, there are instructions to calculate logarithms, but they work in base 2, so to calculate ln(x) you use log2(x)/log2(e)
3. Prior to REAPER 1.29 it was mistakenly log2(x)*log2(e), due to the ordering of an fdiv being wrong
4 and insufficient (or non-existent, rather) testing. So when that got fixed, it actually fixed various JSFX to behave correctly, and that should've been the end of it. This is where the stupid part comes in.
I opted to preserve the existing behavior of existing JSFX for this change, modifying code that used log() functions to multiply log2(e)*log2(e), which is .... 2.08136898. Doh. I should've tested these plug-ins before deciding to make the change. Or at least understood them.
Anyway, that's my story for the day. I'm rolling my eyes at my past self. As a footnote, schwa found that googling that constant finds some interesting places where that code has been reused, bug and all.
* 1 (beyond our SVN commits and all the way back to our VSS commits, all of which have thankfully been imported into git)
* 2 (and it will be fixed in REAPER 6.26, we're calling the non-fixed mode "Broken Capacitor" because that felt about right)
* 3 (or if you're clever and care about speed, log2(x)*ln(2) because ln(X) = logX(X)/logX(e) and logX(X)=1, but now my head hurts from talking about logarithms)
* 4 I haven't fully tested but I think it was working correctly on Jesusonic/linux, and when porting the EEL2 code to MSVC I didn't correctly convert it.
3 Comments
Well I failed at writing more during the pandemic. Shit.
I made a bunch of youtube videos w/ super8, including a tutorial which might be useful to some people:
(youtube link)
WARNING - DO NOT READ -- boring personal health/running related story follows. This is here for my own future reference, mainly:
In May of last year I was running a lot, laps on the roof and outside. I wasn't bicycling much. My knee started feeling weird and not really working right.
Normally I'd go to the chiropractor, but with the pandemic I was avoiding things like that. So I tried massaging all of the bits around the knee, to try to
loosen it all up. Bad move. I soon discovered that I had completely pissed off a bursa, which is a bad idea. That made it hurt to walk.
By July I could run again, a little, but then I was getting a lot of pain around the bursa. More time off. Some bike rides, maybe not enough.
In August I saw my doctor, and then saw an orthopedist. Got an MRI. MRI showed I had a torn meniscus (complex tear, medial horn, something like that).
Ortho recommended surgery to clean it up. Finally went to the chiro, who was helpful. At some point I remember him applying pressure on the lateral side of the
knee, pushing inward, and it popping a bit and then feeling better after it. Read a study about knee surgeries for this type of thing and how the differences of
outcome were hard to measure between surgery and sham surgery. Read that MRIs can tell you about the tears, but there's no way to know whether they are a month
old or 10 years old. I had a few things as a teenager that seem like must have done damage. Anyway, I was still having that bursa pain, but then found some crosswise friction
massage on the tendon helped it almost immediately. After that I was able to run on and off in September to October. By November 6th I went to Forest Park and did 3 laps on the
trails, which was great, but definitely used different muscles and motions vs road running. After that there was some soreness in the knee which felt deep, but after a day off
I was able to start running again every day, with low miles at first, and November 7 until December 27 I ran every day with overall mileage increasing. Things didn't feel great
all of the time but mostly they were OK. Anyway then on December 27, and maybe earlier but I ignored it, biomechanically things started going wrong. And after the Dec 27 run,
the pain returned. A week has gone by since then, it's gradually been getting better, bike rides definitely help. (I just pushed from the lateral side on the knee and popped
and that may have helped too, we'll see). So my current theory is that when I get tired enough and the right muscles weak enough, the knee's form changes such that
it isn't operating correctly, which causes pain. Maybe I can adjust it back when needed, and strengthen the muscles to keep it working right? We'll see...
So for now I've made myself a winter plan, which involves trying to bicycle ever day, not running more than 5 miles a day, not running more than 30 miles a week,
and not doing speedwork. I'm putting that here so that I don't forget.
TL;DR: boring paragraph
Also those last Not Vampires NINJAM tracks were pretty fun! Favorites include Track 4 starting around 7:00 and Track 5 around 2:00
6 Comments