Email list hosting service & mailing list manager


Re: arithmetic issues Aubrey Jaffer 29 Oct 2005 21:21 UTC

 | From: Taylor Campbell <xxxxxx@mumble.net>
 | Date: Fri, 21 Oct 2005 20:24:55 +0000 (UTC)
 |
 | ...  A convenient syntax might be added on top of this, such as:
 |
 |   (with-modular-arithmetic 32 (+ arithmetic-shift)
 |     (+ 1 (bitwise-not (arithmetic-shift -1 32))))
 |     => 0
 |
 | (The first operand specifies the modulus; the second, a list of
 | names to be bound to appropriate arithmetic operations.  I'm not
 | entirely sure whether this is the right kind of syntax, but it is
 | one possibility.)

Be careful.  When dealing with polynomials, the coefficient arithmetic
must be independent of the exponent arithmetic.  At least one computer
algebra system truncated their polynomials when the coefficients were
computed in modular arithmetic!