summaryrefslogtreecommitdiff
path: root/src/urandom.c
diff options
context:
space:
mode:
authorzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2017-01-23 07:27:10 +0000
committerzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2017-01-23 07:27:10 +0000
commita303a8d0d0c29acbbfe99925a6413500a89b3669 (patch)
tree3236bc75bad576343bad85b3f59d5f444376b421 /src/urandom.c
parentfbf0374e23309a6f4261d3e0298e36c9948993e0 (diff)
downloadmpfr-a303a8d0d0c29acbbfe99925a6413500a89b3669.tar.gz
[src/urandom.c] fixed bug reported by Trevor Spiteri
(https://sympa.inria.fr/sympa/arc/mpfr/2017-01/msg00020.html) git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@11218 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'src/urandom.c')
-rw-r--r--src/urandom.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/urandom.c b/src/urandom.c
index b5d7d9ec6..3b8c6d0a8 100644
--- a/src/urandom.c
+++ b/src/urandom.c
@@ -116,7 +116,7 @@ mpfr_urandom (mpfr_ptr rop, gmp_randstate_t rstate, mpfr_rnd_t rnd_mode)
if cnt == DRAW_BITS in which case the rounding bit is
outside rp[0] and must be generated. */
if (rnd_mode == MPFR_RNDU || rnd_mode == MPFR_RNDA
- || (rnd_mode == MPFR_RNDN && cnt == exp - emin - 1
+ || (rnd_mode == MPFR_RNDN && cnt == exp - (emin - 1)
&& (cnt != DRAW_BITS || random_rounding_bit (rstate))))
{
mpfr_set_ui_2exp (rop, 1, emin - 1, rnd_mode);