< previous page page_162 next page >

Page 162
Listing 6.16 easter_julian ()
/* easter_j.c


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


   Returns the date for 'Western Easter' on a given year in the Julian
   calendar system, for dates after A.D. 463. This date is not the 'Eastern
   Easter' of the Eastern Orthodox churches.


   The algorithm is based on an ALGOL procedure by Donald Knuth in
   CACM, v5, (1962), pp 209210.


   INPUTS:
   1. year, type int. Assumed to be a complete year, not an abbreviated
      2-digit year. The valid input range is 464 to 1582.


   OUTPUTS:
   1. returned by routine, a DATE_INFO structure containing the date on
      which Easter falls for the indicated year.


   NOTES:
   1. Easter is defined as the 'first Sunday following the first
      ecclesiastical full moon which occurs on, or after, March 21'. Due
      to perturbations in the moon's orbit, we use the 'calendar moon'
      for calculation purposes.


   2. 'Golden number' (g) is the number of the year in the Metonic cycle,
      used to determine the position of the calendar moon.


   3. 'Epact' (e) is the age of the calendar moon at the beginning of the
      year, and specifies when a full moon occurs.


   4. 'Extra days' (d) specifies when Sunday falls in the month of March.
*/


#include <math.h>
#include "scdtl_1.h"


struct DATE_INFO easter_julian (int year)
{
   struct DATE_INFO date;
   int g, d, e, n;


   g = (year % 19) + 1;
   d = (int) floor (5 * year / 4);
   e = (((11 * g) - 4) % 30) + 1;


   n = 44 - e;


   if (n < 21)
      n += 30;


   n = n + 7 - ((d + n) % 7);


 
< previous page page_162 next page >