Changeset 7326063 in git


Ignore:
Timestamp:
Aug 10, 2012, 4:45:13 PM (10 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', '96ce329119711a2b80858c8365abd29f8460bbfa')
Children:
39d73166130d050a8887d89072423aa5ffdcd53a
Parents:
e8eba79d5b1d97d0164270764c45f286deab00ca
Message:
chg: IntDiv/IntMod postponed
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libpolys/coeffs/longrat.cc

    re8eba7 r7326063  
    744744    long aa=SR_TO_INT(a);
    745745    long bb=SR_TO_INT(b);
    746     return INT_TO_SR((aa-(aa%bb))/bb);
     746    //return INT_TO_SR((aa-(aa%bb))/bb);
     747    return INT_TO_SR(aa/bb);
    747748  }
    748749  if (SR_HDL(a) & SR_INT)
     
    803804  if (SR_HDL(a) & SR_HDL(b) & SR_INT)
    804805  {
    805     return INT_TO_SR(SR_TO_INT(a)%SR_TO_INT(b));
     806    //return INT_TO_SR(SR_TO_INT(a)%SR_TO_INT(b));
     807    if ((long)a>0L)
     808    {
     809      if ((long)b>0L)
     810        return INT_TO_SR(SR_TO_INT(a)%SR_TO_INT(b));
     811      else
     812        return INT_TO_SR(SR_TO_INT(a)%(-SR_TO_INT(b)));
     813    }
     814    else
     815    {
     816      if ((long)b>0L)
     817      {
     818        long i=(-SR_TO_INT(a))%SR_TO_INT(b);
     819        if ( i != 0L ) i = (SR_TO_INT(b))-i;
     820        return INT_TO_SR(i);
     821      }
     822      else
     823      {
     824        long i=(-SR_TO_INT(a))%(-SR_TO_INT(b));
     825        if ( i != 0L ) i = (-SR_TO_INT(b))-i;
     826        return INT_TO_SR(i);
     827      }
     828    }
    806829  }
    807830  if (SR_HDL(a) & SR_INT)
    808831  {
     832    /* a is a small and b is a large int: -> a or (a+b) or (a-b) */
     833    if ((long)a<0L)
     834    {
     835      if (mpz_isNeg(b->z))
     836        return nlSub(a,b,r);
     837      /*else*/
     838        return nlAdd(a,b,r);
     839    }
     840    /*else*/
     841      return a;
     842
    809843    /* a is a small and b is a large int: -> a */
    810     return a;
     844    //return a;
    811845  }
    812846  number bb=NULL;
Note: See TracChangeset for help on using the changeset viewer.