[Gmp-commit] /var/hg/gmp: 5 new changesets

mercurial at gmplib.org mercurial at gmplib.org
Tue Sep 1 20:10:56 UTC 2015


details:   /var/hg/gmp/rev/489351f9a95d
changeset: 16801:489351f9a95d
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Tue Sep 01 21:56:08 2015 +0200
description:
mpq/cmp.c (mpq_cmp_numden): Cast to avoid over/underflow.

details:   /var/hg/gmp/rev/4cc5fbc6ff93
changeset: 16802:4cc5fbc6ff93
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Tue Sep 01 21:56:28 2015 +0200
description:
tests/mpn/t-toom22.c (MIN_AN): Use defined value.

details:   /var/hg/gmp/rev/7140a0166ac8
changeset: 16803:7140a0166ac8
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Tue Sep 01 21:56:43 2015 +0200
description:
tests/mpz/t-fac_ui.c: Check big factorial modulo a larger prime.

details:   /var/hg/gmp/rev/abd290a41aee
changeset: 16804:abd290a41aee
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Tue Sep 01 21:57:31 2015 +0200
description:
ChangeLog

details:   /var/hg/gmp/rev/dd6e7b59d6d6
changeset: 16805:dd6e7b59d6d6
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Tue Sep 01 22:10:48 2015 +0200
description:
Retune

diffstat:

 ChangeLog                 |   6 ++++++
 mpn/x86/atom/gmp-mparam.h |   7 +++++--
 mpn/x86/k10/gmp-mparam.h  |   7 +++++--
 mpq/cmp.c                 |   4 ++--
 tests/mpn/t-toom22.c      |   2 +-
 tests/mpz/t-fac_ui.c      |  17 ++++++++++-------
 6 files changed, 29 insertions(+), 14 deletions(-)

diffs (120 lines):

diff -r 2690c18d792e -r dd6e7b59d6d6 ChangeLog
--- a/ChangeLog	Mon Aug 31 21:30:37 2015 +0200
+++ b/ChangeLog	Tue Sep 01 22:10:48 2015 +0200
@@ -1,3 +1,9 @@
+2015-09-01 Marco Bodrato <bodrato at mail.dm.unipi.it>
+
+	* mpq/cmp.c (mpq_cmp_numden): Cast to avoid over/underflow.
+	* tests/mpn/t-toom22.c (MIN_AN): Use defined value.
+	* tests/mpz/t-fac_ui.c: Check big factorial modulo a larger prime.
+
 2015-08-31  Torbjörn Granlund  <torbjorng at google.com>
 
 	* mpn/x86/fat/fat.c (fake_cpuid_table): Update similarly to
diff -r 2690c18d792e -r dd6e7b59d6d6 mpn/x86/atom/gmp-mparam.h
--- a/mpn/x86/atom/gmp-mparam.h	Mon Aug 31 21:30:37 2015 +0200
+++ b/mpn/x86/atom/gmp-mparam.h	Tue Sep 01 22:10:48 2015 +0200
@@ -1,6 +1,6 @@
 /* Intel Atom/32 gmp-mparam.h -- Compiler/machine parameter header file.
 
-Copyright 1991, 1993, 1994, 2000-2011, 2014 Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 2000-2011, 2014-2015 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library.
 
@@ -160,9 +160,12 @@
 #define SQR_FFT_TABLE3_SIZE 151
 #define SQR_FFT_THRESHOLD                 2880
 
-#define MULLO_BASECASE_THRESHOLD             6
+#define MULLO_BASECASE_THRESHOLD             0  /* always */
 #define MULLO_DC_THRESHOLD                  48
 #define MULLO_MUL_N_THRESHOLD             8907
+#define SQRLO_BASECASE_THRESHOLD             0  /* always */
+#define SQRLO_DC_THRESHOLD                 140
+#define SQRLO_SQR_THRESHOLD               6075
 
 #define DC_DIV_QR_THRESHOLD                 59
 #define DC_DIVAPPR_Q_THRESHOLD             250
diff -r 2690c18d792e -r dd6e7b59d6d6 mpn/x86/k10/gmp-mparam.h
--- a/mpn/x86/k10/gmp-mparam.h	Mon Aug 31 21:30:37 2015 +0200
+++ b/mpn/x86/k10/gmp-mparam.h	Tue Sep 01 22:10:48 2015 +0200
@@ -1,6 +1,6 @@
 /* x86/k10 gmp-mparam.h -- Compiler/machine parameter header file.
 
-Copyright 1991, 1993, 1994, 2000-2011, 2014 Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 2000-2011, 2014-2015 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library.
 
@@ -170,9 +170,12 @@
 #define SQR_FFT_TABLE3_SIZE 172
 #define SQR_FFT_THRESHOLD                 5504
 
-#define MULLO_BASECASE_THRESHOLD             7
+#define MULLO_BASECASE_THRESHOLD             0  /* always */
 #define MULLO_DC_THRESHOLD                  40
 #define MULLO_MUL_N_THRESHOLD            13463
+#define SQRLO_BASECASE_THRESHOLD             7
+#define SQRLO_DC_THRESHOLD                 143
+#define SQRLO_SQR_THRESHOLD              11000
 
 #define DC_DIV_QR_THRESHOLD                 59
 #define DC_DIVAPPR_Q_THRESHOLD             270
diff -r 2690c18d792e -r dd6e7b59d6d6 mpq/cmp.c
--- a/mpq/cmp.c	Mon Aug 31 21:30:37 2015 +0200
+++ b/mpq/cmp.c	Tue Sep 01 22:10:48 2015 +0200
@@ -102,11 +102,11 @@
 
     count_leading_zeros (cnt1, PTR(NUM(op1))[num1_size - 1]);
     count_leading_zeros (cnt2, d2h);
-    bits1 = tmp1_size * GMP_NUMB_BITS - cnt1 - cnt2; /* + 2 * GMP_NAIL_BITS */
+    bits1 = (mp_bitcnt_t) tmp1_size * GMP_NUMB_BITS - cnt1 - cnt2 + 2 * GMP_NAIL_BITS;
 
     count_leading_zeros (cnt1, PTR(num_op2)[num2_size - 1]);
     count_leading_zeros (cnt2, d1h);
-    bits2 = tmp2_size * GMP_NUMB_BITS - cnt1 - cnt2; /* + 2 * GMP_NAIL_BITS */
+    bits2 = (mp_bitcnt_t) tmp2_size * GMP_NUMB_BITS - cnt1 - cnt2 + 2 * GMP_NAIL_BITS;
 
     if (bits1 > bits2 + 1)
       return num1_sign;
diff -r 2690c18d792e -r dd6e7b59d6d6 tests/mpn/t-toom22.c
--- a/tests/mpn/t-toom22.c	Mon Aug 31 21:30:37 2015 +0200
+++ b/tests/mpn/t-toom22.c	Tue Sep 01 22:10:48 2015 +0200
@@ -1,6 +1,6 @@
 #define mpn_toomMN_mul mpn_toom22_mul
 #define mpn_toomMN_mul_itch mpn_toom22_mul_itch
-#define MIN_AN 4
+#define MIN_AN MPN_TOOM22_MUL_MINSIZE
 
 #define MIN_BN(an)				\
   ((an) >= 2*MUL_TOOM22_THRESHOLD		\
diff -r 2690c18d792e -r dd6e7b59d6d6 tests/mpz/t-fac_ui.c
--- a/tests/mpz/t-fac_ui.c	Mon Aug 31 21:30:37 2015 +0200
+++ b/tests/mpz/t-fac_ui.c	Tue Sep 01 22:10:48 2015 +0200
@@ -83,15 +83,18 @@
       mpz_mul_ui (f, f, n+1);  /* (n+1)! = n! * (n+1) */
     }
 
-  n = 1048573; /* a prime */
-  if (n > MP_LIMB_T_MAX)
-    n = 65521; /* a smaller prime :-) */
-  mpz_fac_ui (f, n - 1);
-  m = mpz_fdiv_ui (f, n);
+  n = 2097169; /* a prime = 1 mod 4*/
+  if (n / 2 > MP_LIMB_T_MAX)
+    n = 131041; /* a smaller prime :-) */
+  mpz_fac_ui (f, n / 2); /* ((n-1)/2)! */
+  m = mpz_fdiv_ui (f, n); /* ((n-1)/2)! mod n*/
+  mpz_set_ui (f, m);
+  mpz_mul_ui (f, f, m); /* (((n-1)/2)!)^2 */
+  m = mpz_fdiv_ui (f, n); /* (((n-1)/2)!)^2 mod n*/
   if ( m != n - 1)
     {
-      printf ("mpz_fac_ui(%lu) wrong\n", n - 1);
-      printf ("  Wilson's theorem not verified: got %lu, expected %lu.\n",m ,n - 1);
+      printf ("mpz_fac_ui(%lu) wrong\n", n / 2);
+      printf (" al-Haytham's theorem not verified: got %lu, expected %lu.\n", m, n - 1);
       abort ();
     }
 


More information about the gmp-commit mailing list