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

mercurial at gmplib.org mercurial at gmplib.org
Thu Sep 10 23:14:40 UTC 2020


details:   /var/hg/gmp-6.2/rev/05a50bb6ccd7
changeset: 18070:05a50bb6ccd7
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Thu Sep 10 23:45:31 2020 +0200
description:
mini-gmp/tests/t-mpq_double.c (mpq_get_d_exact_p): Cleanup

details:   /var/hg/gmp-6.2/rev/b3e34e7f9a7a
changeset: 18071:b3e34e7f9a7a
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Thu Sep 10 23:46:11 2020 +0200
description:
ChangeLog

details:   /var/hg/gmp-6.2/rev/74769311739b
changeset: 18072:74769311739b
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Fri Sep 11 00:52:40 2020 +0200
description:
mini-gmp/tests/t-mpq_double.c: Always trigger potential false test failure.

details:   /var/hg/gmp-6.2/rev/65024428d111
changeset: 18073:65024428d111
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Fri Sep 11 01:14:23 2020 +0200
description:
mini-gmp: Backported whitespace and grammar fixes, from Paul Eggert

diffstat:

 mini-gmp/ChangeLog            |   4 ++++
 mini-gmp/mini-gmp.c           |   6 +++---
 mini-gmp/tests/t-mpq_double.c |  11 ++++-------
 3 files changed, 11 insertions(+), 10 deletions(-)

diffs (69 lines):

diff -r 510b83519d1c -r 65024428d111 mini-gmp/ChangeLog
--- a/mini-gmp/ChangeLog	Sat Jul 04 23:38:27 2020 +0200
+++ b/mini-gmp/ChangeLog	Fri Sep 11 01:14:23 2020 +0200
@@ -1,3 +1,7 @@
+2020-09-10 Marco Bodrato <bodrato at mail.dm.unipi.it>
+
+	* tests/t-mpq_double.c (mpq_get_d_exact_p): Cleanup.
+
 2020-05-21  Torbjörn Granlund  <tg at gmplib.org>
 
 	* tests/t-mpq_muldiv_2exp.c (testmain): Cast printf args to right type.
diff -r 510b83519d1c -r 65024428d111 mini-gmp/mini-gmp.c
--- a/mini-gmp/mini-gmp.c	Sat Jul 04 23:38:27 2020 +0200
+++ b/mini-gmp/mini-gmp.c	Fri Sep 11 01:14:23 2020 +0200
@@ -790,7 +790,7 @@
 
        qh' = floor( (b^3 - 1) / u) - b = floor ((b^3 - b u - 1) / u
 	   = floor( (b (~u) + b-1) / u),
-	   
+
        and the remainder
 
        r = b (~u) + b-1 - qh (b uh + ul)
@@ -3418,7 +3418,7 @@
       gmp_lucas_step_k_2k (V, Qk, n);
 
       /* A step k->k+1 is performed if the bit in $n$ is 1	*/
-      /* mpz_tstbit(n,bs) or the the bit is 0 in $n$ but	*/
+      /* mpz_tstbit(n,bs) or the bit is 0 in $n$ but	*/
       /* should be 1 in $n+1$ (bs == b0)			*/
       if (b0 == bs || mpz_tstbit (n, bs))
 	{
@@ -4488,7 +4488,7 @@
       ptrdiff_t word_step;
       /* The current (partial) limb. */
       mp_limb_t limb;
-      /* The number of bytes left to to in this limb. */
+      /* The number of bytes left to do in this limb. */
       size_t bytes;
       /* The index where the limb was read. */
       mp_size_t i;
diff -r 510b83519d1c -r 65024428d111 mini-gmp/tests/t-mpq_double.c
--- a/mini-gmp/tests/t-mpq_double.c	Sat Jul 04 23:38:27 2020 +0200
+++ b/mini-gmp/tests/t-mpq_double.c	Fri Sep 11 01:14:23 2020 +0200
@@ -58,13 +58,7 @@
 int
 mpq_get_d_exact_p (const mpq_t q)
 {
-  /* return mpq_mantissasizeinbits (q) <= DBL_MANT_DIG; */
-  return
-    (mpz_sizeinbase (mpq_denref (q), 2) -
-     mpz_scan1 (mpq_denref (q), 0) == 1) &&
-    (mpz_sizeinbase (mpq_numref (q), 2) -
-     mpz_scan1 (mpq_numref (q), 0) <= DBL_MANT_DIG);
-  /* mpz_sizeinbase (zero, 2) - mpz_scan1 (zero, 0) == 2 */
+  return mpq_mantissasizeinbits (q) <= DBL_MANT_DIG;
 }
 #define HAVE_EXACT_P 1
 #endif
@@ -128,6 +122,9 @@
       d = ldexp ((double) m, e);
       mpq_set_d (y, d);
 
+      if (i == 0)
+       mpq_neg (z, y);
+
       mpq_add (y, y, z);
       mpq_set_d (z, mpq_get_d (y));
       f = mpq_get_d (z);



More information about the gmp-commit mailing list