Link to home
Start Free TrialLog in
Avatar of midnightexpress
midnightexpressFlag for United States of America

asked on

Moonphase calculation

To all Wizards...

 I am looking for simple "C" source code for the MoonPhase calculation - going from (in the following order):
  That goes from a (1)new moon > to a (2)new right qtr moon
   > to a (3)new right half moon, > then to a new (4)3/4 qtr
     moon,  > then to a (5)new full moon,  
    then... to a (6)left 3/4 moon, >
    then to a (7)left 1/2 moon, > then to a (8)left qtr moon.  Then it starts over at a new moon.  after the calculations are doing, the function returns a number (1 thru 8), as indicated by the (#).  Return a zero 0 for an error.

 So there you go, can you handle it.  I will make it worth your while points-wise.
Avatar of Kent Olsen
Kent Olsen
Flag of United States of America image

Ok.   I doubt that this is homework, so....

Source code here:

<Link deleted by sunnycoder, Page Editor>


Kent
midnightexpress,

May we know why you need such source code. I have a suspicion that this could be a coursework assignment.

sunnycoder
Avatar of grg99
grg99

Here's a good hint:  the Moon goes through its phases in a cycle that takes something like 27.33 days (look this up to be sure) .  If you know the date of just ONE full moon,  and the number of days since then, it's a simple matter of mod arithmetic and a division to find the phase.

Or look in Knuth Volume 1.  One of the early homework problems is to calculate the date of Easter, which involves finding the phase of the Moon.


Avatar of midnightexpress

ASKER

As requested by KDO and SUNNYCODER, here goes:

This is not a homework assignment. This project, that I have been working on, has been going on for the past couple of years.  The project consists of a Windows DLL File that contains many simple "C" routines that deals with dates.  Routines that deals with date conversions from one date format to another date format,  date math, date approximation, calculating easter, daylight savings time, MRP dates, date validation,  date lapse, holidays, retrieving date info(whether in a micro or marco views), and so forth.  As for education and my present occupation?-> I work for the USPS in a craft position and have long since graduated from college with a B.S. degree many many years ago.  And have enjoyed working on this project.  I hope this few sentences have answered your questions. Does this mean more points are required for your help??

  Thanks(TIA),
  Midnighexpress
  Mar 10th, 2005
  RSVP...
 
ASKER CERTIFIED SOLUTION
Avatar of Kent Olsen
Kent Olsen
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial