[comp.sources.d] ephem 4.8 bug

ecd@ncs-med.UUCP (Elwood C. Downey) (12/01/89)

I've long since learned not to put pointers into ints, but here is another
way the size of an int can go unnoticed.

While compiling ephem v4.8 on an IBM-PC lately I discovered that 
the places in ephem where I use a cast to (int) do perform a
modulus operation with a double fail on machines with 16 bit ints with
floating values greater than 32767. In particular, it turns
out that the "modified Julian date" used within ephem passes this
majic value in October, 1989! The symptom is that calendars from Oct
on are incorrect.

The fix is to change the cast to (int) to a (long) in cal_mjd.c, line 100.
More subtle is a few other places where this is also necessary, such
as the (int) casts in anomaly.c and nutation.c (the other casts to (int)
in other files should be ok since the arguements should not approach
the nasty limit).

Sorry about that...

Elwood
umn-cs!ncs-med!ecd