< previous page page_167 next page >

Page 167
6.2.3.1.2.2.7
easter_gregorian_obeirne_2 ()
This routine (Listing 6.20) for Gregorian Easter from T. H. O'Beirne's Puzzles and Paradoxes. This is the second of two alternative procedures given.
6.2.3.1.2.2.8
easter_oudin ()
This routine (Listing 6.21) produces the date of Easter for years in the Gregorian calendar system.
Listing 6.20 easter_gregorian_obeirne_2 ()
/* eastrgo2.c


   +-------------------------------------------+
   |   Copyright (C) 1995 by Lance W. Latham.  |
   |         All rights reserved.              |
   +-------------------------------------------+


   Routine for Gregorian Easter from T. H. O'Beirne. "Puzzles and
   Paradoxes". This is the second of two alternative procedures given.


   INPUTS:
   1. year, type int, the year in the Gregorian calendar for which
      the date of Easter is desired. Valid values are 1583 to INT_MAX.


   OUTPUTS:
   1. Returned by routine, a DATE_INFO structure containing the date
      of Easter for the input year. Valid values for month and day are
      such that no date can occur before 22 March or after 25 April.


   NOTES:
   1. This routine is based on Table 10b, page 180 of O'Beirne, and is
      the set of 'lower rules' which emphasize simplicity of computation
      rather than explanatory power.
   2. O'Beirne states (page 178) that the algorithm is based on a procedure
      which was first given in "Nature" in 1876 by an anonymous New York
      correspondent. On page 181, O'Beirne states that the rules of Table
      10b are an alternative procedure which introduce 'various sophistications',
      but are arithmetically equivalent to the rules of Table 10a.
   3. This routine returns a date of all zeroes for years less than 1583.
      No other validation is performed, and no warning is issued in this case.
*/
#include "dateinfo.h"


struct DATE_INFO easter_gregorian_obeirne_2 (int year)
{
   int a, b, c, d, e, f, g, h, j, k, m, n, p, q, t;
   struct DATE_INFO date;


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


 
< previous page page_167 next page >