(Comp.sys.hp48) Item: 2488 by jdg@hpqtdla.sqf.hp.com [James Gentles] Subj: Calculating Easter Date: 22 Dec 1992 There follows a HP48 routine to compute Easter. It accepts either the year or the date in current format. Internally the routine uses European format, dd.mmyyyy, and then at the end checks current format with flag -42, and changes accordingly using a small routine to swap day and month D<-->M (Sorry, I haven't included this small routine, its not a big deal) [I took the liberty of modifying the end of the program to make it work no matter which date format you use. Unfortunately, this "fix" only allows dates between 1989 and 2088. If you need dates outside this range, change the code back to James' original as listed below. -jkh-] The output is the date of Easter in current date format on the stack. James ------------------cut here estr ------------------------------------------ %%HP: T(3)A(D)F(.); \<< IF DUP 100 > THEN 1000000 / END .01 MOD DUP 1000000 * DUP 19 MOD 19 * 24 + 30 MOD DUP 6 * ROT DUP 4 MOD 2 * SWAP 7 MOD 4 * + + 5 + 7 MOD OVER + \-> d m \<< IF m 9 \<= THEN 22 m + .03 + ELSE m 9 - 'm' STO IF m 26 == THEN 19.04 ELSE IF m 25 == d 28 == AND THEN 18.04 ELSE m .04 + END END END + IF -42 FC? @ changed these \ DATE RCLF ROT -42 THEN D\<-\->M @ lines to this: > SF \->DATE STOF END @ -jkh- / DATE SWAP \->DATE \>> \>> ------------------cut here estr ------------------------------------------ I have no professional connection with Hewlett-Packard's calculator operations other than as a user of their products. ------------------------------------------------------------------------ Opinions expressed are my own, and are not intended to be an official statement by Hewlett-Packard Company/Limited ------------------------------------------------------------------------ "To strive, to seek, to find, and not to yield." Ulysses, Tennyson. ------------------------------------------------------------------------ James Gentles Hewlett Packard, Amateur: GM4WZP Queensferry Telecoms Division QTD, Email: jdg@hpsqf.sqf.hp.com Station Road, South Queensferry, HPDESK: James Gentles / HP1400 West Lothian, Scotland, EH30 9XR. Phone: +44 31 331 7663, FAX: ~7488 ------------------------------------------------------------------------