[Gmp-commit] /var/hg/gmp: mpz/oddfac_1.c (FACTORS_PER_LIMB): Estimate conserv...

mercurial at gmplib.org mercurial at gmplib.org
Thu Nov 11 20:35:19 UTC 2021


details:   /var/hg/gmp/rev/c30a956aa82f
changeset: 18284:c30a956aa82f
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Thu Nov 11 21:34:10 2021 +0100
description:
mpz/oddfac_1.c (FACTORS_PER_LIMB): Estimate conservatively

diffstat:

 mpz/oddfac_1.c |  8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r d7500848a6a9 -r c30a956aa82f mpz/oddfac_1.c
--- a/mpz/oddfac_1.c	Thu Nov 11 06:50:58 2021 +0100
+++ b/mpz/oddfac_1.c	Thu Nov 11 21:34:10 2021 +0100
@@ -7,7 +7,7 @@
 IN FACT, IT IS ALMOST GUARANTEED THAT IT WILL CHANGE OR
 DISAPPEAR IN A FUTURE GNU MP RELEASE.
 
-Copyright 2010-2012, 2015-2017, 2020 Free Software Foundation, Inc.
+Copyright 2010-2012, 2015-2017, 2020, 2021 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library.
 
@@ -257,10 +257,12 @@
 /* Section oddfac: odd factorial, needed also by binomial*/
 /*********************************************************/
 
+/* FIXME: refine che following estimate. */
+
 #if TUNE_PROGRAM_BUILD
-#define FACTORS_PER_LIMB (GMP_NUMB_BITS / (LOG2C(FAC_DSC_THRESHOLD_LIMIT*FAC_DSC_THRESHOLD_LIMIT-1)+1) * 2)
+#define FACTORS_PER_LIMB (GMP_NUMB_BITS / (LOG2C(FAC_DSC_THRESHOLD_LIMIT*FAC_DSC_THRESHOLD_LIMIT-1)+1) * 2 - 1)
 #else
-#define FACTORS_PER_LIMB (GMP_NUMB_BITS / (LOG2C(FAC_DSC_THRESHOLD*FAC_DSC_THRESHOLD-1)+1) * 2)
+#define FACTORS_PER_LIMB (GMP_NUMB_BITS / (LOG2C(FAC_DSC_THRESHOLD*FAC_DSC_THRESHOLD-1)+1) * 2 - 1)
 #endif
 
 /* mpz_oddfac_1 computes the odd part of the factorial of the


More information about the gmp-commit mailing list