Article View: comp.std.c
Article #4715Re: How to calculate the Holy Easter.
From: Clive D.W. Feather
Date: Sun, 28 Jan 1996 21:44
Date: Sun, 28 Jan 1996 21:44
46 lines
1619 bytes
1619 bytes
>> Hi, can anybody send me a C function to calculate the Easter of every year? >> Thanks in advance, > This is the algorithm Gauss published in 1800 to calculate Easter-date. [...] The Gauss algorithm fails to handle certain elements of the algorithm, and, if I recall correctly, gets A.D. 4200 wrong (it is actually April 20th): > a := Year mod 19; > b := Year mod 4; > c := Year mod 7; > k := Year div 100; a = 1, b = 0, c = 0, k = 42 > p := k div 3; > q := k - k div 4; > m := (q - p + 15) mod 30; > n := (q + 4) mod 7; > d := (19*a + m) mod 30; > e := (2*b + 4*c + 6*d + n) mod 7; > f := d + e - 9; p = 14, q = 32, m = 3, n = 1, d = 22, e = 0, f = 13 > if f <= 0 then > begin > Month := 3; > Day := 31 + f; > end > else > begin > Month := 4; > if f = 26 then Day := 19 > else if (f = 25) and (d = 28) then Day := 18 > else Day := f; > end Gives April 13th, wrong. -- Clive D.W. Feather | If you lie to the compiler, cdwf@cityscape.co.uk (work, preferred) | it will get its revenge. clive@stdc.demon.co.uk (home) | - Henry Spencer
Technical Details
Message-ID:
<DLwv2u.BBE@stdc.demon.co.uk>Path:
arc1-ca.pugleaf.net!stdc.demon.co.uk!cliveReferences:
<4e5kmh$2g9@leporello.cs.unibo.it> <juggler.822536373@iquest.net>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!stdc.demon.co.uk!clive From: clive@stdc.demon.co.uk (Clive D.W. Feather) Newsgroups: comp.std.c Subject: Re: How to calculate the Holy Easter. Date: Sun, 28 Jan 1996 21:44:53 GMT Organization: Demon Internet Limited (personal account) Message-ID: <DLwv2u.BBE@stdc.demon.co.uk> References: <4e5kmh$2g9@leporello.cs.unibo.it> <juggler.822536373@iquest.net> Reply-To: clive@demon.net X-NNTP-Posting-Host: stdc.demon.co.uk