Référence:
|
Le Script est en format C++.
/*************************************************************
*
*
*
*
* EASTER
*
* Function: Given a date in date form, it will return
* the date for Easter Sunday, in normalized
* day-of-year form, i.e. without regard to
* leap years, so April 1 will always be
* represented as day 91.
*
* Author: Nils Andersson
*
* Date: 91-July-12
*
* Reference: Bergstrand, Astronomi, Stockholm 1925,
* pp. 78-80,
* describing a simplified version of Euler's
* algorithm, applicable to the years 1900-2099.
*
************************************************************/
int easter ( int year )
{
int s, t, a, b, c, d, e, i;
t = year - 1900;
s = int ( t/4 );
a = t % 19;
i = 11 * a;
b = i % 30;
c = ( t+s)% 7;
d = b % 7;
i = 6 + c - d;
e = i % 7;
if ( b <= 24 )
return ( 52-b-e+59 );
else
{
i = 49-b-e;
if ( i == 15 || i == 16 )
i = i + 7;
else if ( ( i == 17 || i == 18 ) && e == 6 )
i = i + 7;
return ( i + 90 );
}
}
|