Slashdot Mirror


The Math of Leap Days

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."

2 of 225 comments (clear)

  1. Its not that hard by suso · · Score: 5, Interesting

    On climagic I laid it out in less than 140 characters.

  2. Re:Totally agree. by jc42 · · Score: 5, Interesting
    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. ;-)

    --
    Those who do study history are doomed to stand helplessly by while everyone else repeats it.