[net.sources.bugs] phase of the moon

aeb@mcvax.UUCP (Andries Brouwer) (05/23/85)

In article <12100002@mirror.UUCP> rs@mirror.UUCP writes:
>
>The recent posting by Robert Bond with the sunrise/sunset
>programs led me to dig out this old chestnut that had been
>floating around MIT for a while.  It /seems/ correct to
>me, but I ain't no "loup-garou" :-)

My werewolf instinct tells me that after
	long Length, Delta, Phase;
	double Fraction;

	Length = ...;
	Delta = ...;
	Phase = Delta % Length;
	Fraction = Phase / Length;
one will have
	Fraction == 0.0
which surely was not what the author intended.

It also wonders what happened with leap years in the line
	offset	= ((year * 365L + julianday) * 24L + hour) * 60L + minute;

rs@mirror.UUCP (05/28/85)

Oops.  In my "POM" (Phase Of the Moon) program I left off a
cast.  The line:
    Fraction	= Phase / Length;
should read:
    Fraction	= (double)Phase / (double)Length;

Thanks to mcvax!aeb.