Integer division and remainder
Robert Amesz
reqhye72zux at mailexpire.com
Sat Aug 18 20:39:39 EDT 2001
Mark Jackson wrote:
> Robert Amesz <reqhye72zux at mailexpire.com> writes:
>
>> [Zeller's congruence and the mod-function]
>>
>> On Python the problem wouldn't have occurred, its mod-function is
>> mathematically correct.
>
> Yes! That was the very problem with the old to-do list
> manager xvtdl, which I fixed back in early 2000; find the code at
> http://www.alumni.caltech.edu/~mjackson/xvtdl.html. While
> diagnosing this behavior I implemented the algorithm in Python for
> test purposes, and was led astray for a while by the fact that it
> *didn't* fail!
I personally call that "Murphy's Law of Debugging": just as you need
things to go wrong, they will go inexplicably right. [*]
> Q: What multiple of 7 did I add to the critical expression in the
> Zeller algorithm so it will remain nonnegative for the next few
> centuries?
>
> A: 42
LOL, yes, that should do the trick. And Douglas Adams recently died at
the age of 49, the next multiple of 7...
Robert Amesz
--
[*] Which is really just 'straight' Murphy except that in this case
right is wrong and wrong is right. If that sounds like the witches from
MacBeth, well, sometimes debugging is a lot like black magic.
More information about the Python-list
mailing list