[Gmp-commit] /var/hg/gmp: Test mpn_sec_div_qr and mpn_sec_div_r with normaliz...

mercurial at gmplib.org mercurial at gmplib.org
Sat Feb 8 15:53:15 UTC 2014


details:   /var/hg/gmp/rev/fb57e139c53a
changeset: 16281:fb57e139c53a
user:      Niels M?ller <nisse at lysator.liu.se>
date:      Sat Feb 08 16:52:59 2014 +0100
description:
Test mpn_sec_div_qr and mpn_sec_div_r with normalized d.

diffstat:

 ChangeLog         |   5 +++++
 tests/mpn/t-div.c |  27 ++++++++++++++++++++++++---
 2 files changed, 29 insertions(+), 3 deletions(-)

diffs (57 lines):

diff -r 131ad319a811 -r fb57e139c53a ChangeLog
--- a/ChangeLog	Sat Feb 08 08:29:16 2014 +0100
+++ b/ChangeLog	Sat Feb 08 16:52:59 2014 +0100
@@ -1,3 +1,8 @@
+2014-02-08  Niels Möller  <nisse at lysator.liu.se>
+
+	* tests/mpn/t-div.c (main): Test mpn_sec_div_qr and mpn_sec_div_r
+	with normalized d.
+
 2014-02-04  Niels Möller  <nisse at lysator.liu.se>
 
 	* doc/gmp.texi (Low-level Functions): Document mpn_sec_add_1 and
diff -r 131ad319a811 -r fb57e139c53a tests/mpn/t-div.c
--- a/tests/mpn/t-div.c	Sat Feb 08 08:29:16 2014 +0100
+++ b/tests/mpn/t-div.c	Sat Feb 08 16:52:59 2014 +0100
@@ -308,7 +308,7 @@
 	    MPN_COPY (qp, junkp, nn - dn + 1);
 	  qp[nn - dn] = mpn_sec_div_qr (qp, rp, nn, dup, dn, scratch);
 	  ASSERT_ALWAYS (ran == scratch[itch]);
-	  check_one (qp, rp, np, nn, dup, dn, "mpn_sec_div_qr", 0);
+	  check_one (qp, rp, np, nn, dup, dn, "mpn_sec_div_qr (unnorm)", 0);
 
 	  /* Test mpn_sec_div_r */
 	  itch = mpn_sec_div_r_itch (nn, dn);
@@ -321,9 +321,30 @@
 	  MPN_COPY (rp, np, nn);
 	  mpn_sec_div_r (rp, nn, dup, dn, scratch);
 	  ASSERT_ALWAYS (ran == scratch[itch]);
-	  /* Note: Since check_one cannot cope with random-only functions, we
+	  /* Note: Since check_one cannot cope with remainder-only functions, we
 	     pass qp[] from the previous function, mpn_sec_div_qr.  */
-	  check_one (qp, rp, np, nn, dup, dn, "mpn_sec_div_r", 0);
+	  check_one (qp, rp, np, nn, dup, dn, "mpn_sec_div_r (unnorm)", 0);
+
+	  /* Normalised case, mpn_sec_div_qr */
+	  itch = mpn_sec_div_qr_itch (nn, dn);
+	  scratch[itch] = ran;
+	  
+	  MPN_COPY (rp, np, nn);
+	  if (nn >= dn)
+	    MPN_COPY (qp, junkp, nn - dn + 1);
+	  qp[nn - dn] = mpn_sec_div_qr (qp, rp, nn, dnp, dn, scratch);
+	  ASSERT_ALWAYS (ran == scratch[itch]);
+	  check_one (qp, rp, np, nn, dnp, dn, "mpn_sec_div_qr (norm)", 0);
+
+	  /* Normalised case, mpn_sec_div_r */
+	  itch = mpn_sec_div_r_itch (nn, dn);
+	  scratch[itch] = ran;
+	  MPN_COPY (rp, np, nn);
+	  mpn_sec_div_r (rp, nn, dnp, dn, scratch);
+	  ASSERT_ALWAYS (ran == scratch[itch]);
+	  /* Note: Since check_one cannot cope with remainder-only functions, we
+	     pass qp[] from the previous function, mpn_sec_div_qr.  */
+	  check_one (qp, rp, np, nn, dnp, dn, "mpn_sec_div_r (norm)", 0);
 	}
 
       /* Test mpn_dcpi1_div_qr */


More information about the gmp-commit mailing list