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

mercurial at gmplib.org mercurial at gmplib.org
Thu Sep 10 23:15:44 UTC 2020


details:   /var/hg/gmp/rev/95f5c30cda20
changeset: 18083:95f5c30cda20
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Fri Sep 11 00:56:45 2020 +0200
description:
mini-gmp/tests/t-mpq_double.c (mpq_get_d_exact_p): Cleanup

details:   /var/hg/gmp/rev/60ba75aa3fd7
changeset: 18084:60ba75aa3fd7
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Fri Sep 11 00:59:46 2020 +0200
description:
mini-gmp/mini-gmp.c (mpz_get_str): Explicit cast void* to char*

details:   /var/hg/gmp/rev/57547dbdd7d4
changeset: 18085:57547dbdd7d4
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Fri Sep 11 01:15:37 2020 +0200
description:
ChangeLog

diffstat:

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

diffs (64 lines):

diff -r c5d0fcb06969 -r 57547dbdd7d4 ChangeLog
--- a/ChangeLog	Sat Jul 04 23:15:41 2020 +0200
+++ b/ChangeLog	Fri Sep 11 01:15:37 2020 +0200
@@ -1,3 +1,7 @@
+2020-05-17 Marco Bodrato <bodrato at mail.dm.unipi.it>
+
+	* mpq/cmp.c: Avoid overflow on int even for huge sizes.
+
 2020-05-12  Torbjörn Granlund  <tg at gmplib.org>
 
 	* mpn/generic/hgcd2-div.h (tabp): Combine several undefined tabp
diff -r c5d0fcb06969 -r 57547dbdd7d4 mini-gmp/ChangeLog
--- a/mini-gmp/ChangeLog	Sat Jul 04 23:15:41 2020 +0200
+++ b/mini-gmp/ChangeLog	Fri Sep 11 01:15:37 2020 +0200
@@ -1,3 +1,9 @@
+2020-09-10 Marco Bodrato <bodrato at mail.dm.unipi.it>
+
+	* tests/t-mpq_double.c (mpq_get_d_exact_p): Cleanup.
+
+	* mini-gmp.c (mpz_get_str): Explicit cast from void* to char*.
+
 2020-05-27  Minux Ma  <minux.ma at gmail.com>
 
 	Pass correct old_size to custom free and reallocate functions.
diff -r c5d0fcb06969 -r 57547dbdd7d4 mini-gmp/mini-gmp.c
--- a/mini-gmp/mini-gmp.c	Sat Jul 04 23:15:41 2020 +0200
+++ b/mini-gmp/mini-gmp.c	Fri Sep 11 01:15:37 2020 +0200
@@ -4301,7 +4301,7 @@
 ret:
   sp[sn] = '\0';
   if (osn && osn != sn + 1)
-    sp = gmp_realloc(sp, osn, sn + 1);
+    sp = (char*) gmp_realloc (sp, osn, sn + 1);
   return sp;
 }
 
diff -r c5d0fcb06969 -r 57547dbdd7d4 mini-gmp/tests/t-mpq_double.c
--- a/mini-gmp/tests/t-mpq_double.c	Sat Jul 04 23:15:41 2020 +0200
+++ b/mini-gmp/tests/t-mpq_double.c	Fri Sep 11 01:15:37 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