NOVEMBREL M M J V S DAVRILL M M J V S D1 2 3 45 6 7 8 9 10 11 1112 13 14 15 16 17 1819 20 21 22 23 24 2526 27 28 29 302004200426 27 28 29 30 3119 20 21 22 23 24 2512 13 14 15 16 17 185 6 7 8 9 10 111 2 3 4JANVIERL M M J V S DMAIL M M J V S D1 23 4 5 6 7 8 910 11 12 13 14 15 1617 18 19 20 21 22 2324 25 26 27 28 29 30312004JUINL M M J V S D1 2 3 4 5 67 8 9 10 11 12 1314 15 16 17 18 19 2021 22 23 24 25 26 2728 29 302004JUILLETL M M J V S D1 2 3 45 6 7 8 9 10 1112 13 14 15 16 17 1819 20 21 22 23 24 2526 27 28 29 30 3120041 2 3 4 5 6 78 9 10 11 11 12 13 1415 16 17 18 19 20 2122 23 24 25 26 27 2829 3020043 Calcul de la date de PâquesOn trouve sur internet, à propos de ce sujet de nombreux sites. Á partir de la définition de la fête proprem<strong>en</strong>tdite, <strong>le</strong>s formu<strong>le</strong>s « magiques » abond<strong>en</strong>t. L’<strong>un</strong>e d’el<strong>le</strong> a ret<strong>en</strong>u mon att<strong>en</strong>tion, je l’ai retranscrite <strong>avec</strong> <strong>le</strong> packagefp. Dans l’ordre, <strong>un</strong> aperçu de la page, puis <strong>le</strong> codage des calculs <strong>avec</strong> fp.Le site : http://www.altcal.com/elmcal.html, et <strong>un</strong> extrait :Version 2.0 - 11 Nov 1998Copyright and disclaimer------------------------This docum<strong>en</strong>t is Copyright (C) 1998 by Claus Tondering.E-mail: claus@tondering.dk.The docum<strong>en</strong>t may be freely distributed, provided thiscopyright notice is included and no money is charged forthe docum<strong>en</strong>t.This docum<strong>en</strong>t is provided "as is". No warranties are made asto its correctness.G = year mod 19For the Julian ca<strong>le</strong>ndar:I = (19*G + 15) mod 30J = (year + year/4 + I) mod 7For the Gregorian ca<strong>le</strong>ndar:C = year/100H = (C - C/4 - (8*C+13)/25 + 19*G + 15) mod 30I = H - (H/28)*(1 - (H/28)*(29/(H + 1))*((21 - G)/11))J = (year + year/4 + I + 2 - C + C/4) mod 7Thereafter, for both ca<strong>le</strong>ndars:L = I - JEasterMonth = 3 + (L + 40)/44EasterDay = L + 28 - 31*(EasterMonth/4)\FPset{\Year}{1981} % placer ici l’année\FPeval\GY{(\Year)-19*tr<strong>un</strong>c((\Year)/19,0)}\FPeval{\C<strong>en</strong>t}{tr<strong>un</strong>c((\Year)/100,0)}
\FPeval{\Iter}{tr<strong>un</strong>c((\C<strong>en</strong>t)-tr<strong>un</strong>c((\C<strong>en</strong>t)/4,0)-tr<strong>un</strong>c((8*(\C<strong>en</strong>t)+13)/25,0)+(\GY)*19+15,0)}\FPeval{\Iterdiv}{tr<strong>un</strong>c((\Iter)/30,0)}\FPeval\Hepact{(\Iter)-30*(\Iterdiv)}\FPeval\Inbre{tr<strong>un</strong>c((\Hepact)-tr<strong>un</strong>c((\Hepact)/28,0)*(1-tr<strong>un</strong>c((\Hepact)/28,0))*(tr<strong>un</strong>c(29/((\Hepact)+1),0)*tr<strong>un</strong>c((21-(\GY))/11,0)),0)}\FPeval\Jnbreinter{tr<strong>un</strong>c((\Year)+tr<strong>un</strong>c((\Year)/4,0)+(\Inbre)+2-(\C<strong>en</strong>t)+tr<strong>un</strong>c((\C<strong>en</strong>t)/4,0),0)}\FPeval\Jnbre{tr<strong>un</strong>c((\Jnbreinter)-7*tr<strong>un</strong>c((\Jnbreinter)/7,0),0)}\FPeval\Lnbre{tr<strong>un</strong>c((\Inbre)-(\Jnbre),0)}\FPeval\Month{tr<strong>un</strong>c(3+tr<strong>un</strong>c(((\Lnbre)+40)/44,0),0)}\FPeval\Day{tr<strong>un</strong>c((\Lnbre)+28-31*tr<strong>un</strong>c((\Month)/4,0),0)}\ifnum\Month=4\ifnum\Day>25 \FPeval{\Day}{tr<strong>un</strong>c((\Day)-7,0)} \fi\fiP\^aques <strong>le</strong> Dimanche \FPprint\Day/\FPprint\Month/\FPprint\YearPâques tombe <strong>le</strong> dimanche 19/4/1981Vous y reconnaîtrez sans peine l’algorithme initial, j’ai rajouté <strong>le</strong>s trois dernières lignes, car l’auteur desformu<strong>le</strong>s précéd<strong>en</strong>tes semb<strong>le</strong> avoir oublié que Pâques peut varier seu<strong>le</strong>m<strong>en</strong>t <strong>en</strong>tre <strong>le</strong> 22 mars et <strong>le</strong> 25 avril inclusSans cette correction, <strong>le</strong> programme affiche dans l’exemp<strong>le</strong> précéd<strong>en</strong>t (1981), <strong>le</strong> dimanche 26 avril au lieu du19 avril.Pour <strong>le</strong> tester quelques dates :1978 26 mars1979 15 avril1980 6 avril2000 23 avril2002 31 mars2003 20 avrilCe n’est pas garanti sans erreurs, l’emploi des fonctions tr<strong>un</strong>c ou ro<strong>un</strong>d ou clip ne donn<strong>en</strong>t pas à 100%toujours, <strong>le</strong> résultat att<strong>en</strong>du. Par exemp<strong>le</strong> si fp calcu<strong>le</strong> 14.99999999, alors que de toute évid<strong>en</strong>ce c’est 15, ilne vaut mieux pas faire tr<strong>un</strong>c pour avoir la partie <strong>en</strong>tière, mais ro<strong>un</strong>d, car sinon on commet <strong>un</strong>e erreur d’<strong>un</strong>e<strong>un</strong>ité <strong>en</strong> moins ! Il faudrait donc prévoir de tester ces cas !4 Que reste-t-il à faire ? Problèmes !• Placer <strong>le</strong>s jours fériés du l<strong>un</strong>di de Pâques et du l<strong>un</strong>di de P<strong>en</strong>tecôte.• Dessiner automatiquem<strong>en</strong>t <strong>le</strong> mois <strong>en</strong> cours, face à notre regard.• Prévoir <strong>un</strong> test qui limite l’année choisie à l’interval<strong>le</strong> permis, soit [2000 − 2099].• Trouver <strong>un</strong> moy<strong>en</strong> simp<strong>le</strong>, élégant et cohér<strong>en</strong>t d’<strong>en</strong>tourer la date choisie.• Débusquer <strong>le</strong>s erreurs, si vous <strong>en</strong> trouvez. . .