Changeset c860e9 in git


Ignore:
Timestamp:
Aug 23, 1999, 3:15:59 PM (24 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'spielwiese', '0d6b7fcd9813a1ca1ed4220cfa2b104b97a0a003')
Children:
36861edf6c7025f84372f1a254aefc05bb636749
Parents:
99a286c05af3b60f04f2443ada520b679a44e7a3
Message:
* hannes: introduced EXPONENT_MAX in polys-impl.h
          fixed exponent overflow in pPower
* GMG: fixes in general.lib


git-svn-id: file:///usr/local/Singular/svn/trunk@3528 2c84dea3-7e68-4137-9b89-c4e89433aadc
Location:
Singular
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • Singular/LIB/general.lib

    r99a286 rc860e9  
    1 // $Id: general.lib,v 1.16 1999-07-09 14:06:52 obachman Exp $
     1// $Id: general.lib,v 1.17 1999-08-23 13:15:59 Singular Exp $
    22//system("random",787422842);
    33//GMG, last modified 18.6.99
    44///////////////////////////////////////////////////////////////////////////////
    55
    6 version="$Id: general.lib,v 1.16 1999-07-09 14:06:52 obachman Exp $";
     6version="$Id: general.lib,v 1.17 1999-08-23 13:15:59 Singular Exp $";
    77info="
    88LIBRARY:  general.lib   PROCEDURES OF GENERAL TYPE
     
    9090          ASCII():    string of  all ASCII characters with its numbers,
    9191                      no return value
    92           ASCII(n):   string, n-th ASCII charakter
     92          ASCII(n):   string, n-th ASCII character
    9393          ASCII(n,m): list, n-th up to m-th ASCII character (inclusive)
    9494EXAMPLE: example ASCII; shows an example
     
    9696{
    9797  string s1 =
    98  "     !    \"    #    $    %    &    '    (    )    *    +    ,    -    .
     98 "     !    \"    #    $       &    '    (    )    *    +    ,    -    .
    999932   33   34   35   36   37   38   39   40   41   42   43   44   45   46
    100 
    101100/    0    1    2    3    4    5    6    7    8    9    :    ;    <    =
    10210147   48   49   50   51   52   53   54   55   56   57   58   59   60   61
    103 
    104102>    ?    @    A    B    C    D    E    F    G    H    I    J    K    L
    10510362   63   64   65   66   67   68   69   70   71   72   73   74   75   76
    106 
    107104M    N    O    P    Q    R    S    T    U    V    W    X    Y    Z    [
    10810577   78   79   80   81   82   83   84   85   86   87   88   89   90   91
    109 
    110106\\    ]    ^    _    `    a    b    c    d    e    f    g    h    i    j
    11110792   93   94   95   96   97   98   99  100  101  102  103  104  105  10
    112 
    113108k    l    m    n    o    p    q    r    s    t    u    v    w    x    y
    114109107  108  109  110  111  112  113  114  115  116  117  118  119  120  121
    115 
    116110z    {    |    }    ~
    117111122  123  124  125  126 ";
     
    141135///////////////////////////////////////////////////////////////////////////////
    142136
    143 proc binomial (def n, int k, list #)
     137proc binomial (int n, int k, list #)
    144138"USAGE:   binomial(n,k[,p]); n,k,p integers
    145139RETURN:  binomial(n,k); binomial coefficient n choose k,
    146          of type number if n is of type number (computed in char(basering)),
    147          of type int if n is of type int (machine integer, limited size!)
    148          binomial(n,k,p);  n choose k in char p, of type string
     140         - of type string (computed in characteristic 0)
     141         binomial(n,k,p); n choose k, computed in characteristic prime(p)
     142         - of type number if a basering is present and prime(p)=char(basering)
     143         - of type string else
     144NOTE:    In any characteristic, binomial(n,k) = coefficient of x^k in (1+x)^n
    149145EXAMPLE: example binomial; shows an example
    150146"
    151147{
    152    if ( size(#)==0 )
    153    {
    154       if ( typeof(n)=="number" ) { number rr=1; }
    155       else { int rr=1; }
    156    }
    157    if ( typeof(#[1])=="int") { ring bin = #[1],x,dp; number rr=1; }
    158    if ( size(#)==0 or typeof(#[1])=="int" )
    159    {
    160       def r = rr;
    161       if ( k<=0 or k>n ) { return((k==0)*r); }
    162       if ( k>n-k ) { k = n-k; }
    163       int l;
    164       for (l=1; l<=k; l=l+1 )
    165       {
    166          r=r*(n+1-l)/l;
    167       }
    168       if ( typeof(#[1])=="int" ) { return(string(r)); }
    169       return(r);
    170    }
    171 }
     148   int str,p;
     149//---------------------------- initialization -------------------------------
     150   if ( size(#) == 0 )
     151   {  str = 1;
     152      ring bin = 0,x,dp;
     153      number r=1;
     154   }
     155   if ( size(#) > 0 )
     156   {
     157      p = (#[1]!=0)*prime(#[1]);
     158      if ( defined(basering) )
     159      {
     160         if ( p == char(basering) )
     161         {  number r=1;
     162         }
     163         else
     164         {  str = 1;
     165            ring bin = p,x,dp;
     166            number r=1;
     167         }
     168      }
     169      else
     170      {  str = 1;
     171         ring bin = p,x,dp;
     172         number r=1;
     173      }
     174   }
     175//-------------------------------- char 0 -----------------------------------
     176   if ( p==0 )
     177   {
     178      r = binom0(n,k);
     179   }
     180//-------------------------------- char p -----------------------------------
     181   else
     182   {
     183      r = binomp(n,k,p);
     184   }
     185//-------------------------------- return -----------------------------------
     186   if ( str==1 ) { return(string(r)); }
     187   else { return(r); }
     188 }
    172189example
    173190{ "EXAMPLE:"; echo = 2;
    174    int b1 = binomial(10,7); b1;
    175    binomial(137,17,0);
    176    ring t = 0,x,dp;
    177    number b2 = binomial(number(137),17); b2;
    178 }
    179 ///////////////////////////////////////////////////////////////////////////////
    180 
    181 proc factorial (def n)
    182 "USAGE:   factorial(n);  n = integer
    183 RETURN:  factorial(n); n! in char 0, of type string if n is of type int
    184          n! of type number, computed in char(basering) if n is of type number
     191   binomial(200,100);"";                   //type string, computed in char 0
     192   binomial(200,100,3);"";                 //type string, computed in char 3
     193   int n,k = 200,100;
     194   ring r = 0,x,dp;
     195   number b1 = binomial(n,k,0);            //type number, computed in ring r
     196   poly b2 = coeffs((x+1)^n,x)[k+1,1];     //coefficient of x^k in (x+1)^n
     197   b1-b2;                                  //b1 and b2 should coincide
     198}
     199///////////////////////////////////////////////////////////////////////////////
     200
     201static proc binom0 (int n, int k)
     202 //computes binomial coefficient n choose k in basering, assume 0<k<=n
     203 //and char(basering) = 0 or n < char(basering)
     204{
     205   int l;
     206   number r=1;
     207   if ( k > n-k )
     208   { k = n-k;
     209   }
     210   if ( k<=0 or k>n )               //trivial cases
     211   { r = (k==0)*r;
     212   }
     213   for (l=1; l<=k; l++ )
     214   {
     215      r=r*(n+1-l)/l;
     216   }
     217   return(r);
     218}
     219///////////////////////////////////////////////////////////////////////////////
     220
     221static proc binomp (int n, int k, int p)
     222 //computes binomial coefficient n choose k in basering of char p > 0
     223 //binomial(n,k) = coefficient of x^k in (1+x)^n.
     224 //Let n=q*p^j, gcd(q,p)=1, then (1+x)^n = (1 + x^(p^j))^q. We have
     225 //binomial(n,k)=0 if k!=l*p^j and binomial(n,l*p^j) = binomial(q,l).
     226 //Do this reduction first. Then, in denominator and numerator
     227 //of defining formula for binomial coefficient, reduce those factors
     228 //mod p which are not divisible by p and cancel common factors p. Hence,
     229 //if n = h*p+r, k=l*p+s, r,s<p, binomial(n,k) = binomial(r,s)*binomial(h,l)
     230{
     231   int l,q,i= 1,n,1;
     232   number r=1;
     233   if ( k > n-k )
     234   { k = n-k;
     235   }
     236   if ( k<=0 or k>n)               //trivial cases
     237   { r = (k==0)*r;
     238   }
     239   else
     240   {
     241      while ( q mod p == 0 )
     242      {  l = l*p;
     243         q = q div p;
     244      }                            //we have now n=q*l, l=p^j, gcd(q,p)=1;
     245      if (k mod l != 0 )
     246      { r = 0;
     247      }
     248      else
     249      {  l = k div l;
     250         n = q mod p;
     251         k = l mod p;              //now 0<= k,n <p, use binom0 for n,k
     252         q = q div p;              //recursion for q,l
     253         l = l div p;              //use binomp for q,l
     254         r = binom0(n,k)*binomp(q,l,p);
     255      }
     256   }
     257   return(r);
     258}
     259///////////////////////////////////////////////////////////////////////////////
     260
     261proc factorial (int n, list #)
     262"USAGE:   factorial(n[,p]);  n,p integers
     263RETURN:  factorial(n):   n! (computed in characteristic 0), of type string
     264         factorial(n,p): n! computed in characteristic prime(p)
     265         - of type number if a basering is present and prime(p)=char(basering)
     266         - of type string else
    185267EXAMPLE: example factorial; shows an example
    186268"
    187 {
    188    int t,l;
    189    if ( typeof(n)=="number" ) { number r=1; }
    190    else { ring R = 0,x,dp; number r=1; t=1; }
    191    for (l=2; l<=n; l=l+1)
     269{   int str,l,p;
     270//---------------------------- initialization -------------------------------
     271   if ( size(#) == 0 )
     272   {  str = 1;
     273      ring bin = 0,x,dp;
     274      number r=1;
     275   }
     276   if ( size(#) > 0 )
     277   {
     278      p = (#[1]!=0)*prime(#[1]);
     279      if ( defined(basering) )
     280      {
     281         if ( p == char(basering) )
     282         {  number r=1;
     283         }
     284         else
     285         {  str = 1;
     286            ring bin = p,x,dp;
     287            number r=1;
     288         }
     289      }
     290      else
     291      {  str = 1;
     292         ring bin = p,x,dp;
     293         number r=1;
     294      }
     295   }
     296//------------------------------ computation --------------------------------
     297   for (l=2; l<=n; l++)
    192298   {
    193299      r=r*l;
    194300   }
    195    if ( t==1 ) { return(string(r)); }
    196    return(r);
     301   if ( str==1 ) { return(string(r)); }
     302   else { return(r); }
    197303}
    198304example
    199305{ "EXAMPLE:"; echo = 2;
    200    factorial(37);
    201    ring r1 = 32003,(x,y,z),ds;
    202    number p = factorial(number(37)); p;
    203 }
    204 ///////////////////////////////////////////////////////////////////////////////
    205 
    206 proc fibonacci (def n)
    207 "USAGE:   fibonacci(n);  (n integer)
    208 RETURN:  fibonacci(n); nth Fibonacci number,
    209             f(0)=f(1)=1, f(i+1)=f(i-1)+f(i)
    210          of type string if n is of type int
     306   factorial(37);"";                   //37! of type string (as long integer)
     307   ring r1 = 0,x,dp;
     308   number p = factorial(37,0);         //37! of type number, computed in r
     309   p;
     310}
     311///////////////////////////////////////////////////////////////////////////////
     312
     313proc fibonacci (int n, list #)
     314"USAGE:   fibonacci(n);  n,p integers
     315RETURN:  fibonacci(n): nth Fibonacci number, f(0)=f(1)=1, f(i+1)=f(i-1)+f(i)
     316         - computed in characteristic 0, of type string
    211317         of type number computed in char(basering) if n is of type number
     318         fibonacci(n,p): f(n) computed in characteristic prime(p)
     319         - of type number if a basering is present and prime(p)=char(basering)
     320         - of type string else
    212321EXAMPLE: example fibonacci; shows an example
    213322"
    214 {
    215    int ii,t;
    216    if ( typeof(n)=="number" ) { number f,g,h=1,1,1; }
    217    else { ring fibo = 0,x,dp; number f,g,h=1,1,1; t=1; }
     323{   int str,ii,p;
     324//---------------------------- initialization -------------------------------
     325   if ( size(#) == 0 )
     326   {  str = 1;
     327      ring bin = 0,x,dp;
     328      number f,g,h=1,1,1;
     329   }
     330   if ( size(#) > 0 )
     331   {
     332      p = (#[1]!=0)*prime(#[1]);
     333      if ( defined(basering) )
     334      {
     335         if ( p == char(basering) )
     336         {  number f,g,h=1,1,1;
     337         }
     338         else
     339         {  str = 1;
     340            ring bin = p,x,dp;
     341            number f,g,h=1,1,1;
     342         }
     343      }
     344      else
     345      {  str = 1;
     346         ring bin = p,x,dp;
     347         number f,g,h=1,1,1;
     348      }
     349   }
     350//------------------------------ computation --------------------------------
    218351   for (ii=3; ii<=n; ii=ii+1)
    219352   {
    220353      h = f+g; f = g; g = h;
    221354    }
    222    if ( t==1 ) { return(string(h)); }
    223    return(h);
     355   if ( str==1 ) { return(string(h)); }
     356   else { return(h); }
    224357}
    225358example
    226359{ "EXAMPLE:"; echo = 2;
    227    fibonacci(37);
     360   fibonacci(333); "";              //f(333) of type string (as long integer)
    228361   ring r = 17,x,dp;
    229    number b = fibonacci(number(37)); b;
     362   number b = fibonacci(333,17);    //f(333) of type number, computed in r
     363   b;
    230364}
    231365///////////////////////////////////////////////////////////////////////////////
     
    276410         killall(\"not\", \"type_name\");
    277411COMPUTE: killall(); kills all user-defined variables but not loaded procedures
    278          killall(\"type_name\"); kills all user-defined variables, of type \"type_name\"
    279          killall(\"not\", \"type_name\"); kills all user-defined
    280          variables, except those of type \"type_name\" and except loaded procedures
     412         killall(\"type_name\"); kills all user-defined variables,
     413         of type \"type_name\"
     414         killall(\"not\", \"type_name\"); kills all user-defined variables,
     415         except those of type \"type_name\" and except loaded procedures
    281416RETURN:  no return value
    282417NOTE:    killall should never be used inside a procedure
     
    324459example
    325460{ "EXAMPLE:"; echo = 2;
    326    ring rtest; ideal i=x,y,z; number n=37; string str="hi"; int j = 3;
    327    export rtest,i,n,str,j;     //this makes the local variables global
    328    listvar(all);
    329    killall("string"); // kills all string variables
    330    listvar(all);
    331    killall("not", "int"); // kills all variables except int's (and procs)
    332    listvar(all);
    333    killall(); // kills all vars except loaded procs
    334    listvar(all);
     461   ring rtest; ideal i=x,y,z; string str="hi"; int j = 3;
     462   export rtest,i,str,j;       //this makes the local variables global
     463   listvar();
     464   killall("ring");            // kills all rings
     465   listvar();
     466   killall("not", "int");      // kills all variables except int's (and procs)
     467   listvar();
     468   killall();                  // kills all vars except loaded procs
     469   listvar();
    335470}
    336471///////////////////////////////////////////////////////////////////////////////
     
    341476         by A.H.J. Sale's algorithm
    342477RETURN:  - string of exp(1) if no basering of char 0 is defined;
    343          - exp(1), of type number, if a basering of char 0 is defined and
    344          display its decimal format
     478         - exp(1), type number, if a basering of char 0 is defined, display its
     479         decimal format if printlevel >= voice (default:printlevel=voice-1 )
    345480EXAMPLE: example number_e; shows an example
    346481"
     
    366501      if( t==1 ) { r = r+number(u[1])/number(10)^i; }
    367502   }
    368    if( t==1 ) { "//",result[1,n+1]; return(r); }
     503   if( t==1 )
     504   { dbprint(printlevel-voice+2,"// "+result[1,n+1]);
     505     return(r);
     506   }
    369507   return(result[1,n+1]);
    370508}
    371509example
    372510{ "EXAMPLE:"; echo = 2;
    373    number_e(15);
     511   number_e(30);"";
    374512   ring R = 0,t,lp;
    375    number e = number_e(10);
     513   number e = number_e(30);
    376514   e;
    377515}
     
    383521         by algorithm of S. Rabinowitz
    384522RETURN:  - string of pi if no basering of char 0 is defined,
    385          - pi, of type number, if a basering of char 0 is defined and display
    386          its decimal format
     523         - pi, of type number, if a basering of char 0 is defined, display its
     524         decimal format if printlevel >= voice (default:printlevel=voice-1 )
    387525EXAMPLE: example number_pi; shows an example
    388526"
     
    437575   result = result,prelim[1];
    438576   result = "3."+result[2,n-1];
    439    if( t==1 ) { "//",result; return(pi); }
     577   if( t==1 )
     578   { dbprint(printlevel-voice+2,"// "+result);
     579     return(pi);
     580   }
    440581   return(result);
    441582}
    442583example
    443584{ "EXAMPLE:"; echo = 2;
    444    number_pi(5);
    445    ring r = 0,t,lp;
    446    number pi = number_pi(6);
    447    pi;
     585   number_pi(11);"";
     586   ring r = (real,10),t,dp;
     587   number pi = number_pi(11); pi;
    448588}
    449589///////////////////////////////////////////////////////////////////////////////
     
    465605example
    466606{  "EXAMPLE:"; echo = 2;
    467    primes(50,100);
    468    intvec v = primes(37,1); v;
     607    primes(50,100);"";
     608    intvec v = primes(37,1); v;
    469609}
    470610///////////////////////////////////////////////////////////////////////////////
    471611
    472612proc product (id, list #)
    473 "USAGE:    product(id[,v]); id=ideal/vector/module/matrix
    474           resp.id=intvec/intmat, v=intvec (e.g. v=1..n, n=integer)
    475 RETURN:   poly resp. int which is the product of all entries of id, with index
    476           given by v (default: v=1..number of entries of id)
    477 NOTE:     id is treated as a list of polys resp. integers. A module m is
     613"USAGE:    product(id[,v]); id ideal/vector/module/matrix/intvec/intmat/list,
     614          v intvec  (default: v=1.. number of entries of id)
     615RETURN:   - if id is not a list: poly resp. int, the product of all entries of
     616          id with index given by v.
     617          id is treated as a list of polys resp. integers. A module m is
    478618          identified with corresponding matrix M (columns of M generate m)
     619          - if id is a list: product of list entries, with index given by v.
     620          Assume that list members can be multiplied
    479621EXAMPLE:  example product; shows an example
    480622"
    481623{
    482    int n,j;
    483    if( typeof(id)=="poly" or typeof(id)=="ideal" or typeof(id)=="vector"
    484        or typeof(id)=="module" or typeof(id)=="matrix" )
     624   int n,j,tt;
     625   string ty;
     626   list l;
     627   int s = size(#);
     628   if( s!=0 )
     629   {  if ( typeof(#[s])=="intvec" )
     630      {  intvec v = #[s];
     631         tt=1; s=s-1;
     632         if ( s>0 ) { # = #[1..s]; }
     633      }
     634   }
     635   if ( s>0 )
     636   {
     637     l = list(id)+#;
     638     kill id;
     639     list id = l;
     640     ty = "list";
     641   }
     642   else
     643   { ty = typeof(id);
     644   }
     645   if( ty=="list" )
     646   { n = size(id);
     647     def f(1) = id[1];
     648     for( j=2; j<=n; j=j+1 ) { def f(j)=f(j-1)*id[j]; }
     649     return(f(n));
     650   }
     651   if( ty=="poly" or ty=="ideal" or ty=="vector"
     652       or ty=="module" or ty=="matrix" )
    485653   {
    486654      ideal i = ideal(matrix(id));
    487       if( size(#)!=0 ) { i = i[#[1]]; }
    488       n = ncols(i); poly f=1;
    489    }
    490    if( typeof(id)=="int" or typeof(id)=="intvec" or typeof(id)=="intmat" )
    491    {
    492       if ( typeof(id) == "int" ) { intmat S =id; }
     655      kill id;
     656      ideal id = i;
     657      if( tt!=0 ) { id = id[v]; }
     658      n = ncols(id); poly f(1)=id[1];
     659   }
     660   if( ty=="int" or ty=="intvec" or ty=="intmat" )
     661   {
     662      if ( ty == "int" ) { intmat S =id; }
    493663      else { intmat S = intmat(id); }
    494664      intvec i = S[1..nrows(S),1..ncols(S)];
    495       if( size(#)!=0 ) { i = i[#[1]]; }
    496       n = size(i); int f=1;
    497    }
    498    for( j=1; j<=n; j=j+1 ) { f=f*i[j]; }
    499    return(f);
     665      kill id;
     666      intvec id = i;
     667      if( tt!=0 ) { id = id[v]; }
     668      n = size(id); int f(1)=id[1];
     669   }
     670   for( j=2; j<=n; j=j+1 ) { def f(j)=f(j-1)*id[j]; }
     671   return(f(n));
    500672}
    501673example
     
    504676   ideal m = maxideal(1);
    505677   product(m);
     678   product(m[2..3]);
    506679   matrix M[2][3] = 1,x,2,y,3,z;
    507680   product(M);
     
    577750EXAMPLE: example sort; shows an example
    578751"
    579 {
    580    int ii,jj,s,n = 0,0,1,0;
     752{  int ii,jj,s,n = 0,0,1,0;
    581753   intvec v;
    582754   if ( defined(basering) ) { def P = basering; }
     
    659831example
    660832{  "EXAMPLE:"; echo = 2;
    661    ring r0 = 0,(x,y,z),lp;
    662    ideal i = x3,y3,z3,x2z,x2y,y2z,y2x,z2y,z2x,xyz;
    663    show(sort(i));"";
    664    show(sort(i,"wp(1,2,3)"));"";
    665    intvec v=10..1;
    666    show(sort(i,v));"";
    667    show(sort(i,v,1));"";   // should be the identity
    668    ring r1  = 0,t,ls;
    669    ideal j = t14,t6,t28,t20,t12,t34,t26,t18,t40,t32,t24,t38,t30,t36;
    670    show(sort(j)[1]);"";
    671    show(sort(j,"lp")[1]);"";
    672    list L =1,5..8,10,2,8..5,8,3..10;
    673    sort(L)[1];"";          // sort L lexicographically
     833   ring r0 = 0,(x,y,z,t),lp;
     834   ideal i = x3,z3,xyz;
     835   sort(i);                // sort w.r.t. lex ordering
     836   sort(i,3..1);
     837   sort(i,"ls")[1];        // sort w.r.t. negative lex ordering
     838   pause ("press return key to continue");
     839   list L =1,8..5,3..10;
     840   sort(L)[1];             // sort L lexicographically
    674841   sort(L,"Dp",1)[1];      // sort L w.r.t (total sum, reverse lex)
    675842}
     
    703870   intvec v; v[ncols(Z)]=0; v=v+1;
    704871   return((Z*v)[1,1]);
    705 }
     872 }
    706873example
    707874{  "EXAMPLE:"; echo = 2;
     
    709876   vector pv = [xy,xz,yz,x2,y2,z2];
    710877   sum(pv);
    711    //sum(pv,2..5);
    712    //matrix M[2][3] = 1,x,2,y,3,z;
    713    //sum(M);
    714    //intvec w=2,4,6;
    715    //sum(M,w);
    716    //intvec iv = 1,2,3,4,5,6,7,8,9;
    717    //w=1..5,7,9;
    718    //sum(iv,w);
    719    //intmat m[2][3] = 1,1,1,2,2,2;
    720    //sum(m,3..4);
     878   sum(pv,2..5);
     879   matrix M[2][3] = 1,x,2,y,3,z;
     880   intvec w=2,4,6;
     881   sum(M,w);
     882   intvec iv = 1,2,3,4,5,6,7,8,9;
     883   sum(iv,2..4);
    721884}
    722885///////////////////////////////////////////////////////////////////////////////
  • Singular/polys-impl.h

    r99a286 rc860e9  
    44*  Computer Algebra System SINGULAR     *
    55****************************************/
    6 /* $Id: polys-impl.h,v 1.30 1999-06-08 07:50:58 Singular Exp $ */
     6/* $Id: polys-impl.h,v 1.31 1999-08-23 13:15:58 Singular Exp $ */
    77
    88/***************************************************************
     
    398398#if SIZEOF_EXPONENT == 1
    399399#define P_DIV_MASK 0x80808080
     400#define EXPONENT_MAX     0x7f
    400401#else // SIZEOF_EXPONENT == 2
    401402#define P_DIV_MASK 0x80008000
     403#define EXPONENT_MAX   0x7fff
    402404#endif
    403405
     
    406408#if SIZEOF_EXPONENT == 1
    407409#define P_DIV_MASK 0x8080808080808080
     410#define EXPONENT_MAX             0x7f
    408411#elif  SIZEOF_EXPONENT == 2
    409412#define P_DIV_MASK 0x8000800080008000
     413#define EXPONENT_MAX           0x7fff
    410414#else // SIZEOF_EXPONENT == 4
    411415#define P_DIV_MASK 0x8000000080000000
     416#define EXPONENT_MAX       0x7fffffff
    412417#endif
    413418
  • Singular/polys1.cc

    r99a286 rc860e9  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: polys1.cc,v 1.24 1999-08-13 17:12:21 Singular Exp $ */
     4/* $Id: polys1.cc,v 1.25 1999-08-23 13:15:58 Singular Exp $ */
    55
    66/*
     
    427427  if(p!=NULL)
    428428  {
     429    if (i > EXPONENT_MAX)
     430    {
     431      Werror("exponent is too large, max. is %d",EXPONENT_MAX);
     432      return NULL;
     433    }
    429434    switch (i)
    430435    {
Note: See TracChangeset for help on using the changeset viewer.