Changeset 52cccfd in git


Ignore:
Timestamp:
Apr 7, 2013, 1:36:31 AM (9 years ago)
Author:
Martin Lee <martinlee84@…>
Branches:
(u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', '48f1dd268d0ff74ef2f7dccbf02545425002ddcc')
Children:
803956e36bc486d4e8bb34f103dce728e5d1ea6f
Parents:
67f82efac7d435c72c77fbd667d017b0ad83a57e
git-author:
Martin Lee <martinlee84@web.de>2013-04-07 01:36:31+02:00
git-committer:
Martin Lee <martinlee84@web.de>2013-04-08 14:42:19+02:00
Message:
fix: int overflow
File:
1 edited

Legend:

Unmodified
Added
Removed
  • factory/cf_gcd_smallp.cc

    r67f82ef r52cccfd  
    383383  int p= getCharacteristic ();
    384384  int d= degree (mipo);
    385   int bound= ipower (p, d);
     385  double bound= pow ((double) p, (double) d);
    386386  do
    387387  {
     
    436436  CanonicalForm newMipo= convertNTLzzpX2CF (NTLIrredpoly, Variable (1));
    437437  return rootOf (newMipo);
    438 }
    439 
    440 /// chooses a suitable extension of \f$ F_{p}(\alpha ) \f$
    441 /// we do not extend \f$ F_{p}(\alpha ) \f$ itself but extend \f$ F_{p} \f$ ,
    442 /// s.t. \f$ F_{p}(\alpha ) \subset F_{p}(\beta ) \f$
    443 static inline
    444 void choose_extension (const int& d, const int& num_vars, Variable& beta)
    445 {
    446   int p= getCharacteristic();
    447   if (p != fac_NTL_char)
    448   {
    449     fac_NTL_char= p;
    450     zz_p::init (p);
    451   }
    452   zz_pX NTLirredpoly;
    453   //TODO: replace d by max_{i} (deg_x{i}(f))
    454   int i= (int) (log ((double) ipower (d + 1, num_vars))/log ((double) p));
    455   int m= degree (getMipo (beta));
    456   if (i <= 1)
    457     i= 2;
    458   BuildIrred (NTLirredpoly, i*m);
    459   CanonicalForm mipo= convertNTLzzpX2CF (NTLirredpoly, Variable(1));
    460   beta= rootOf (mipo);
    461438}
    462439
     
    22532230  GFRandom genGF;
    22542231  int p= getCharacteristic ();
    2255   int bound;
     2232  double bound;
    22562233  if (alpha != Variable (1))
    22572234  {
    2258     bound= ipower (p, degree (getMipo(alpha)));
    2259     bound= ipower (bound, k);
     2235    bound= pow ((double) p, (double) degree (getMipo(alpha)));
     2236    bound= pow (bound, (double) k);
    22602237  }
    22612238  else if (GF)
    22622239  {
    2263     bound= ipower (p, getGFDegree());
    2264     bound= ipower (bound, k);
     2240    bound= pow ((double) p, (double) getGFDegree());
     2241    bound= pow ((double) bound, (double) k);
    22652242  }
    22662243  else
    2267     bound= ipower (p, k);
     2244    bound= pow ((double) p, (double) k);
    22682245
    22692246  CanonicalForm random;
Note: See TracChangeset for help on using the changeset viewer.