TIP: Click on subject to list as thread! ANSI
echo: os2rexx
to: Steve McCrystal
from: Jonathan de Boyne Pollard
date: 1999-10-20 09:16:21
subject: Leap year rules

 SM> I remember seeing in here recently a set of rules for determining if a
 SM> given year is a leap year.  We had a discussion about it at work
 SM> yesterday, and there was considerable disagreement (not surprising!)
 SM> I came home and looked for the text (I was SURE I had saved it) but
 SM> the topic has scrolled out of my Fido message base, and IF I saved it
 SM> I surely can't find it.

Julian Calendar 
---------------

(Created at the order of Gaius Julius Caesar and adopted around 8BCE.)

A year is a leap year if evenly divisible by 4.

All '00 years, including 1900 and 2000, are leap years under this system.

        isjulianleap: procedure
            parse arg y
            return (y // 4) == 0

Gregorian Calendar 
------------------

(Created at the order of Pope Gregory XIII and adopted by the Roman Catholic
Christian church in 1582CE, and in Protestant countries some time later --
1752CE in Britain and its Dominions, for example.)

A year is a leap year if
    (a) it is not evenly divisible by 100 but is evenly divisible by 4,
    (b) it is evenly divisible by 100 and also evenly divisible by 400.

2000, 2400, and 2800 are leap years under this system, but 1900 and 2900 are
not.

        isgregorianleap: procedure
            parse arg y
            if (y // 100) \= 0 then 
                return (y // 4) == 0
            else
                return (y // 400) == 0

Revised Julian Calendar
-----------------------

(Created at the order of the General Synod and adopted by the Eastern Orthodox 
Christian church in 1921.)

A year is a leap year if
    (a) it is not evenly divisible by 100 but is evenly divisible by 4,
    (b) it is evenly divisible by 100 and the remainder when divided
        by 900 is either 200 or 600.

2000, 2400, and 2900 are leap years under this system, but 1900 and 2800 are
not.

        isrevisedjulianleap: procedure
            parse arg y
            if (y // 100) \= 0 then 
                return (y // 4) == 0
            else
                return ((y // 900) == 200) | ((y // 900) == 600)

Of the three, the Revised Julian Calendar produces a Mean Calendar Year length 
that is closest to the current length of the Mean Solar Year.  Keeping the two 
the same length is, of course, the whole point of the intercalation of extra
days ("leap days").

 ¯ JdeBP ®

--- FleetStreet 1.22 NR
* Origin: JdeBP's point, using Squish (2:257/609.3)

SOURCE: echoes via The OS/2 BBS

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.