Follow Slashdot stories on Twitter

 



Forgot your password?
typodupeerror
×
Math Science

The Math of Leap Days 225

The Bad Astronomer writes "We have leap days every four years because the Earth's day and year don't divide evenly. But there's more to it than that... a lot more. A year isn't exactly 365.25 days long, and that leads to needing more complicated math and rules for when we do and don't have a leap year. If you've ever wanted to see that math laid out, now's your chance, and it only comes along every four years. Except every hundred years. Except every four hundred years."
This discussion has been archived. No new comments can be posted.

The Math of Leap Days

Comments Filter:
  • Its not that hard (Score:5, Interesting)

    by suso ( 153703 ) * on Wednesday February 29, 2012 @04:29PM (#39201703) Journal

    On climagic I laid it out in less than 140 characters. [twitter.com]

  • by RyoShin ( 610051 ) <<tukaro> <at> <gmail.com>> on Wednesday February 29, 2012 @04:32PM (#39201757) Homepage Journal

    One of my first projects in Computing and Algorithms I in college was to make a calendar that would print out in console with days correctly placed on the day of the week. The instructions specified to take special care for leap day; everyone thought they understood leap day, so no one bothered to check on the rules. The fact that round centuries do not include a leap day except when (year mod 400 = 0) meant that every one of our calendars[1] was wrong for certain years (but right for others, IIRC). And our professor docked us points as such. Back then, the entire class (along with myself) felt that we were misled or cheated, but looking back on it now that was an important lesson on project management, specifically researching requirements and checking with the interested party about how things are.

    I reckon this lesson was missed by many, which leads to the various issues we see for software on Leap Day, including Microsoft's Azure as mentioned in a recent /. article.

    [1] For the half of the class that completed the project, this 101 class was used to weed out those who couldn't actually program for crap and the EEs just needed a C to meet their requirement.

  • Re:Complicated? (Score:2, Interesting)

    by Anonymous Coward on Wednesday February 29, 2012 @04:42PM (#39201877)

    unless it's the turn of the century, cuz those aren't leap years. Unless it's every fourth turn of the century, because those ones are. Hence why 2000 was a leap year, even though according to the century rule it wasn't supposed to be one. 2100 won't be a leap year.

  • Re:Totally agree. (Score:5, Interesting)

    by jc42 ( 318812 ) on Wednesday February 29, 2012 @05:38PM (#39202521) Homepage Journal
    What I like to do when people seem confused about leap-year calculation is quote them the text in Pope Gregory's definition in the February 24, 1582 document "Inter Gravissimas":

    "Deinde, ne in posterum a XII kalendas aprilis aequinoctium recedat, statuimus bissextum quarto quoque anno (uti mos est) continuari debere, praeterquam in centesimis annis; qui, quamvis bissextiles antea semper fuerint, qualem etiam esse volumus annum MDC, post eum tamen qui deinceps consequentur centesimi non omnes bissextiles sint, sed in quadringentis quibusque annis primi quique tres centesimi sine bissexto transigantur, quartus vero quisque centesimus bissextilis sit, ita ut annus MDCC, MDCCC, MDCCCC bissextiles non sint. Anno vero MM, more consueto dies bissextus intercaletur, februario dies XXIX continente, idemque ordo intermittendi intercalandique bissextum diem in quadringentis quibusque annis perpetuo conservetur."

    This quote should make the algorithm clear to any competent programmer. Note that it contains the explicit example that in the year 2000, February contains 29 days.

    Of course, it can be expressed in many fewer characters in most programming languages. But the pope's astronomer didn't have any programming languages available back in 1582.

    It can be fun to point out that the above Latin passage is still the "official" definition of the leap year scheme, since no standards body has tried to revise it. As far as I've been able to determine, that is; let me know if this has ever actually happened. It'd be especially fun if some standards body had tried to rephrase this in a modern language, but got it wrong. If so, they were probably shocked to discover that a 16th-century pope's edict trumped their scientific calcuations.

    (The /. software guys might be able to block posting in Russian or Chinese or Arabic, but it's a lot harder to prevent people from using Latin. ;-)

  • Re:Duh. (Score:4, Interesting)

    by blueg3 ( 192743 ) on Wednesday February 29, 2012 @06:06PM (#39202821)

    UTC includes leap seconds. TAI does not.

  • by camperdave ( 969942 ) on Wednesday February 29, 2012 @06:46PM (#39203215) Journal
    I like the Shire Reckoning calendar better. Twelve months of 30 days, with 5 days in the middle of summer that are not assigned to any month. In leap year, there are six. Being in the middle of the summer (and being of hobbit origin), these days are used for parties and feast days.

He has not acquired a fortune; the fortune has acquired him. -- Bion

Working...