Changeset cc3240c in git


Ignore:
Timestamp:
Feb 8, 2012, 3:49:13 PM (11 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a800fe4b3e9d37a38c5a10cc0ae9dfa0c15a4ee6')
Children:
65c5f5710da694616a5f4f24bb00f15eb0ddfae6
Parents:
c8e03004b0f2c558839cdce7d26c2b7978191d54
git-author:
Hans Schoenemann <hannes@mathematik.uni-kl.de>2012-02-08 15:49:13+01:00
git-committer:
Hans Schoenemann <hannes@mathematik.uni-kl.de>2012-02-08 15:49:55+01:00
Message:
fix: nlInplAdd failed to simplify in some cases
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libpolys/coeffs/longrat.cc

    rc8e030 rcc3240c  
    3131{
    3232  assume(x->s==3);
    33   if ((mpz_cmp_ui(x->z,(long)0)==0)
    34   || (mpz_size1(x->z)<=MP_SMALL))
     33  if (mpz_cmp_ui(x->z,(long)0)==0)
     34  {
     35    mpz_clear(x->z);
     36    FREE_RNUMBER(x);
     37    return INT_TO_SR(0);
     38  }
     39  if (mpz_size1(x->z)<=MP_SMALL)
    3540  {
    3641    LONG ui=mpz_get_si(x->z);
     
    21382143LINLINE BOOLEAN nlIsZero (number a, const coeffs)
    21392144{
     2145  #if 0
     2146  if (a==INT_TO_SR(0)) return TRUE;
     2147  if ((SR_HDL(a) & SR_INT)||(a==NULL)) return FALSE;
     2148  if (mpz_cmp_si(a->z,(long)0)==0)
     2149  {
     2150    printf("gmp-0 in nlIsZero\n");
     2151    dErrorBreak();
     2152    return TRUE;
     2153  }
     2154  return FALSE;
     2155  #else
    21402156  return (a==INT_TO_SR(0));
    2141   //return (mpz_cmp_si(a->z,(long)0)==0);
     2157  #endif
    21422158}
    21432159
     
    22112227number nlShort3_noinline(number x);
    22122228
    2213 static inline number nlInpAdd_(number a, number b, const coeffs r)
     2229LINLINE void nlInpAdd(number &a, number b, const coeffs r)
    22142230{
    22152231  if (SR_HDL(a) & SR_HDL(b) & SR_INT)
     
    22172233    LONG r=SR_HDL(a)+SR_HDL(b)-1L;
    22182234    if ( ((r << 1) >> 1) == r )
    2219       return (number)(long)r;
     2235      a=(number)(long)r;
    22202236    else
    2221       return nlRInit(SR_TO_INT(r));
     2237      a=nlRInit(SR_TO_INT(r));
    22222238  }
    22232239  // a=a+b
    2224   if (SR_HDL(b) & SR_INT)
     2240  else if (SR_HDL(b) & SR_INT)
    22252241  {
    22262242    switch (a->s)
     
    22492265      }
    22502266    }
    2251     return a;
    2252   }
    2253   if (SR_HDL(a) & SR_INT)
     2267    return;
     2268  }
     2269  else if (SR_HDL(a) & SR_INT)
    22542270  {
    22552271    number u=ALLOC_RNUMBER();
     
    22882304    }
    22892305    nlTest(u, r);
    2290     return u;
     2306    a=u;
    22912307  }
    22922308  else
     
    23572373      }
    23582374    }
    2359     nlTest(a, r);
    2360     return a;
    2361   }
    2362 }
    2363 
    2364 LINLINE void nlInpAdd(number &a, number b, const coeffs r)
    2365 {
    2366   a = nlInpAdd_(a, b, r);
    2367 }
    2368 
     2375  }
     2376  nlTest(a, r);
     2377}
    23692378
    23702379LINLINE number nlMult (number a, number b, const coeffs R)
Note: See TracChangeset for help on using the changeset viewer.