Changeset 03ac3b in git for Singular/misc_ip.cc
- Timestamp:
- Oct 4, 2010, 12:59:20 PM (14 years ago)
- Branches:
- (u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
- Children:
- 3dabc0a263c826086e25e57f280b9aa6a32bdec4
- Parents:
- 2a33e61c9baf5e72b38a197992a67ff69c2caac4
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/misc_ip.cc
r2a33e6 r03ac3b 186 186 187 187 /* n and pBound are assumed to be bigint numbers */ 188 lists primeFactorisation(const number n, constnumber pBound)188 lists primeFactorisation(const number n, number pBound) 189 189 { 190 190 mpz_t nn; number2mpz(n, nn); … … 220 220 unsigned long p_ui=5; add = 2; 221 221 mpz_sqrt(sr, nn); 222 if ((mpz_cmp_ui(b, 0) == 0) || (mpz_cmp(pb, sr) > 0)) mpz_set(pb, sr); 223 unsigned long limit=mpz_get_ui(pb); 224 if ((limit==0)||(mpz_cmp_ui(pb,limit)!=0)) limit=1<<31; 222 unsigned long limit=nlInt(pBound,NULL); 223 if ((mpz_cmp_ui(b, 0) == 0) || (mpz_cmp(pb, sr) > 0)) 224 { 225 mpz_set(pb, sr); 226 mpz_set(b, sr); 227 limit=mpz_get_ui(sr); 228 } 229 else if (limit==0) 230 { 231 limit=1<<31; 232 mpz_set_ui(pb,limit); 233 mpz_set_ui(b,limit); 234 } 225 235 while (p_ui <=limit) 226 236 { … … 232 242 //mpz_sqrt(sr, nn); 233 243 //if ((mpz_cmp_ui(b, 0) == 0) || (mpz_cmp(pb, sr) > 0)) mpz_set(pb, sr); 234 if (mpz_size1(nn)<= 2)244 if (mpz_size1(nn)<=1) 235 245 { 236 246 mpz_sqrt(sr, nn); 237 if ( (mpz_cmp_ui(b, 0) == 0) || (mpz_cmp(pb, sr) > 0)) mpz_set(pb, sr);247 if (mpz_cmp(pb, sr) > 0) mpz_set(pb, sr); 238 248 unsigned long l=mpz_get_ui(sr); 239 if (l<limit) limit=l;249 if (l<limit) { limit=l; } 240 250 if (mpz_size1(nn)<=1) 241 251 { … … 248 258 setListEntry_ui(primes, index, p_ui); 249 259 multiplicities[index++] = tt; 250 if (nn_ui >(limit/6)) limit=nn_ui/6;260 if (nn_ui<(limit/6)) { limit=nn_ui/6;} 251 261 } 252 262 p_ui +=add;
Note: See TracChangeset
for help on using the changeset viewer.