summaryrefslogtreecommitdiff
path: root/gamma.c
diff options
context:
space:
mode:
authorzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2006-11-23 13:25:35 +0000
committerzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2006-11-23 13:25:35 +0000
commit02bb7496ad2977357bd7919803ef3a5e7f5ff0a8 (patch)
treedb18a1bc817721c97bf9b11f70b2cbc9717d1acb /gamma.c
parent149b493b794899ae7a0e56c6c68730a84aca952f (diff)
downloadmpfr-02bb7496ad2977357bd7919803ef3a5e7f5ff0a8.tar.gz
replaced set_d by set_str_binary (more portable)
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@4276 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'gamma.c')
-rw-r--r--gamma.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/gamma.c b/gamma.c
index 371e87aac..70f946165 100644
--- a/gamma.c
+++ b/gamma.c
@@ -175,14 +175,16 @@ mpfr_gamma (mpfr_ptr gamma, mpfr_srcptr x, mp_rnd_t rnd_mode)
int overflow;
mpfr_t yp;
+ /* 1/e rounded down to 53 bits */
+#define EXPM1_STR "0.010111100010110101011000110110001011001110111100111"
mpfr_clear_overflow ();
mpfr_init2 (xp, 53);
mpfr_init2 (yp, 53);
- mpfr_set_d (xp, EXPM1, GMP_RNDZ); /* 1/e rounded down */
+ mpfr_set_str_binary (xp, EXPM1_STR);
mpfr_mul (xp, x, xp, GMP_RNDZ);
mpfr_sub_ui (yp, x, 2, GMP_RNDZ);
mpfr_pow (xp, xp, yp, GMP_RNDZ); /* (x/e)^(x-2) */
- mpfr_set_d (yp, EXPM1, GMP_RNDZ);
+ mpfr_set_str_binary (yp, EXPM1_STR);
mpfr_mul (xp, xp, yp, GMP_RNDZ); /* x^(x-2) / e^(x-1) */
mpfr_mul (xp, xp, yp, GMP_RNDZ); /* x^(x-2) / e^x */
mpfr_mul (xp, xp, x, GMP_RNDZ); /* x^(x-1) / e^x */