Changeset 824c47 in git


Ignore:
Timestamp:
Aug 10, 2012, 2:40:20 PM (10 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', '96ce329119711a2b80858c8365abd29f8460bbfa')
Children:
e11ed0be7258f8a5789019dc86eb3edff31cfaf5
Parents:
560a3d597aa358cad2980bc2770d9ffb138c28c6
Message:
chg: mod/div for bigint
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libpolys/coeffs/longrat.cc

    r560a3d r824c47  
    744744    long aa=SR_TO_INT(a);
    745745    long bb=SR_TO_INT(b);
    746     return INT_TO_SR(aa/bb);
     746    return INT_TO_SR((aa-(aa%bb))/bb);
    747747  }
    748748  if (SR_HDL(a) & SR_INT)
     
    803803  if (SR_HDL(a) & SR_HDL(b) & SR_INT)
    804804  {
    805     if ((long)a>0L)
    806     {
    807       if ((long)b>0L)
    808         return INT_TO_SR(SR_TO_INT(a)%SR_TO_INT(b));
    809       else
    810         return INT_TO_SR(SR_TO_INT(a)%(-SR_TO_INT(b)));
    811     }
    812     else
    813     {
    814       if ((long)b>0L)
    815       {
    816         long i=(-SR_TO_INT(a))%SR_TO_INT(b);
    817         if ( i != 0L ) i = (SR_TO_INT(b))-i;
    818         return INT_TO_SR(i);
    819       }
    820       else
    821       {
    822         long i=(-SR_TO_INT(a))%(-SR_TO_INT(b));
    823         if ( i != 0L ) i = (-SR_TO_INT(b))-i;
    824         return INT_TO_SR(i);
    825       }
    826     }
     805    return INT_TO_SR(SR_TO_INT(a)%SR_TO_INT(b));
    827806  }
    828807  if (SR_HDL(a) & SR_INT)
    829808  {
    830     /* a is a small and b is a large int: -> a or (a+b) or (a-b) */
    831     if ((long)a<0L)
    832     {
    833       if (mpz_isNeg(b->z))
    834         return nlSub(a,b,r);
    835       /*else*/
    836         return nlAdd(a,b,r);
    837     }
    838     /*else*/
    839       return a;
     809    /* a is a small and b is a large int: -> a */
     810    return a;
    840811  }
    841812  number bb=NULL;
Note: See TracChangeset for help on using the changeset viewer.