[Mono-bugs] [Bug 51227][Nor] Changed - BigInteger.isProbablePrime doesn't work for small integers
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Thu, 20 Nov 2003 14:56:20 -0500 (EST)
Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.
Changed by bmaurer@users.sf.net.
http://bugzilla.ximian.com/show_bug.cgi?id=51227
--- shadow/51227 2003-11-20 13:37:30.000000000 -0500
+++ shadow/51227.tmp.30794 2003-11-20 14:56:20.000000000 -0500
@@ -2,16 +2,16 @@
Product: Mono/Class Libraries
Version: unspecified
OS: All
OS Details:
Status: NEW
Resolution:
-Severity:
+Severity: Unknown
Priority: Normal
Component: CORLIB
-AssignedTo: mono-bugs@ximian.com
+AssignedTo: bmaurer@users.sf.net
ReportedBy: pieter@mentalis.org
QAContact: mono-bugs@ximian.com
TargetMilestone: ---
URL:
Cc:
Summary: BigInteger.isProbablePrime doesn't work for small integers
@@ -33,6 +33,15 @@
for (int p = 0; p < smallPrimes.Length; p++) {
if (this == smallPrimes [p])
return true;
if (this % smallPrimes [p] == 0)
return false;
}
+
+------- Additional Comments From bmaurer@users.sf.net 2003-11-20 14:56 -------
+Actually, it is faster to do something like (writing pseudo code here)
+
+if (val >= LargestKnownPrime)
+ return primes.IndexOf (val) != 0;
+else
+ // do it the old way
+