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

mercurial at gmplib.org mercurial at gmplib.org
Thu May 22 07:05:36 UTC 2014


details:   /var/hg/gmp/rev/c47e9eccb6b4
changeset: 16399:c47e9eccb6b4
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Thu May 22 09:01:49 2014 +0200
description:
tests/mpf/t-sub.c (check_data): more data...

details:   /var/hg/gmp/rev/0054f346f0af
changeset: 16400:0054f346f0af
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Thu May 22 09:02:28 2014 +0200
description:
mpf/ui_sub.c: typo

details:   /var/hg/gmp/rev/79920e0e021a
changeset: 16401:79920e0e021a
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Thu May 22 09:05:26 2014 +0200
description:
ChangeLog

diffstat:

 ChangeLog         |   4 ++++
 mpf/ui_sub.c      |   2 +-
 tests/mpf/t-sub.c |  26 ++++++++++++++++----------
 3 files changed, 21 insertions(+), 11 deletions(-)

diffs (85 lines):

diff -r f3a418ed446b -r 79920e0e021a ChangeLog
--- a/ChangeLog	Wed May 21 13:54:57 2014 +0200
+++ b/ChangeLog	Thu May 22 09:05:26 2014 +0200
@@ -1,3 +1,7 @@
+2014-05-22 Marco Bodrato <bodrato at mail.dm.unipi.it>
+
+	* tests/mpf/t-sub.c (check_data): Test also ui_sub and sub_ui.
+
 2014-05-20 Marco Bodrato <bodrato at mail.dm.unipi.it>
 
 	* gen-fac.c: +1 in the init2 argument before setbit.
diff -r f3a418ed446b -r 79920e0e021a mpf/ui_sub.c
--- a/mpf/ui_sub.c	Wed May 21 13:54:57 2014 +0200
+++ b/mpf/ui_sub.c	Thu May 22 09:05:26 2014 +0200
@@ -155,7 +155,7 @@
   if (ediff >= prec)
     {
       /* V completely cancelled.  */
-      if (tp != up)
+      if (rp != up)
 	MPN_COPY (rp, up, usize);
       rsize = usize;
     }
diff -r f3a418ed446b -r 79920e0e021a tests/mpf/t-sub.c
--- a/tests/mpf/t-sub.c	Wed May 21 13:54:57 2014 +0200
+++ b/tests/mpf/t-sub.c	Thu May 22 09:05:26 2014 +0200
@@ -121,26 +121,34 @@
     { { 123, 2, { 8, 9 } },             { 123, 1, { 9 } }, { 122, 1, { 8 } } },
     { { 1, 1, { 9 } },                  { 1, 1, { 8 } },   { 1, 1, { 1 } } },
     { { 1, 1, { 9 } },                 { 1, -1, { 6 } },   { 1, 1, { 15 } } },
-    { { 1, 2, { 8, 9 } },               { 1, 1, { 9 } },   { 0, 1, { 8 } } },
     { { 1, 2, { 8, 9 } },               { 1, 1, { 8 } },   { 1, 2, { 8, 1 } } },
+    { { 2, 2, { 8, 1 } },               { 1, 1, { 9 } },   { 1, 1, { GMP_NUMB_MAX } } },
+    { { 2, 1, { 1 } },                  { 1, 1, { 1 } },   { 1, 1, { GMP_NUMB_MAX } } },
+    { { 2, 1, { 9 } },                 { 1, -1, { 8 } },   { 2, 2, { 8, 9 } } },
+
+    { { 1, 2, { GMP_NUMB_MAX, 8 } }, { 1, 1, { 9 } },  { 0, -1, { 1 } } },
+    { { 1, 2, { GMP_NUMB_MAX, 7 } }, { 1, 1, { 9 } },  { 1, -2, { 1, 1 } } },
+    { { 1, 2, { 1, 8 } },            { 1, 1, { 9 } },  { 0, -1, { GMP_NUMB_MAX } } },
+    { { 1, 2, { 1, 7 } },            { 1, 1, { 9 } },  { 1, -2, { GMP_NUMB_MAX, 1 } } },
+    { { 1, 2, { 0, 8 } },            { 1, 1, { 9 } },  { 1, -1, { 1 } } },
 
     /* f - f == 0, various sizes.
        These exercise a past problem (gmp 4.1.3 and earlier) where the
        result exponent was not zeroed on a zero result like this.  */
     { { 0, 0 }, { 0, 0 }, { 0, 0 } },
-    { { 1, 1, { 123 } },            { 1, 1, { 123 } },            { 0, 0 } },
-    { { 99, 2, { 123, 456 } },      { 99, 2, { 123, 456 } },      { 0, 0 } },
+    { { 1, 3, { 0, 0, 123 } },      { 1, 1, { 123 } },            { 0, 0 } },
+    { { 99, 3, { 0, 123, 456 } },   { 99, 2, { 123, 456 } },      { 0, 0 } },
     { { 99, 3, { 123, 456, 789 } }, { 99, 3, { 123, 456, 789 } }, { 0, 0 } },
 
     /* High limbs cancel, leaving just the low limbs of the longer operand.
        This exercises a past problem (gmp 4.1.3 and earlier) where high zero
        limbs on the remainder were not stripped before truncating to the
        destination, causing loss of precision.  */
-    { { 123, 2, { 8, 9 } },             { 123, 1, { 9 } }, { 122, 1, { 8 } } },
-    { { 123, 3, { 8, 0, 9 } },          { 123, 1, { 9 } }, { 121, 1, { 8 } } },
-    { { 123, 4, { 8, 0, 0, 9 } },       { 123, 1, { 9 } }, { 120, 1, { 8 } } },
-    { { 123, 5, { 8, 0, 0, 0, 9 } },    { 123, 1, { 9 } }, { 119, 1, { 8 } } },
-    { { 123, 6, { 8, 0, 0, 0, 0, 9 } }, { 123, 1, { 9 } }, { 118, 1, { 8 } } },
+    { { 1, 2, { 8, 9 } },             { 1, 1, { 9 } }, { 0, 1, { 8 } } },
+    { { 1, 3, { 8, 0, 9 } },          { 1, 1, { 9 } }, { -1, 1, { 8 } } },
+    { { 1, 4, { 8, 0, 0, 9 } },       { 1, 1, { 9 } }, { -2, 1, { 8 } } },
+    { { 1, 5, { 8, 0, 0, 0, 9 } },    { 1, 1, { 9 } }, { -3, 1, { 8 } } },
+    { { 1, 6, { 8, 0, 0, 0, 0, 9 } }, { 1, 1, { 9 } }, { -4, 1, { 8 } } },
 
   };
 
@@ -207,7 +215,6 @@
 	  ui = mpf_get_ui (x);
 	  if (mpf_cmp_ui (x, ui) == 0)
 	    {
-	      printf("ui_\n");
 	      mpf_ui_sub (got, ui, y);
 
 	      if (mpf_cmp (got, want) != 0)
@@ -224,7 +231,6 @@
 	  ui = mpf_get_ui (y);
 	  if (mpf_cmp_ui (y, ui) == 0)
 	    {
-	      printf("_ui\n");
 	      mpf_sub_ui (got, x, ui);
 
 	      if (mpf_cmp (got, want) != 0)


More information about the gmp-commit mailing list