negative integer division
John Machin
sjmachin at lexicon.net
Thu Feb 10 00:55:32 EST 2005
mjackson at alumni.caltech.edu (Mark Jackson) wrote in message news:<cu91bf$9nk$1 at news.wrc.xerox.com>...
>
> A: 42
>
> Q: What multiple of 7 did I add to the critical expression in the Zeller
> algorithm so it would remain nonnegative for the next few centuries?
What are you calling "the Zeller algorithm", and what is the "critical
expression"?
There _is_ something called "Zeller's congruence":
if m is the month number in an adjusted or computational year (m == 0
=> March, m == 11 => Feb), then the number of days in the adjusted
year before month m is [Python notation] (13*m + 2) // 5 + m * 28
Alternatively (153*m + 2) // 5
I believe that strictly the term "Zeller's congruence" applies only to
the (13*m + 2)//5 part. In any case, all of the above is quite
independent of the year, and there is no possibility of going
negative.
I've no doubt you came across a stuffed-up date-to-days calculation
routine and fixed it, but it's a bit unfair to lumber Zeller with the
blame. If it was a days-to-date routine, then Zeller is not even
standing next to the real target.
Cheers,
John
More information about the Python-list
mailing list