< previous page page_165 next page >

Page 165
6.2.3.1.2.2.6
easter_gregorian_obeirne_1 ()
This routine (Listing 6.19) for Gregorian Easter is from T. H. O'Beirne's Puzzles and Paradoxes. This is the first of two alternative procedures given.
(continued)
Listing 6.18
   2. Meeus does not provide a valid date range. He states that Julian
      Easter has a periodicity of 532 years, and indicates that Easter
      falls on April 12 for the years 179, 711 and 1243.


   3. This routine assumes a valid date range of A.D. 1 to 1582, for the
      following reasons:


      3.1. A date of Easter prior to the year A.D. 1 has no historical meaning.


      3.2. The Julian calendar ends with the year A.D. 1582.


      This routine returns a date of all zeroes for input years outside this range.
      No other validation is performed, and no warning is issued in this case.
      These limits are arbitrary, and based upon historical considerations, rather
      than any consideration of the routine as a Julian proleptic algorithm.
*/


#include "dateinfo.h"


struct DATE_INFO easter_julian_meeus (int year)
{
   int a, b, c, d, e, f, g, h;
   struct DATE_INFO_date;


   date.year = 0;
   date.month = 0;
   date.day = 0;


   if (  (year < 1) || (year > 1582)  )
      return (date);


   a = year % 4;
   b = year % 7;
   c = year % 19;
   d = (19 * c + 15) % 30;
   e = (2 * a + 4 * b - d + 34) % 7;
   h = (d + e + 114);
   f = h / 31;
   g = h % 31;


   date.year = year;
   date.month = f;
   date.day = (g + 1);


   return (date);
}


 
< previous page page_165 next page >