Re: Year 2000 is NOT a leap year
Posted in 1997
>From: newsrdr@mew.corp.sgi.com (Pablo Sanchez) >Date: 8 Jul 1997 22:11:50 GMT >X-Informix-List-Id: <news.40215> > >In article <5pud5s$4mb@cssun.mathcs.emory.edu>, johnl@informix.com writes: >>>Moffat (lpm008@email.mot.com) writes: >>> >>>This is to the person who has an informix 2 legacy system. >>> The year 2000 is not a leap year. >> >>This is to the person who thinks that the year 2000 is not a leap year. >> >> ****************** >> ** Think Again! ** >> ****************** >> >> if (year % 400 == 0) >> leap_year = true; >> else if (year % 100 == 0) >> leap_year = false; >> else if (year % 4 == 0) >> leap_year = true; >> else >> leap_year = false; >You're right, the year 2000 is a leap year but your formula is outta >whack. It should be: > > if (year % 4 == 0 && year % 100 != 0 || year % 400 == 0) > leap_year = true; > else > leap_year = false; Where does your formula produce a different result (as opposed to computation time) from the one I gave? The answer is nowhere! See the attached code for a demonstration for the years 1753 through 9999. Please get your facts straight before telling me to get mine sorted out. >> You need to take a remedial course in 'The Year 2000 -- Issues for >> Computer Professionals'. > >Kinda harsh eh? Given the strident comment to which I was responding, I don't think the remedial course suggestion is harsh at all. The guy is making a blatantly false statement on a subject which computer professionals above all others need to be aware of, and which they need to get right. It's bad enough have the press on our backs (the lawyers will come later, after the year 2000 debacle -- starting around 1st March 2000), without having computing pepole distribute misinformation too. Yours, Jonathan Leffler (johnl@informix.com) #include <disclaimer.h> PS: I decline to respond to messages with anti-spam in the return path. --------------------------------------------------------------------------- #include <stdio.h> typedef enum { false, true } Boolean; Boolean pablo(int year) { Boolean leap_year; if (year % 4 == 0 && year % 100 != 0 || year % 400 == 0) leap_year = true; else leap_year = false; return(leap_year); } Boolean johnl(int year) { Boolean leap_year; if (year % 400 == 0) leap_year = true; else if (year % 100 == 0) leap_year = false; else if (year % 4 == 0) leap_year = true; else leap_year = false; return(leap_year); } int main() { int year; for (year = 1753; year <= 9999; year++) { if (pablo(year) != johnl(year)) printf("Year %d, Pablo %d, JohnL %d\\n", year, pablo(year), johnl(year)); return(1); } return(0); }