File r37/lisp/csl/html/r37_0104.html artifact d276c0057f part of check-in 3c4d7b69af



<A NAME=SETMOD>

<TITLE>SETMOD</TITLE></A>
<b><a href=r37_idx.html>INDEX</a></b><p><p>



<B>SETMOD</B> _ _ _  _ _ _  _ _ _  _ _ _ <B>command</B><P>
<P>
 
 <P>
<P>
The <em>setmod</em> command sets the modulus value for subsequent 
<A HREF=r37_0305.html>modular</A> 
arithmetic. 
 <P> <H3> 
syntax: </H3>
<P>
<P>
<em>setmod</em>&lt;integer&gt; 
<P>
<P>
<P>
&lt;integer&gt; must be positive, and greater than 1. It need not be a prime 
number. 
<P>
<P>
 <P> <H3> 
examples: </H3>
<P><PRE><TT>
setmod 6; 

  1 


on modular; 

16; 

  4 


x^2 + 5x + 7; 

   2
  X  + 5*X + 1 


x/3; 

  X
  - 
  3


setmod 2; 

  6 


(x+1)^4; 

   4
  X  + 1 


x/3; 

  X

</TT></PRE><P><em>setmod</em>returns the previous modulus, or 1 if none has been
 set 
before. <em>setmod</em> only has effect when 
<A HREF=r37_0305.html>modular</A> is on. 
<P>
<P>
Modular operations are done only on numbers such as coefficients of 
polynomials, not on the exponents. The modulus need not be prime. 
Attempts to divide by a power of the modulus produces an error message, since th
e 
operation is equivalent to dividing by 0. However, dividing by a factor 
of a non-prime modulus does not produce an error message. 
<P>
<P>
<P>


REDUCE Historical
REDUCE Sourceforge Project | Historical SVN Repository | GitHub Mirror | SourceHut Mirror | NotABug Mirror | Chisel Mirror | Chisel RSS ]