summaryrefslogtreecommitdiff
path: root/src/gamma.c
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2016-02-17 12:25:30 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2016-02-17 12:25:30 +0000
commit85b33b5a8508243cdf7ac2afa1c0bcab5d99038b (patch)
treedcbdad82a34c0140c21ebebaf5046dbd0c5b25fd /src/gamma.c
parent35f1dd56694313404ae68d280f9b6fee79439d9f (diff)
downloadmpfr-85b33b5a8508243cdf7ac2afa1c0bcab5d99038b.tar.gz
[src/gamma.c] Added another assertion.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@10047 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'src/gamma.c')
-rw-r--r--src/gamma.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/gamma.c b/src/gamma.c
index 397455df7..0cf171928 100644
--- a/src/gamma.c
+++ b/src/gamma.c
@@ -91,7 +91,12 @@ bits_fac (unsigned long n)
mpfr_log2 (x, x, MPFR_RNDZ);
r = mpfr_get_ui (x, MPFR_RNDU); /* lower bound on ceil(x) */
for (k = 2; k <= n; k *= 2)
- r -= n / k;
+ {
+ /* Note: the approximation is accurate enough so that the
+ subtractions do not wrap. */
+ MPFR_ASSERTD (r >= n / k);
+ r -= n / k;
+ }
mpfr_clear (x);
mpfr_clear (y);
MPFR_SAVE_EXPO_FREE (expo);