Art,
I wish you well, but these problems are not new ones; most of them were
dealt with definitively by Gauss, albeit using the astronomical Julian
calendar to do so.
The Gregorian Day (GD) associated with a given date triplet, (y,m,d), is
just
G(y,m,d) = 365(y - 1) + (y - 1)//4 - (y - 1)//100 + (y - 1)//400 + CDT(m -
1) + d
where CDT is a 13-element zero-origin (sic) cumulative days table, or rather
two of them, one for lean and one for non-leap years, of the forms
0, 31, 60, 91, 121, 152, 182, 213, 241, 274, 305, 335, 366
0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365
The number of elapsed days between two dates, (Y,M,D) and (y,m,d), is then
trivially obtainable as
G(Y,M,D) - G(y,m,d).
Other "linearizing" schemes, among them the one you're looking at, flat out
don't work, not least because there are intervals of seven successive years
around centurial years, e.g., the interval 1997, 1998, 1999, 2000, 2001,
2002, 2003, that contain NO leap year.
It is not sufficiently realized that calendrical computations are a
specialist topic. People who would never consider writing their own sine
and cosine subroutines feel quite free to write date-handling routines
without knowing enough about what they are doing, and the results are always
deplorable or worse.
John Gilmore
Ashland, MA 01721
USA
_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today - it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html