Perl: the Markov chain saw | |
PerlMonks |
Leap years? How does that work?by talexb (Chancellor) |
on Feb 02, 2022 at 02:33 UTC ( [id://11141046]=perlmeditation: print w/replies, xml ) | Need Help?? |
In my defence, I'm a nerd. Dad's a retired actuary, and I've been fiddling with math and logic puzzles forever. So it made sense that an idea that's been bubbling away in my head decided to wake me this morning. I wanted to write it down immediately, but I had to have breakfast, then I had to head out for my weekly grocery shopping during a pandemic thing, then I had to put in my work day. Then I had supper and a couple of glasses of wine. So at this point, I'm ready to jot down a few thoughts on leap years. Imagine, if you will, the time and effort it took for people to realize that while 365 days in a year was very close, it was not quite the right value. Then imagine the you are the brave astronomer and local science dude who has to have a polite conversation with, say, The Pope about this, having already braved the underlings and the Pope's secretary. Why the Pope? Because he's the one who is going to say, OK, we're going to change the calendar now., and people are going to listen and obey. Astronomer: You Holiness, Thank you for taking time out of your day to see me. I will be brief. The Pope: Galileo! So good to see you. Please, call me Jules! A: Your Holiness, please. TP: OK, OK, I kid. So, they tell me you want to change the calendar? How's that work? A: OK, You may recall we have been using 365 days in a year, but you will also know that we've discovered this is incorrect -- we're falling behind. The Winter solstice is now mid-January, and we need to sort things out. TP: Yes, yes, that's fine, we'll just publish a decree to reset the date. Will that be all? A (quaking a little): You holiness, it's a bit more complicated. We need to add an occasional day to make things work out. A year is about 365.24 days. TP: Ah, so your first approximation is to add a day every four years? A (surprised): Your Holiness! You have an excellent grasp of the mathematics! TP: Yes, yes, thank you. But this gets us only part the way there. What else? A: Well, every hundred years we'll skip the extra day. TP: Is that it? A: Also, every four hundred years, we have to add it back in. TP: Well, that sounds fine. So we'll an extra day in December, and make it 32 days every .. once in a while? A: Well, your holiness, that is a possibility, but I'd like to suggest making the shortest month the recipient of this extra day. Say, February, which currently has just 28 days. TP: An extra day of winter? Are you sure that's wise? A: As you know, holiness, winter is 91 days, no matter when they fall. TP: Very well, very well. So, February 29th every now and then? A: Yes, that's all. Anyway, this is a Perl site, so the obligatory code snippet is And I pray to the FSM that this code's right. And .. someone below will no doubt chime in about the details of the Julian calendar .. you're quite right, I did absolutely no research on this (apart from my likely faulty memory), but I just thought it would have been an entertaining discussion about Changing The Calendar .. although that far back, it probably had far less impact on most people living their lives. Peasant #1: Oy! What day is it? Peasant #2: Haven't the faintest. Epiphany was a few days ago, so late January, early February is my guess. Why do you care? P1: Good point. Just curious .. I heard they were changing the calendar. P2: Madness. Change the calendar? Why? Edit: Yeah, I got the code wrong. Fixed it already. ugh
Back to
Meditations
|
|