|
|
|
| Listing 6.11 | |
|
|
|
|
OUTPUTS:
1. Returned by routine, type int, the value of epact for the given year.
Valid values for epact are 1 30, but only 19 of the values can
actually occur in the Julian calendar. These values correspond to
specific values for the Golden Number, and are determined by the
following rule:
A given year Y has epact E. The following year, Y + 1, has epact
(E + 11) modulo 30. If the Golden Number of year Y is 19, the epact
of the following year, Y + 1, is (E + 12) modulo 30. Thus, there is
a regular cycle of Golden Numbers (G) and epacts (E):
G : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
E : 8 19 30 11 22 3 14 25 6 17 28 9 20 1 12 23 4 15 26
See O'Beirne, "Puzzles and Paradoxes", Chapter 10, for a more
detailed discussion of epact and its calculation.
NOTES:
1. The word 'epact' comes from the Greek 'epaktos', meaning 'brought in'.
The term may signify either:
1.1. the excess of days in the solar year over the lunar year of
twelve months, or
1.2. the age in days of the moon on 1 January of a given year. This
latter sense is the one used in this routine. This value specifies
the age of the artificial calendar moon in days at the beginning of
the calendar year.
2. This algorithm is based on the one by Donald. E. Knuth, (CACM, v5,
1962, pp 209210). The CACM paper describes an ALGOL procedure for
both Gregorian and Julian calendar systems.
3. This routine returns a value of 0 for years less than 1 and greater
than 1582. No other validation is performed, and no warning is issued
in this case.
4. 'Golden number' (g) is the number of the year in the Metonic cycle,
used to determine the position of the moon.
*/
#include <math.h> /* for floor () */
int epact_julian (int year)
{
int g, epact;
if ( (year < 1) || (year > 1582) )
return (0);
g = (year % 19) + 1;
epact = (((11 * g) - 4) % 30) + 1;
return (epact);
}
|
|
|
|
|
|
|
|