Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!comp.vuw.ac.nz!conrad From: Conrad.Bullock@comp.vuw.ac.nz (Conrad Bullock) Newsgroups: comp.lang.pascal Subject: Re: Leap year function Message-ID: <1991May25.050619.21752@comp.vuw.ac.nz> Date: 25 May 91 05:06:19 GMT References: <26912@adm.brl.mil> <1991May17.074806.130@hls.com> <1991May25.031535.1054@cs.mcgill.ca> Sender: news@comp.vuw.ac.nz (News Admin) Organization: Computer Science, Victoria University, Wellington, NewZealand Lines: 28 Nntp-Posting-Host: downstage.comp.vuw.ac.nz Originator: conrad@downstage.comp.vuw.ac.nz In article <1991May25.031535.1054@cs.mcgill.ca>, einstein@cs.mcgill.ca (Michael CHOWET) writes: |> So, getting back to the original purpose of this post, the function |> would |> look more like: |> |> function LEAPYEAR ( year : integer ) : boolean ; |> |> begin |> |> LEAPYEAR := ( year mod 100 <> 0 ) and ( year mod 4 = 0 ) ; |> |> end { of function LEAPYEAR } ; I think that there is an additional rule - if a year is divisible by 400, then it IS a leap year - so 2000 is divisible by 4, so it is a leap year, but it is divisible by 100, so it ISN'T a leap year, but it is divisible by 400, so it IS a leap year. This rule is significant, with 2000 coming up. If you just forget about the whole lot, and use being divisible by 4, then your program will work until the year 2100. -- Conrad Bullock | Domain: conrad@comp.vuw.ac.nz Victoria University of Wellington, | or: conrad@cavebbs.gen.nz New Zealand. | Fidonet: 3:771/130 | BBS: The Cave BBS +64 4 643429