[Gmp-commit] /home/hgfiles/gmp: Fixed bug in jacobi_2, and added some more te...

mercurial at gmplib.org mercurial at gmplib.org
Wed Apr 28 16:06:11 CEST 2010


details:   /home/hgfiles/gmp/rev/2c730f91277b
changeset: 13577:2c730f91277b
user:      Niels M?ller <nisse at lysator.liu.se>
date:      Wed Apr 28 16:06:07 2010 +0200
description:
Fixed bug in jacobi_2, and added some more tests.

diffstat:

 ChangeLog                   |   7 +++++++
 mpn/generic/jacobi_lehmer.c |   2 +-
 tests/mpz/t-jac.c           |  12 ++++++++++++
 3 files changed, 20 insertions(+), 1 deletions(-)

diffs (48 lines):

diff -r b2dff0640748 -r 2c730f91277b ChangeLog
--- a/ChangeLog	Tue Apr 27 22:26:47 2010 +0200
+++ b/ChangeLog	Wed Apr 28 16:06:07 2010 +0200
@@ -1,3 +1,10 @@
+2010-04-28  Niels Möller  <nisse at lysator.liu.se>
+
+	* tests/mpz/t-jac.c (check_data): Added some more test cases.
+
+	* mpn/generic/jacobi_lehmer.c (mpn_jacobi_2): Bugfix, count
+	trailing zeros, not leading.
+
 2010-04-27  Torbjorn Granlund  <tege at gmplib.org>
 
 	* mpn/powerpc64/mode64/p6/mul_basecase.asm: New file.
diff -r b2dff0640748 -r 2c730f91277b mpn/generic/jacobi_lehmer.c
--- a/mpn/generic/jacobi_lehmer.c	Tue Apr 27 22:26:47 2010 +0200
+++ b/mpn/generic/jacobi_lehmer.c	Wed Apr 28 16:06:07 2010 +0200
@@ -523,7 +523,7 @@
 	{
 	  if (ah == 0)
 	    return 0;
-	  count_leading_zeros (c, ah);
+	  count_trailing_zeros (c, ah);
 	  bit ^= ((GMP_NUMB_BITS + c) << 1) & (bl ^ (bl >> 1));
 	  al = ah >> c;
 	  goto ab_reduced;
diff -r b2dff0640748 -r 2c730f91277b tests/mpz/t-jac.c
--- a/tests/mpz/t-jac.c	Tue Apr 27 22:26:47 2010 +0200
+++ b/tests/mpz/t-jac.c	Wed Apr 28 16:06:07 2010 +0200
@@ -615,6 +615,18 @@
     /* special values inducing a==b==1 at the end of jac_or_kron() */
     { "0x10000000000000000000000000000000000000000000000001",
       "0x10000000000000000000000000000000000000000000000003", 1 },
+
+    /* Test for old bug in jacobi_2, 32-bit and 64-bit limbs */
+    { "0x43900000000", "0x42400000439", -1 },
+    { "0x4390000000000000000", "0x4240000000000000439", -1 },
+
+    /* Some tests involving large quotients in the continued fraction
+       expansion. */
+    { "37200210845139167613356125645445281805",
+      "451716845976689892447895811408978421929", -1 },
+    { "67674091930576781943923596701346271058970643542491743605048620644676477275152701774960868941561652032482173612421015",
+      "4902678867794567120224500687210807069172039735", 0 },
+    { "2666617146103764067061017961903284334497474492754652499788571378062969111250584288683585223600172138551198546085281683283672592", "2666617146103764067061017961903284334497474492754652499788571378062969111250584288683585223600172138551198546085281683290481773", 1 }
   };
 
   int    i;


More information about the gmp-commit mailing list