Hey Peter,
Yeah, BASIC seems to know standard arithmetic precedence. And now that
I think about it, I guess I really didn't need to read in ALL of the
months to M$ array ... I don't recall ever celebrating Easter in December :)
Ken
On 8/30/21 4:52 PM, Peter Noeth wrote:
Thanks Ken for the update. In looking at this I was at first a little
concerned about the arithmetic precedence on lines 70 to 85, as there
were not a lot of parentheses to force desired action, but it works !!
Good to have in the 'ole toolbox.
Regards,
Peter
On 8/29/21 09:30 PM, Ken Pettit wrote:
Hey Guys,
Well, the email I sent *wasn't* really a BASIC program but rather
a math
formula. The M100 BASIC doesn't have a function called "Floor"
... it
is called "INT". But also I noticed the reference on Wikipedia
that I
was looking at was for Eastern Orthodox Easter date, not modern day
Gregorian.
The formula for modern day Gregorian is actually much more
compilicated
involving 11 intermediate variables. While writing this equation out
long-hand using only the year variable (Y) would look super
impressive,
it would be quite long and not very efficient in terms of
computations.
So for completeness (being the programmer that I am), I coded and
tested
it in M100 BASIC:
10 DIMM$[12]
15 DATA
"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"
20 FORX=1TO12:READM$[X]:NEXT
25 INPUT"Year (0 to quit)";Y
30 IFY=0THENEND
35 A=YMOD19
40 B=INT(Y/100):C=YMOD100
45 D=INT(B/4) :E=BMOD4
50 G=INT((8*B+13)/25)
55 H=(19*A+B-D-G+15)MOD30
60 I=INT(C/4) :K=CMOD4
70 L=(32+2*E+2*I-H-K)MOD7
75 M=INT((A+11*H+19*L)/433)
80 N=INT((H+L-7*M+90)/25)
85 P=(H+L-7*M+33*N+19)MOD32
90 PRINT "Easter day: ";M$[N];P
95 GOTO25
Ken