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

mercurial at gmplib.org mercurial at gmplib.org
Sat Oct 10 06:13:37 UTC 2015


details:   /var/hg/gmp/rev/370ebd02f6d9
changeset: 16839:370ebd02f6d9
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Sat Oct 10 07:47:07 2015 +0200
description:
gen-fac.c, gen-fib.c: Correct the name of the program in error message.

details:   /var/hg/gmp/rev/66de0cfb28ef
changeset: 16840:66de0cfb28ef
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Sat Oct 10 08:02:07 2015 +0200
description:
mpf/get_str.c: Increase precision of base^e computation.

details:   /var/hg/gmp/rev/4be5e23566c1
changeset: 16841:4be5e23566c1
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Sat Oct 10 08:10:24 2015 +0200
description:
mpf/get_str.c: Share common code.

details:   /var/hg/gmp/rev/66fa2ee6ca38
changeset: 16842:66fa2ee6ca38
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Sat Oct 10 08:10:34 2015 +0200
description:
ChangeLog

diffstat:

 ChangeLog     |   7 +++++++
 gen-fac.c     |   4 ++--
 gen-fib.c     |   4 ++--
 mpf/get_str.c |  32 +++++++++++++-------------------
 4 files changed, 24 insertions(+), 23 deletions(-)

diffs (117 lines):

diff -r 56e8d30616cd -r 66fa2ee6ca38 ChangeLog
--- a/ChangeLog	Fri Oct 09 21:12:27 2015 +0200
+++ b/ChangeLog	Sat Oct 10 08:10:34 2015 +0200
@@ -1,3 +1,10 @@
+2015-10-10 Marco Bodrato <bodrato at mail.dm.unipi.it>
+
+	* gen-fib.c: Correct the name of the program in error message.
+	* gen-fac.c: Likewise.
+
+	* mpf/get_str.c: Increase precision of base^e computation.
+
 2015-10-09  Torbjörn Granlund  <torbjorng at google.com>
 
 	* config.guess: Recognise cabylake and goldmont and more versions of
diff -r 56e8d30616cd -r 66fa2ee6ca38 gen-fac.c
--- a/gen-fac.c	Fri Oct 09 21:12:27 2015 +0200
+++ b/gen-fac.c	Sat Oct 10 08:10:34 2015 +0200
@@ -1,6 +1,6 @@
 /* Generate data for combinatorics: fac_ui, bin_uiui, ...
 
-Copyright 2002, 2011-2014 Free Software Foundation, Inc.
+Copyright 2002, 2011-2015 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library.
 
@@ -268,7 +268,7 @@
 
   if (argc != 3)
     {
-      fprintf (stderr, "Usage: gen-fac_ui limbbits nailbits\n");
+      fprintf (stderr, "Usage: gen-fac limbbits nailbits\n");
       exit (1);
     }
   limb_bits = atoi (argv[1]);
diff -r 56e8d30616cd -r 66fa2ee6ca38 gen-fib.c
--- a/gen-fib.c	Fri Oct 09 21:12:27 2015 +0200
+++ b/gen-fib.c	Sat Oct 10 08:10:34 2015 +0200
@@ -1,6 +1,6 @@
 /* Generate Fibonacci table data.
 
-Copyright 2001, 2002, 2004, 2012, 2014 Free Software Foundation, Inc.
+Copyright 2001, 2002, 2004, 2012, 2014, 2015 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library.
 
@@ -123,7 +123,7 @@
 
   if (argc != 4)
     {
-      fprintf (stderr, "Usage: gen-bases <header|table> <limbbits> <nailbits>\n");
+      fprintf (stderr, "Usage: gen-fib <header|table> <limbbits> <nailbits>\n");
       exit (1);
     }
 
diff -r 56e8d30616cd -r 66fa2ee6ca38 mpf/get_str.c
--- a/mpf/get_str.c	Fri Oct 09 21:12:27 2015 +0200
+++ b/mpf/get_str.c	Sat Oct 10 08:10:34 2015 +0200
@@ -4,7 +4,8 @@
    example, the number 3.1416 would be returned as "31416" in DIGIT_PTR and
    1 in EXP.
 
-Copyright 1993-1997, 2000-2003, 2005, 2006, 2011 Free Software Foundation, Inc.
+Copyright 1993-1997, 2000-2003, 2005, 2006, 2011, 2015 Free Software
+Foundation, Inc.
 
 This file is part of the GNU MP Library.
 
@@ -190,6 +191,15 @@
 
   LIMBS_PER_DIGIT_IN_BASE (n_limbs_needed, n_digits, base);
 
+  if (un > n_limbs_needed)
+    {
+      up += un - n_limbs_needed;
+      un = n_limbs_needed;
+    }
+
+  TMP_ALLOC_LIMBS_2 (pp, 2 * n_limbs_needed + 4,
+		     tp, 2 * n_limbs_needed + 4);
+
   if (ue <= n_limbs_needed)
     {
       /* We need to multiply number by base^n to get an n_digits integer part.  */
@@ -199,15 +209,7 @@
       n_more_limbs_needed = n_limbs_needed - ue;
       DIGITS_IN_BASE_PER_LIMB (e, n_more_limbs_needed, base);
 
-      if (un > n_limbs_needed)
-	{
-	  up += un - n_limbs_needed;
-	  un = n_limbs_needed;
-	}
-      pp = TMP_ALLOC_LIMBS (2 * n_limbs_needed + 2);
-      tp = TMP_ALLOC_LIMBS (2 * n_limbs_needed + 2);
-
-      pn = mpn_pow_1_highpart (pp, &ign, (mp_limb_t) base, e, n_limbs_needed, tp);
+      pn = mpn_pow_1_highpart (pp, &ign, (mp_limb_t) base, e, n_limbs_needed + 1, tp);
       if (un > pn)
 	mpn_mul (tp, up, un, pp, pn);	/* FIXME: mpn_mul_highpart */
       else
@@ -236,15 +238,7 @@
       n_less_limbs_needed = ue - n_limbs_needed;
       DIGITS_IN_BASE_PER_LIMB (e, n_less_limbs_needed, base);
 
-      if (un > n_limbs_needed)
-	{
-	  up += un - n_limbs_needed;
-	  un = n_limbs_needed;
-	}
-      pp = TMP_ALLOC_LIMBS (2 * n_limbs_needed + 2);
-      tp = TMP_ALLOC_LIMBS (2 * n_limbs_needed + 2);
-
-      pn = mpn_pow_1_highpart (pp, &ign, (mp_limb_t) base, e, n_limbs_needed, tp);
+      pn = mpn_pow_1_highpart (pp, &ign, (mp_limb_t) base, e, n_limbs_needed + 1, tp);
 
       xn = n_limbs_needed + (n_less_limbs_needed-ign);
       xp = TMP_ALLOC_LIMBS (xn);


More information about the gmp-commit mailing list