tag:blogger.com,1999:blog-4757118446768919900.post4835397305347739608..comments2020-05-27T04:06:07.897-07:00Comments on Retro Programming: Computus: Calculating Easter SundayJohn Metcalfhttp://www.blogger.com/profile/09108374348083307900noreply@blogger.comBlogger5125tag:blogger.com,1999:blog-4757118446768919900.post-2284897405836737852011-05-03T20:16:16.916-07:002011-05-03T20:16:16.916-07:00Greetings! for posting such a useful blog. Your we...Greetings! for posting such a useful blog. Your weblog is not only informative and also very artistic too. There usually are extremely couple of people who can write not so easy articles that creatively. Keep up the good work !ppc agencyhttp://www.mediamax.com.au/search-engine-marketing/paid-search.htmlnoreply@blogger.comtag:blogger.com,1999:blog-4757118446768919900.post-49427442454335154752011-04-24T05:06:50.774-07:002011-04-24T05:06:50.774-07:00I coded this algorithm years ago in C (1986). I ca...I coded this algorithm years ago in C (1986). I can't remember where I got it but I whereever I got it, it was referred to as 'Butcher's Method'.<br /><br />Here is my original code: Note that this uses another function to convert the y/m/d to a Julian day number.<br /><br />/** Calculates Easter Sunday for given year.<br /> *<br /> * @return Julian day number for Easter Sunday.<br /> *<br /> * @Param year : Year number.<br /> *<br /> * @note I know this works for 1980 on, I can't guarantee before<br /> * this date. The algorithm I'm using is called Butchers<br /> * method (I think).<br /> */<br />INT32 TEaster( INT32 year)<br />{<br /> TDATE date;<br /> INT32 m,n,x,a,b,c,d,e,f,g,h,i,j,k,l,t;<br /><br /> x = year;<br /> a = x/100;<br /> b = x%100;<br /> c = a>>2;<br /> d = (a-15)/25;<br /> e = (a-d)/3;<br /> f = (a+15-c-e)%30;<br /> g = (a+4-c)%7;<br /> h = x%19;<br /> i = b&3;<br /> j = b%7;<br /> k = ((h*19)+f)%30;<br /> l = (14+a+g+(i<<1)+(j*4)-k)%7;<br /> t = (21+k+l);<br /> m = t/31+2;<br /> n = t%31+1;<br /> if (n==26 && m==3) n = 19;<br /> if (n==25 && m==3 && k==28 && h>10) n = 18; <br /><br /> date.Year = year;<br /> date.Month = (INT16) m+1;<br /> date.Day = (INT16) n;<br /><br /> return TNumDays( &date);<br />}<br /><br />Tim...Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-4757118446768919900.post-40719181726403818582011-04-23T22:12:31.568-07:002011-04-23T22:12:31.568-07:00I think you did a pretty good job of making it pre...I think you did a pretty good job of making it pretty in C. I think the only thing you could to to improve readability would split some of those up onto multiple lines but that would be wasteful. Good job all around.SergeDavidhttp://www.blog.knolif.com/noreply@blogger.comtag:blogger.com,1999:blog-4757118446768919900.post-10155057832549730802011-04-23T09:25:43.375-07:002011-04-23T09:25:43.375-07:00Anonymous, here's a quick explanation of the v...Anonymous, here's a quick explanation of the variables:<br /><br />gold - the golden number - 1<br />cent - century - 1<br />sa - solar cycle adjust<br />la - lunar cycle adjust<br />epact - epact moon age<br />a18 - April 18th correction<br />da - day of week adjustJohn | Retro Programminghttp://retroprogramming.comnoreply@blogger.comtag:blogger.com,1999:blog-4757118446768919900.post-59651271473126818262011-04-23T05:54:35.272-07:002011-04-23T05:54:35.272-07:00What? It's a small function with no loops of c...What? It's a small function with no loops of conditionals. The function simply flows from beginning to end. Aside from poorly chosen variable names, this is quite elegant and beautiful.Anonymousnoreply@blogger.com