NavList:
A Community Devoted to the Preservation and Practice of Celestial Navigation and Other Methods of Traditional Wayfinding
From: Frank Reed
Date: 2023 Oct 4, 06:15 -0700
I saved this message for a week because I didn't want to distract from the little eclipse puzzle.
WRITTEN ON 27 SEP 8-9pm Eastern US time:
On Wednesday, Sep 27, Lars Bergman noticed a BUG in my web apps that specifically affected the Sun on the date of the solar eclipse, 14 October 2023. That was merely a coincidental date --with very long odds against it (see below). The errors were large, and it was certainly shocking to see a problem like this where the Sun was flying along several degrees away from the ecliptic! Two days ago [two days before Sep. 27] I did some maintenance work on the apps, and my first guess was that I must have broken something there. Turns out that was not the case.
I don't now how it occurred to me, but I had a hunch that it could be some sort of date-rollover bug. Then I realized that the date of the October solar eclipse is 100,000 days from the current zero date in my web apps (which is close to 1 jan 1750 on the Gregorian calendar). There's a rollover that happens every 10,000 days internally, and that was the cause of the bug. It was a y2k-ish sort of problem that I had never seen before because 10,000 days is 27.4 years, and the last time this bug would have fired for current data was in 1996, before the apps existed. The bug affected only the Sun on one otherwise unremarkable day every 27.4 years. The engine underlying the app is nearly twenty years old. Nonetheless there was a roughly 1 in 50,000 chance for a random date that someone might have previously encountered the bug by looking at data in earlier decades and centuries (for example, on 17 may 1777 or maybe on 11 jan 1969!). I did tens of thousands of automated tests over the years with random dates and apparently never hit it.
Thanks to Lars for calling the bug to my attention. Fortunately it was easily fixed, one single line of code, with very little chance of collateral damage.
Frank Reed
Clockwork Mapping / ReedNavigation.com
Conanicut Island USA
PS: Consider this: if there had been no coincidental eclipse, and if I had not specifically mentioned this eclipse because I'm teaching Sun sights on that date [that's the big factor], this bug might have gone un-noticed forever. You might think it would have been discovered on the next 27.4 year cycle which would be in February of 2051. That's not likely since 1) the app as it stands, dies on its own just before 2050 [and probably I die, too, before then], 2) web apps will be unlikely tools in 2051 [probably, but in early 2004 when I first started working on the current engine, I would have bet substantial money that the app(s) would not have lasted three years, let alone twenty!], 3) and most importantly, there's a complete re-build under construction right now, and there will be no remnants of the old engine in it.