[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: arithmetic issues



 | From: Taylor Campbell <campbell@xxxxxxxxxx>
 | 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!