adamsd@crash.CTS.COM (Adams Douglas) (07/20/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-3654 <work> DSN/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