|
It is certainly true, as Joel C. Ewing contends, that bad leap-year code abounds. Unfortunately, it is also true that the assorted TM-_base_d schemes he has presented in a sequence of posts are bad too, even radically misconceived. First, we need a definition: In the Julian calendar every fourth year is a leap year. Call this a simple first-order correction. The Gregorian calendar differs from the Julian one chiefly in introducing an dditional, second-order correction. To do so it distinguishes two classes of years, viz., o centurial years like . . . , -200, -100, 0, 100, . . . , 1800, 1900, 2000, . . . that have a serial number y such that y = 0 mod(100), and o non-centurial years, all the rest. Every fourth non-centurial Gregorian year and every fourth centurial Gregorian year are then leap years, and all the others are common or non-leap years. Cycles of days, cycles of years, and simultaneous multiple cycles of days are a standard mathematical topic. Gauss provided the definitive treatments of them, and the relevant papers are all available in the Werke, in Latin or German. Alternatively, there is a brief but eminently respectable English-language treatment of them in Dershowitz, Nachum, and Edward M. Reingold. Calendrical computations. Cambridge: Cambridge University Press, 1996, pp. 19ff and passim. Without full mastery of this material competent discussion of calendrical arithmetic is impossible, and those who have not mastered it should use the subroutine package of someone else who has to do calendrical arithmetic in just the same way and for the same reasons that engineers who need circular-function, sin, cos, and tan, values should use a subroutine package to obtain them. Calendars come in several flavors, chiefly lunar calendars like the Islamic one, lunisolar calendars like the Julian, Gregorian, and Djalali ones, and astronomical calendars like the Modern Hindu, Chinese and French Revolutionary ones. The idea that permits sense to be made out of all of them and makes date conversions among them possible is that of a day number, the representation of a date as the number of elapsed days inclusive of and following some epoch origin. (Negative day-number values, those of dates that precede an epoch origin are called proleptic ones, but this distinction is not really a very useful one; better perhaps, it is only useful for propitiating those who are suspicious of signed numbers.) Astronomers, who were the first to do serious calendrical arithmetic, represent dates as Julian Days, or JDs. JDs begin at noon and the epoch origin of the astronomical Julian calendar is the Gregorian date November 24, -4713, which is 1_721_424.5 days earlier than the epoch origin of the Gregorian Calendar, midnight, +0001 January 1. Gregorian Days, GDs, which begin at midnight, have their epoch origin on this date. The GD of midnight, 0000 December 31 is thus 0[.0]. The use of GDs permits dates about ten million years before and after this epoch origin to be represented as signed fullword values. The only proper internal representation of a date in a computer system is as a day number or the like. Using one trivializes calendrical arithmetic and eliminates leap-year calculations except in conversions. External representations of dates, those that are displayed or printed for people, must of course be in one of the [many] traditional calendrical forms; but conversion to and from day numbers and calendar dates is easy for coloro che sanno, and mandolinisti should use a subroutine package to do so. They should occupy their time in other ways. After discussing some variant TM-_base_d schemes that operate on year numbers, Ewing ends with If the Pope and Luigi had only been astute enough to think in powers of 2 for all the corrective points, we could not only have had a much simpler algorithm but one that would remain accurate well beyond the year 10,000! I guess we should be thankful they didn't choose a much less accurate corrective point of multiple of 500 years on the grounds that 500 is simpler to express in Roman numerals than 400! This gets nothing right, and it is redeemed only a little if it is wholly jocular. The standard elucidation of the Gregorian calendar is Clavius, Christoph. Explicatio Romani calendarii a Gregorio XIII PM restituti. Romae, 1603. which is reprinted as one the five volumes of Clavius's collected mathematical works. Its is a formidable work by a formidable Jesuit scholar and observational astronomer, who was the mathematical intellect behind the new calendar, which both he and Gregory XII regarded, properly, as a revision of the Julian calendar. If you read Latin, consult it; if not let me offer my assurance that notions of representability or computational ease in roman numerals did not figure in the design of the new calendar. There are some rfetrospectively _object_ionable things in the Gregorian calendar; but they are of a different sort. They reflect the institutional antisemitism of the Catholic Church of the time. (Clavius, who corresponded and collaborated with 11 certainlly and probably more Jewish scholars, was not personally antisemitic.) It was, for example, judged highly undesirable that Passover, Pesach, should occur on the same date as Easter, Pasqua; and the design of the Gregorian calendar ensured that it would almost but not quite never do so by complicating the calculations for the date of Easter gratuitously. The original version of T. S. Eliot's great poem, The Waste Land, included some jocular, patronizing references to Alexander Pope. They are not in the published version because Ezra Pound reminded Eliot that they would only be supportable coming from a better poet than Pope, which he, Eliot, was not. John Gilmore, Ashland, MA 01721, USA Hotmail: Trusted email with Microsoft’s powerful SPAM protection. Sign up now. Reply Reply all Forward New | Delete Junk Not junk | Mark as ▼ Unread Read Phishing scam Move to ▼ Inbox Junk Drafts Sent Deleted list_sub_script_ions main_frame__techniques personal_info resumes | Empty | © 2010 Microsoft Privacy Terms of use Account Feedback distinguishes two classes of years, viz., o centurial years like . . . , -200, -100, 0, 100, . . . , 1800, 1900, 2000, . . . that have a serial number y such that y = 0 mod(100), and o non-centurial years, all the rest. Every fourth non-centurial Gregorian year and every fourth centurial Gregorian year are then leap years, and all the others are common or non-leap years. Cycles of days, cycles of years, and simultaneous multiple cycles of days are a standard mathematical topic. Gauss provided the definitive treatments of them, and the relevant papers are all available in the Werke, in Latin or German. Alternatively, there is a brief but eminently respectable English-language treatment of them in Dershowitz, Nachum, and Edward M. Reingold. Calendrical computations. Cambridge: Cambridge University Press, 1996, pp. 19ff and passim. Without full mastery of this material competent discussion of calendrical arithmetic is impossible, and those who have not mastered it should use the subroutine package of someone else who has to do calendrical arithmetic in just the same way and for the same reasons that engineers who need circular-function, sin, cos, and tan, values should use a subroutine package to obtain them. Calendars come in several flavors, chiefly lunar calendars like the Islamic one, lunisolar calendars like the Julian, Gregorian, and Djalali ones, and astronomical calendars like the Modern Hindu, Chinese and French Revolutionary ones. The central notion that permits sense to be made out of all of them and makes date conversions among them possible is that of a day number, the representation of a date as the number of elapsed days inclusive of and following some epoch origin. Astronomers, who were the first to do serious calendrical arithmetic, represent dates as Julian Days, or JDs. JDs begin at noon and the epoch origin of the astronomical Julian calendar is the Gregorian date November 24, -4713, which is 1_721_424.5 days earlier than the epoch origin of the Gregorian Calendar, midnight, +0001 January 1. Gregorian Days, GDs, which begin at midnight, have their epoch origin on this date. The GD of midnight, 0000 December 31 is thus 0[.0]. The use of GDs permits dates about ten million years before and after this epoch origin to be represented as signed fullword values. The only proper internal representation of a date in a computer system is as a day number or the like. Using one trivializes calendrical arithmetic and eliminates leap-year calculations except in conversions. External representations of dates, those that are displayed or printed for people, must of course be in one of the [many] traditional calendrical forms; but conversion to and from day numbers and calendar dates is easy enough for coloro che sanno, and mandolinisti should use a subroutine package to do so. They should occupy their time in other ways. After discussing some variant TM-_base_d schemes that operate on year numbers, Ewing ends with If the Pope and Luigi had only been astute enough to think in powers of 2 for all the corrective points, we could not only have had a much simpler algorithm but one that would remain accurate well beyond the year 10,000! I guess we should be thankful they didn't choose a much less accurate corrective point of multiple of 500 years on the grounds that 500 is simpler to express in Roman numerals than 400! This gets nothing right, and it is redeemed only a little if it is wholly jocular. The standard elucidation of the Gregorian calendar is Clavius, Christoph. Explicatio Romani calendarii a Gregorio XIII PM restituti. Romae, 1603. which is reprinted as one the five volumes of ... read more »
|