All --
> As I understand it, computer languages differ in their implementation
> of the mod() function. I've heard some architectures differ, too, so
> that the same language (such as C or Perl) might behave differently on
> different machines (I'd be interested to know if this is really true).
Besides the Calendrical Calculations reference I originally sited,
here's another reference to troubles with mod, from [1], page 23:
Commercial machines are usually deficient in their support of
integer arithmetic. For example, they almost never produce the
true quotient floor(x/y) and true remainder x mod y when x is
negative or y is negative; ...
You can find [1] online at:
http://www-cs-faculty.stanford.edu/~knuth/fasc1.ps.gz
I'd definitely suggest anyone who has not already read it get it and
read it. See especially the answer to exercise 2 of section 1.3.1' :)
Knuth's stuff on the MMIX simulator is very good as well (but, heck,
*everything* he writes is very good).
References:
[1] Donald E. Knuth, *The Art of Computer Programming Fascicle 1:
MMIX*. Addison-Wesley, 1999.
Regards,
-- Gregor
_____________________________________________________________________
/ perl -e 'srand(-2091643526); print chr rand 90 for (0..4)' \
Gregor N. Purdy [EMAIL PROTECTED]
Focus Research, Inc. http://www.focusresearch.com/
8080 Beckett Center Drive #203 513-860-3570 vox
West Chester, OH 45069 513-860-3579 fax
\_____________________________________________________________________/