Changeset bf8a3f in git


Ignore:
Timestamp:
May 28, 2014, 11:01:58 AM (10 years ago)
Author:
Adi Popescu <adi_popescum@…>
Branches:
(u'spielwiese', '4a9821a93ffdc22a6696668bd4f6b8c9de3e6c5f')
Children:
121ad4a2fe86746537b889b9ac969034ed1c0dd1
Parents:
d3c0a07150aa1213c3c3b5b69c6e7fcfacd56d73
git-author:
Adi Popescu <adi_popescum@yahoo.de>2014-05-28 11:01:58+02:00
git-committer:
Adi Popescu <adi_popescum@yahoo.de>2014-05-28 18:02:06+02:00
Message:
fix: 64 bits Long/paraplane.tst
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • Singular/LIB/paraplanecurves.lib

    rd3c0a0 rbf8a3f  
    19731973
    19741974///////////////////////////////////////////////////////////////////////////////
    1975 static proc polyModP(poly q, bigint p)
     1975proc polyModP(poly q, bigint p)
    19761976"USAGE:  polyModP(q, p); q poly, p bigint
    19771977RETURN:  takes each coefficient of q modulo p and returns the resulting poly
     
    20642064"
    20652065{
    2066   r;
    2067   p;
    2068   gcd(r,p);
    20692066  list L = extgcd(r, p);
    20702067  if (L[1] != 1) { ERROR("GCD of", r, "and", p, "should be 1."); }
  • libpolys/coeffs/longrat.cc

    rd3c0a0 rbf8a3f  
    265265  if ( SR_HDL(n) & SR_INT )
    266266  {
    267     term = SR_TO_INT(n);
     267    int nn=SR_TO_INT(n);
     268    if ((long)nn==SR_TO_INT(n))
     269       term = nn;
     270    else
     271    {
     272        mpz_t dummy;
     273        mpz_init_set_si(dummy, SR_TO_INT(n));
     274        term = make_cf(dummy);   
     275    }
    268276  }
    269277  else
     
    534542  nlTest(i, r);
    535543  nlNormalize(i,r);
    536   if (SR_HDL(i) & SR_INT) return SR_TO_INT(i);
     544  if (SR_HDL(i) & SR_INT)
     545  {
     546    int dummy = SR_TO_INT(i);
     547    if((long)dummy == SR_TO_INT(i))
     548        return SR_TO_INT(i);
     549    else
     550        return 0;
     551  }
    537552  if (i->s==3)
    538553  {
     
    563578  nlTest(i, r);
    564579  nlNormalize(i,r);
    565   if (SR_HDL(i) &SR_INT) return (i);
     580  if (SR_HDL(i) & SR_INT) return (i);
    566581  if (i->s==3)
    567582  {
     
    786801  {
    787802    LONG bb=SR_TO_INT(b);
    788     LONG c=SR_TO_INT(a)%bb;
     803    LONG c=SR_TO_INT(a) % bb;
     804    if(c < 0)
     805    {   
     806        if(bb < 0)
     807            c = c - bb;
     808        else
     809            c = c + bb;
     810    }
     811    //printf("\nnlIntMod SR_TO_INT\n");
     812    //n_Print(a,r);
     813    //printf("\na =  %ld\n",SR_TO_INT(a));
     814    //n_Print(b, r);
     815    //printf("\nb =  %ld\n",bb);
     816    //printf("\nc =  %ld\n",c);
    789817    return INT_TO_SR(c);
    790818  }
    791819  if (SR_HDL(a) & SR_INT)
    792820  {
    793     /* a is a small and b is a large int: -> a */
    794     return a;
     821    // a is a small and b is a large int: -> a
     822    //  INCORRECT, IT COULD HAPPEN THAT B IS A SMALL NUMBER
     823    number aa;
     824    //mpz_ptr aa=NULL;
     825    //aa=(mpz_ptr)omAlloc(sizeof(mpz_t));
     826    aa=ALLOC_RNUMBER();
     827    mpz_init(aa->z);
     828    mpz_set_si(aa->z, SR_TO_INT(a));
     829    //mpz_init_set_si(aa,SR_TO_INT(a));
     830    u=ALLOC_RNUMBER();
     831#if defined(LDEBUG)
     832    u->debug=123456;
     833#endif
     834    u->s = 3;
     835    mpz_init(u->z);
     836    mpz_mod(u->z,aa->z,b->z);
     837    if (mpz_isNeg(u->z))
     838    {
     839        if (mpz_isNeg(b->z))
     840          mpz_sub(u->z,aa->z,b->z);
     841        else
     842          mpz_add(u->z,aa->z,b->z);
     843    }
     844    /*if( !n_GreaterZero(a,r) )
     845    {
     846        if( !n_GreaterZero(b,r) )
     847            a = r->cfSub(a,b,r);
     848        else
     849            a = r->cfAdd(a,b,r);
     850    }*/
     851    //printf("\nnlIntMod a\n");
     852    //printf("\na =  ");n_Print(a,r);printf("\n");
     853    //gmp_printf("\nb =  %Zd",b);n_Print(b,r);printf("\n");
     854    //printf("\nc =  ");n_Print(a,r);printf("\n");
     855    //gmp_printf("\nc =  %Zd",u->z);
     856    u=nlShort3(u);
     857    nlTest(u,r);
     858    return u;
    795859  }
    796860  number bb=NULL;
     
    807871  u->s = 3;
    808872  mpz_mod(u->z,a->z,b->z);
     873  //printf("\nnlIntMod mpz_t\n");
     874  //gmp_printf("\na =  %Zd\n",a);
     875  //n_Print(b, r);
     876  //gmp_printf("\nb =  %Zd\n",b);
     877  //gmp_printf("\nc =  %Zd\n",u);
    809878  if (bb!=NULL)
    810879  {
     
    20922161  assume( getCoeffType(dst) == ID );
    20932162  assume( getCoeffType(src) == ID );
    2094 
    20952163  if ((SR_HDL(a) & SR_INT)||(a==NULL))
    20962164  {
     
    26932761
    26942762    nlInpGcd(cand, n, cf);
    2695 
    26962763    assume( nlGreaterZero(cand,cf) );
    26972764
  • libpolys/coeffs/mpr_complex.cc

    rd3c0a0 rbf8a3f  
    458458        if (SR_HDL(num) & SR_INT)
    459459        {
    460           r= SR_TO_INT(num);
     460          int nn = SR_TO_INT(num);
     461          if((long)nn == SR_TO_INT(num))
     462            r = SR_TO_INT(num);
     463          else
     464            r = gmp_float(SR_TO_INT(num));
    461465        }
    462466        else
Note: See TracChangeset for help on using the changeset viewer.