- | Saturday, 2017-05-27T01:07:01-05:00
- Home

[ Originally published in Datafile, Vol 11 No 7/8, December 1992, page 55. ] A Phase-of-the-Moon Program for the 32SII by Craig A. Finseth member# ?? As I was pulling together the information for the HPDATAbase (by the time you see this article, you should already know about *that*), I needed a manual for the 32SII. So I did the obvious thing and called EduCALC and ordered one. When the manual showed up, it turned out to be a copy of the manual for the previous machine, the 32S. Inside was a note from HP saying that they had run out of 32S manuals and, since the machine was no longer in production, they were shipping these copies instead. I called EduCALC and it turned out that their entire stock of 32SII manuals was just like this. Apparantly, someone at HP had gotten confused when shipping their last order. EduCALC, of course, offered me a full refund for the wrong manual. (I decided to keep it as a curiosity.) However, they didn't have any 32SII manuals in stock (as HP had shipped the wrong ones...this all happened in one telephone call). So, the person offered to ship me a 32SII saying that I could just return it after gleaning the information from the manual. The person there clearly knows his market. After receiving the machine and playing with it for a few days, I decided to keep it. So, I now have this machine and want to do something interesting with it. And one thing that I like to see for all machines is the ability to calculate the phase of the moon. This is so that bugs that depend on the phase of the moon can be properly excercised. It would not do to have a bug that is supposed to appear during a full moon show up early in the first quarter. ALGORITHM The algorithm that I use in all of my phase of the moon programs is, of course, wrong (poetic justice.) The actual expression for the phase of the moon has something like 30 sine terms. I use a single-term approximation. This can produce results that vary from the real phase by up to two days. The start date and time (new moon) is 12 Jan 1975 10.21 GMT The length of a cycle is 42532 minutes The algorithm is fractional part ( (now - start) / cycle length ) The resulting fraction is interpreted as new moon 0 first quarter .25 full moon .50 last quarter .75 This same algorithm is used in all versions of my program (for the 41CX, 48SX, and in C for Unix and MSDOS computers). THE 32SII VERSION This was tricky, as the calculator has no clock or date arithmetic and has very little memory. I decided to only use the date and leave the time out of it. For the date arithmetic, which needs the number of days between now and the start date, I used this formula: (y - 1975)*365.2423 + (m - 1)*30.5 + d - 12 which can be rewritten (with a trivial modification) to (y - 1975)*365.2423 + m*30.5 + d - 12 - 31 and, to take advantage of recall arithmetic to save space -( (1975 - y)*365.2423 - m*30.5 - d + 43 ) and the program itself is: M01 LBL M M02 INPUT Y M03 INPUT M M04 INPUT D M05 1,975 M06 RCL- Y M07 365.2422 M08 x M09 30.5 M10 RCLx M M11 - M12 RCL- D M13 43 M14 + M15 +/- M16 29.5361111 displays as 2.95361e1 M17 \:- M18 FP M19 SF 10 M20 ENTER M21 ENTER M22 4 M23 x M24 IP M25 x=0? M26 NM equation M27 1 M28 - M29 x=0? M30 FQ equation M31 1 M32 - M33 x=0? M34 FM equation M35 1 M36 - M37 x=0? M38 LQ equation M39 Rv M40 7.384 M41 x M42 RTN 115.0 bytes, checksum 9B48 The program uses three variables (Y, M, and D) and all of the stack levels. It sets flag 10. EXAMPLE Here is an example of its use: display key in XEQ M Y? 1991 R/S M? 12 R/S D? 18 R/S FQ R/S 2.9569839026 (i.e., not quite 3 days)

Areas

- hp01a (HP-01A)
- hp6s (HP6S)
- hp6ssolar (HP6S Solar)
- hp8s (HP8s)
- hp9g (HP9G)
- hp9s (HP9S)
- hp10a (HP-10A)
- hp10b (HP-10B)
- hp10bii (HP10BII)
- hp10c (HP-10C)
- hp10s (HP10s)
- hp11c (HP-11C)
- hp12bii (HP-12BII)
- hp12c (HP-12C)
- hp12cpa (HP12CPA)
- hp12cpt (HP12CPt)
- hp14b (HP14B)
- hp15c (HP-15C)
- hp16c (HP-16C)
- hp17b (HP-17B)
- hp17bii (HP17BII)
- hp17bii+ (HP17BII+)
- hp18c (HP-18C)
- hp19b (HP-19B)
- hp19bii (HP19BII)
- hp19bii+ (HP19BII+)
- hp19c (HP-19C)
- hp20s (HP-20S)
- hp21a (HP-21A)
- hp21s (HP-21S)
- hp22a (HP-22A)
- hp22s (HP-22S)
- hp25a (HP-25A)
- hp25c (HP-25C)
- hp27a (HP-27A)
- hp27s (HP-27S)
- hp28c (HP-28C)
- hp28s (HP-28S)
- hp29c (HP-29C)
- hp30s (HP30S)
- hp31e (HP-31E)
- hp32e (HP-32E)
- hp32s (HP-32S)
- hp32sii (HP32SII)
- hp33c (HP-33C)
- hp33e (HP-33E)
- hp33s (HP33S)
- hp34c (HP-34C)
- hp35a (HP-35A)
- hp35s (HP35s)
- hp37e (HP-37E)
- hp38c (HP-38C)
- hp38e (HP-38E)
- hp38g (HP38G)
- hp38g (HP38G+)
- hp39g (HP39G)
- hp39g+ (HP39G+)
- hp39gs (HP39GS)
- hp40g (HP40G)
- hp40gs (HP40GS)
- hp40g+ (HP40G+)
- hp41c (HP-41C)
- hp41cv (HP-41CV)
- hp41cx (HP-41CX)
- hp41opt1 (HP-41OPT1)
- hp42s (HP-42S)
- hp45a (HP-45A)
- hp46a (HP-46A)
- hp48g (HP48G)
- hp48gii (HP48GII)
- hp48gx (HP48GX)
- hp48g+ (HP48G+)
- hp48s (HP48S)
- hp48sx (HP48SX)
- hp49g (HP49G)
- hp49g+ (HP49G+)
- hp50g (HP50G)
- hp55a (HP-55A)
- hp56a (HP-56A)
- hp65a (HP-65A)
- hp66a (HP-66A)
- hp67a (HP-67A)
- hp70a (HP-70A)
- hp71b (HP-71B)
- hp75c (HP-75C)
- hp75d (HP-75D)
- hp80a (HP-80A)
- hp81a (HP-81A)
- hp83a (HP-83A)
- hp83f (HP-83F)
- hp85a (HP-85A)
- hp85b (HP-85B)
- hp85f (HP-85F)
- hp86a (HP-86A)
- hp86b (HP-86B)
- hp87a (HP-87A)
- hp87xm (HP-87XM)
- hp91a (HP-91A)
- hp92a (HP-92A)
- hp94d (HP-94D)
- hp94e (HP-94E)
- hp94f (HP-94F)
- hp95c (HP-95C)
- hp95lx (HP95LX)
- hp95lx1mb (HP95LX1MB)
- hp97a (HP-97A)
- hp97s (HP-97S)
- hp100lx (HP100LX)
- hp100lx2mb (HP100LX2MB)

General

- Bibliography and addresses
- HP48S* \-notation
- HP Handheld Users' Conferences
- Date of introduction
- Evolution chart
- Various feature summaries
- Information file overview
- Information summary
- HP Journal articles
- Displaying 7-segment letters
- LIF file formats
- Product numbers llist
- Names and code names
- Math problems
- Jeff Brown's additional Q&A
- RPN introduction
- Serial numbers
- Series summaries
- Solver comparison
- Blank template
- A timeline of the "firsts"
- Timing tests
- HP48SX virus
- "wall of fame."
- Wlodek Mier-Jedrzejowicz articles

Craig's Articles

- Anatomy of an Application
- An ApLet for the 38G
- The Collect-94 Development System (PDF) Datafile, Vol 11 No 3
- The Collect-94 Language (PDF) Datafile, Vol 11 No 5
- Day Number Routines Using Integer Arithmetic
- Freyja - An Emacs for the HP95LX (PDF) Datafile, Vol 11 No1
- Gotos on the HP48SX (PDF) Datafile, Vol 10 No 8
- The HP-94: A Posthumous Review
- The HP-94 Story - Audax Corporation (PDF) Datafile, Vol 11 No 6
- Initial Impressions of the Aurora FN 1000 Financial Manager
- An Inside View of HHUC-95
- Notes on the CHIP Meeting
- Notes on the 1992 HP Handheld User's Conference
- A Phase-of-the-Moon Program for the 32SII
- Some Thoughts on the HP-95LX
- Other Article List

Last modified Saturday, 2012-02-25T17:29:05-06:00.