Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!seismo!gatech!bloom-beacon!think!ames!sdcsvax!ucsdhub!jack!man!crash!adamsd From: adamsd@crash.CTS.COM (Adams Douglas) Newsgroups: comp.sys.hp Subject: Assorted HP-28C routines. Message-ID: <1414@crash.CTS.COM> Date: Mon, 20-Jul-87 12:38:25 EDT Article-I.D.: crash.1414 Posted: Mon Jul 20 12:38:25 1987 Date-Received: Wed, 22-Jul-87 01:03:12 EDT Reply-To: adamsd@crash.CTS.COM (Adams Douglas) Distribution: world Organization: Deep Space Network--JPL/NASA Lines: 87 On the practical side, here are a few of the HP-28C programs I have created so far. These are expressed in the same format as the 28C reference manual: State Tax Computation Takes a dollar amount in the stack and returns that amount plus tax. TAX amount -> amount+tax << 2 FIX DUP 6.5 % + RND STD >> Substitute your appropriate state's tax for the 6.5 __________________________ Percent memory remaining Returns the output of MEM as a percent of total ram. M% -> %memory << 2048 MEM %T >> __________________________ Julian Day Number Takes a date in the stack in the form mm.ddyyyy and returns the Julian Day Number. Automatically adjusts for the Gregorian/Julian transition. No BC dates are allowed. Based on Roger Hill's CJ routine for the HP 41-C. JDN date -> jdn << IP LAST FP 100 * IP LAST FP 1E4 * 3 ROLL 2.85 - 12 / + -> d y << y DUP 367 * IP SWAP IP - y IP .75 * - d + IP IF DUP 578047 > THEN y 100 / IP ELSE 2 END .75 * - IP 1721115 + >> >> __________________________ Delta Dates Computes the number of days between two dates. Requires JDN. DDAT date1 date2 -> ddays << JDN SWAP JDN - >> __________________________ Julian Day Number Plus Time Takes a date and time of day in the stack and returns a non- integer Julian Day Number. Requires JDN. Expects time in HH.MMSS format. JDNT date time -> jdn.ddddd << HMS-> 24 / SWAP JDN + >> __________________________ Delta Time Takes two date/time pairs in the stack and returns the difference in hours (HH.MMSS format). Requires JDNT. DTIM date1 time1 date2 time2 -> hours << JDNT 3 ROLLD JDNT - 24 * ->HMS 4 FIX RND STD >> __________________________ Hope y'all find this useful -- ======================================================= Adams Douglas ARPA:crash!adamsd@nosc.arpa AT&T:818-354-3654DSN/JPL/NASA UUCP:{akgua | hplabs!hp-sdd | sdcsvax | nosc}!crash!adamsd or adamsd@crash.CTS.COM My opinions! Do you hear? MINE! Not JPL's. "Do not be angry with me if I tell you the truth." -- Socrates "Tell the Truth and run."--Yugoslav proverb