< previous page page_168 next page >

Page 168
(continued)
Listing 6.20
   if (year < 1583)
      return (date);
   b = year / 100;
   c = year % 100;
   a = ((5 * b) + c) % 19;
   t = ((3 * b) + 75);
   d = t / 4;
   e = t % 4;
   g = ((8 * b) + 88) / 25;
   h = ((19 * a) + d - g) % 30;
   m = (a + (11 * h)) / 319;
   t = 300 - (60 * e) + c;   j = t / 4;
   k = t % 4;
   f = ((2 * j) - k - h + m) % 7;
   t = (h - m + f + 110);
   n = t / 30;
   q = t % 30;
   p = (q + 5 - n) % 32;
   date.year = year;
   date.month = n;
   date.day = p;


   return (date);
}

Listing 6.21 easter_oudin ()
/* easter_o.c
   +-------------------------------------------+
   |   Copyright (C) 1995 by Lance W. Latham.  |
   |         All rights reserved.              |
   +-------------------------------------------+
   Routine for producing the date of Easter for years in the Gregorian calendar system.


   INPUTS:
   1. year, type int, the year in the Gregorian calendar for which the date of
      Easter is desired. Valid values are 1583 to 32767, assuming a 16-bit integer.


   OUTPUTS:
   1. Returned by routine, a DATE_INFO structure containing the date
      of Easter for the desired year.


   NOTES:
   1. This is the Easter routine of Oudin. The algorithm is credited
      to J.-M. Oudin, "Etude sur la Date de Paques", Bulletin Astronomique,
      1940, (2) volume 12, pages 391410. The citation appears in "The
      Explanatory Supplement to the Astronomical Almanac", page 582.


   2. This routine returns a date of all zeroes for invalid years (years < 1583).
      No other validation is performed and no warning is issued in this case.


   3. The date returned is the date of 'Western' Easter, not Easter in
      the Eastern Church tradition.
*/

 
< previous page page_168 next page >