Tom Kauffman wrote:
>But we computer types have things screwed up based on the two-digit
>year, and thus the Y2K problem. And even some of the code that
>*looks* like it will handle Y2K properly is broken - many people do
>not realize that 2000 is a leap year. They look at the statement that
>'any year divisible by 4 is a leap year, unless it's a century' and
>don't realize that every fourth century is also a leap year.
When I learned programming (many years ago in COBOL) we were taught a
very simple and easy to remember rule for determining if a year is a
leap year.
A year is a leap year if divisible by 4. However if
divisible by 100 then it is only a leap year if also
divisible by 400.
and I derived the following C macro to test for leap years from this
rule.
#define isleap(x) (x % 4 ? 0 : x % 100 ? 1 : x % 400 ? 0 : 1)
Steve Crane
[EMAIL PROTECTED]
http://www.datapro.co.za/~stevec
-
To get out of this list, please send email to [EMAIL PROTECTED] with
this text in its body: unsubscribe suse-linux-e
Check out the SuSE-FAQ at http://www.suse.com/Support/Doku/FAQ/ and the
archiv at http://www.suse.com/Mailinglists/suse-linux-e/index.html