Easter Algorithm Bug
05-11-2017, 08:33 PM
Post: #2
 Didier Lachieze Senior Member Posts: 1,641 Joined: Dec 2013
RE: Easter Algorithm Bug
Hello, with MOD you need parentheses.
This version of your code seems to work well :
Code:
EXPORT easter(T) BEGIN   // Year (1583-9999)   LOCAL A,B,C,D,E,K,M,N;   LOCAL P,Q;   IF T<1583 OR T>9999 THEN     RETURN "Error - Year is invalid.";   ELSE     K:=IP(T/100);     A:=T MOD 19;     B:=T MOD 4;     C:=T MOD 7;     Q:=IP(K/4);     P:=IP((8*K+13)/25);     M:=(15-P+K-Q) MOD 30;     D:=(19*A+M) MOD 30;     N:=(4+K-Q) MOD 7;     E:=(2*B+4*C+6*D+N) MOD 7;     IF D+E<=9 THEN       D:=22+D+E;       M:=3;     ELSE       IF D==19 AND E==6 THEN         D:=19;         M:=4;       ELSE         IF D==28 AND E==6 AND A>10 THEN           D:=18;           M:=4;         ELSE           D:=D+E-9;           M:=4;         END;       END;     END;     IF M==3 THEN       RETURN "March "+D;     ELSE       RETURN "April "+D;     END;   END; END;
 « Next Oldest | Next Newest »

 Messages In This Thread Easter Algorithm Bug - codycbradio - 05-11-2017, 06:53 PM RE: Easter Algorithm Bug - Didier Lachieze - 05-11-2017 08:33 PM

User(s) browsing this thread: 1 Guest(s)