[Gmp-commit] /home/hgfiles/gmp: Account for divisor truncation error as well ...

mercurial at gmplib.org mercurial at gmplib.org
Thu Jan 7 19:09:27 CET 2010


details:   /home/hgfiles/gmp/rev/2e84f1436e84
changeset: 13357:2e84f1436e84
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Thu Jan 07 19:09:17 2010 +0100
description:
Account for divisor truncation error as well as mpn_mu_divappr_q's error.

diffstat:

 ChangeLog              |  7 +++++--
 mpn/generic/mu_div_q.c |  4 +++-
 2 files changed, 8 insertions(+), 3 deletions(-)

diffs (38 lines):

diff -r db54118ab8e5 -r 2e84f1436e84 ChangeLog
--- a/ChangeLog	Thu Jan 07 17:09:30 2010 +0100
+++ b/ChangeLog	Thu Jan 07 19:09:17 2010 +0100
@@ -2,6 +2,9 @@
 
 	* Version 5.0.0 released.
 
+	* mpn/generic/mu_div_q.c: Account for divisor truncation error as well
+	as mpn_mu_divappr_q's error.
+
 	* mpn/generic/mu_div_q.c: Handle mpn_preinv_mu_divappr_q returning a
 	high limb.
 
@@ -18,8 +21,8 @@
 	(mpn_preinv_mu_divappr_q, mpn_mu_divappr_q): Declare dividend constant.
 	* gmp-impl.h: Likewise.
 
-	* perfpow.c (mpn_perfect_power_p): Call mpn_divexact instead of mpn_bdiv_q (with
-	too little scratch space!).
+	* perfpow.c (mpn_perfect_power_p): Call mpn_divexact instead of
+	mpn_bdiv_q (with too little scratch space!).
 
 	From Niels Möller:
 	* tests/mpn/t-div.c (check_one): Get rid of the poorly managed variable
diff -r db54118ab8e5 -r 2e84f1436e84 mpn/generic/mu_div_q.c
--- a/mpn/generic/mu_div_q.c	Thu Jan 07 17:09:30 2010 +0100
+++ b/mpn/generic/mu_div_q.c	Thu Jan 07 19:09:17 2010 +0100
@@ -166,7 +166,9 @@
       qh = mpn_mu_divappr_q (tp, np + nn - (2 * qn + 2), 2 * qn + 2,
 			     dp + dn - (qn + 1), qn + 1, scratch);
 
-      if (tp[0] > 4)
+      /* The max error of mpn_mu_divappr_q is +4, but we get an additional
+         error from the divisor truncation.  */
+      if (tp[0] > 6)
 	{
 	  MPN_COPY (qp, tp + 1, qn);
 	}


More information about the gmp-commit mailing list