summaryrefslogtreecommitdiff
path: root/src/bernoulli.c
diff options
context:
space:
mode:
authorzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2020-05-19 17:59:41 +0000
committerzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2020-05-19 17:59:41 +0000
commit1291a42f9dcbe76e2e109b52f775fea415e2a46d (patch)
tree8b25debca263c1cee5a9662039c07eb96e565bf6 /src/bernoulli.c
parent1a69eaf24cb5a6b0e36a55a270cf83c0e0de446f (diff)
downloadmpfr-1291a42f9dcbe76e2e109b52f775fea415e2a46d.tar.gz
[src/bernoulli.c] temporary fix for the bug in mpfr_gamma, something must be
wrong in the error analysis of mpfr_bernoulli_internal() git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@13909 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'src/bernoulli.c')
-rw-r--r--src/bernoulli.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/bernoulli.c b/src/bernoulli.c
index d89387afa..0c7b78fa5 100644
--- a/src/bernoulli.c
+++ b/src/bernoulli.c
@@ -39,7 +39,7 @@ is_prime (unsigned long p)
using Von Staudt–Clausen theorem, which says that the denominator of B[n]
divides the product of all primes p such that p-1 divides n.
Since B[n] = zeta(n) * 2*n!/(2pi)^n, we compute an approximation of
- d * zeta(n) * 2*n!/(2pi)^n and round it to the nearest integer. */
+ (2n+1)! * zeta(n) * 2*n!/(2pi)^n and round it to the nearest integer. */
static void
mpfr_bernoulli_internal (mpz_t *b, unsigned long n)
{
@@ -80,7 +80,7 @@ mpfr_bernoulli_internal (mpz_t *b, unsigned long n)
prec = __gmpfr_ceil_log2 (7.0 * (double) n); /* bound 2*pi by 7 */
prec = (prec + 1) >> 1; /* sqrt(2*pi*n) <= 2^prec */
mpfr_init2 (z, 53);
- mpfr_set_ui_2exp (z, 251469612, -32, MPFR_RNDU); /* 1/e/2/pi <= z */
+ mpfr_set_ui_2exp (z, 251685084, -32, MPFR_RNDU); /* 1/e/2/pi <= z */
mpfr_mul_ui (z, z, n, MPFR_RNDU);
mpfr_log2 (z, z, MPFR_RNDU);
mpfr_mul_ui (z, z, n, MPFR_RNDU);