HP Forums

Full Version: Phase of the Moon
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
The following program calculates the approximate phase of the moon. Calculation is based on the following:

1. A base date of August 11, 1999 is used, which was a New Moon.
2. The phases of the moon cycles approximately 29.530588853 days

The results is a phase indicator from 0 to 1.

If the indicator is close to 0 or 1, we have a New Moon.
If the indicator above 0 but below 0.5, it’s the Waxing Crescent Moon.
If the indicator is about or exactly 0.5, we have a Full Moon.
Finally, for an indicator from 0.5 to 1, it’s the Waning Crescent Moon.

June 23, 2017: the indicator is 0.991190947
June 24, 2017: the indicator is 0.025054136

Values are approximate.

HP Prime Program: MOONPHASE

Input: MOONPHASE(yyyy.mmdd)

// Moon phase
// 0,1: New; 0.5: Full
LOCAL t,p;

Source: “Moon Phase” voidware.
Reference URL's