[Mono-bugs] [Bug 81857][Nor] Changed - BigInteger.IsProbablePrime() fails on some primes

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Wed Jul 4 11:51:25 EDT 2007

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 sebastien at ximian.com.


--- shadow/81857	2007-07-04 09:53:45.000000000 -0400
+++ shadow/81857.tmp.28282	2007-07-04 11:51:25.000000000 -0400
@@ -88,6 +88,18 @@
 ------- Additional Comments From sebastien at ximian.com  2007-07-04 09:53 -------
 Yes they should (and will be once this bug is closed or, maybe, if we
 approach a release date). But since the current patches don't solve
 all issues and that corlib cannot deal with small primes there's no
 point in doing incremental updates in corlib.
+------- Additional Comments From sebastien at ximian.com  2007-07-04 11:51 -------
+It's indeed a problem with small numbers. The few remaining failures
+disappear if we don't use 2 as a base (another optimization). 
+i.e. BigInteger y = mr.Pow (2, r);
+That explains why the problem is only seen when checking for primes
+and not elsewhere (where all numbers are big).
+Since this occurs with both the old and new [Mod]Pow I suspect the
+problem is in the multiplication (with modulo) code.

More information about the mono-bugs mailing list