Changeset 6b02216 in git


Ignore:
Timestamp:
Jan 8, 2018, 2:26:25 PM (6 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
601afa9526529f410b2b1c6caed7369d8c6c8ab0fbd9e6f0afef39d078d85fd25c80563f6b53084c
Parents:
ccc9976fe27edd5c59e8fdb762ab7310fe7bc55e
Message:
fix: overfow check in hilb (hFirstSeries): via WerrorS
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • Singular/iparith.cc

    rccc9976 r6b02216  
    23032303  intvec *module_w=(intvec*)atGet(u,"isHomog",INTVEC_CMD);
    23042304  intvec *iv=hFirstSeries((ideal)u->Data(),module_w,currRing->qideal);
     2305  if (errorreported) return TRUE;
     2306
    23052307  switch((int)(long)v->Data())
    23062308  {
     
    56975699  intvec *module_w=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
    56985700  intvec *iv=hFirstSeries((ideal)u->Data(),module_w,currRing->qideal,wdegree);
     5701  if (errorreported) return TRUE;
     5702
    56995703  switch((int)(long)v->Data())
    57005704  {
  • kernel/combinatorics/hilb.cc

    rccc9976 r6b02216  
    111111  memcpy(pon, pol, l * sizeof(int));
    112112  if (l > x)
    113   {
     113  {/*pon[i] -= pol[i - x];*/
    114114    for (i = x; i < l; i++)
    115       pon[i] -= pol[i - x];
     115    { int64 t=pon[i];
     116      int64 t2=pol[i - x];
     117      t-=t2;
     118      if ((t>=INT_MIN)&&(t<=INT_MAX)) pon[i]=t;
     119      else if (!errorreported) WerrorS("int overflow in hilb 1");
     120    }
    116121    for (i = l; i < ln; i++)
    117       pon[i] = -pol[i - x];
     122    { /*pon[i] = -pol[i - x];*/
     123      int64 t= -pol[i - x];
     124      if ((t>=INT_MIN)&&(t<=INT_MAX)) pon[i]=t;
     125      else if (!errorreported) WerrorS("int overflow in hilb 2");
     126    }
    118127  }
    119128  else
     
    142151  j = Q0[Nv + 1];
    143152  for (i = 0; i < l; i++)
    144     pl[i + j] += p[i];
     153  { /* pl[i + j] += p[i];*/
     154    int64 t=pl[i+j];
     155    int64 t2=p[i];
     156    t+=t2;
     157    if ((t>=INT_MIN)&&(t<=INT_MAX)) pl[i+j]=t;
     158    else if (!errorreported) WerrorS("int overflow in hilb 3");
     159  }
    145160  x = pure[var[1]];
    146161  if (x!=0)
     
    148163    j += x;
    149164    for (i = 0; i < l; i++)
    150       pl[i + j] -= p[i];
     165    { /* pl[i + j] -= p[i];*/
     166      int64 t=pl[i+j];
     167      int64 t2=p[i];
     168      t-=t2;
     169      if ((t>=INT_MIN)&&(t<=INT_MAX)) pl[i+j]=t;
     170      else if (!errorreported) WerrorS("int overflow in hilb 4");
     171    }
    151172  }
    152173  j += l;
     
    13991420
    14001421  intvec *hseries1 = hFirstSeries(S, modulweight, Q, wdegree, tailRing);
     1422  if (errorreported) return;
    14011423
    14021424  hPrintHilb(hseries1);
Note: See TracChangeset for help on using the changeset viewer.