summaryrefslogtreecommitdiff
path: root/random2.c
diff options
context:
space:
mode:
authorpelissip <pelissip@280ebfd0-de03-0410-8827-d642c229c3f4>2004-02-06 13:27:05 +0000
committerpelissip <pelissip@280ebfd0-de03-0410-8827-d642c229c3f4>2004-02-06 13:27:05 +0000
commit19767e6f6f9089ef12f81e9f3b64f5c71ff71c84 (patch)
tree388f8324eb4f2595b607ac0b1afa7352ca4c9c5d /random2.c
parent6e0b309b6faf9353e1732c77a95099a5aa5d86c0 (diff)
downloadmpfr-19767e6f6f9089ef12f81e9f3b64f5c71ff71c84.tar.gz
+ Better support of non IEEE doubles.
+ You can compile MPFR without gmp internal files (ie gmp-impl.h, gmp-mparam.h, and config.h). You only need gmp.h and libgmp.a. But you can still compile with GMP internal files (configure detects them). git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@2665 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'random2.c')
-rw-r--r--random2.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/random2.c b/random2.c
index e65d2bf66..cf5ad4b23 100644
--- a/random2.c
+++ b/random2.c
@@ -22,10 +22,8 @@ along with the MPFR Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA. */
-#include "gmp.h"
-#include "gmp-impl.h"
-#include "longlong.h"
-#include "mpfr.h"
+
+#define MPFR_NEED_LONGLONG_H
#include "mpfr-impl.h"
void
@@ -40,7 +38,7 @@ mpfr_random2 (mpfr_ptr x, mp_size_t size, mp_exp_t exp)
MPFR_CLEAR_FLAGS(x);
MPFR_SET_POS(x);
xn = ABS (size);
- prec = (MPFR_PREC(x) - 1) / GMP_NUMB_BITS;
+ prec = (MPFR_PREC(x) - 1) / BITS_PER_MP_LIMB;
xp = MPFR_MANT(x);
if (xn == 0)
@@ -59,11 +57,11 @@ mpfr_random2 (mpfr_ptr x, mp_size_t size, mp_exp_t exp)
xp[xn - 1] |= MPFR_LIMB_HIGHBIT;
/* Generate random exponent. */
- _gmp_rand (&elimb, RANDS, GMP_NUMB_BITS);
+ _gmp_rand (&elimb, RANDS, BITS_PER_MP_LIMB);
exp = ABS (exp);
MPFR_SET_EXP (x, elimb % (2 * exp + 1) - exp);
/* Mask off non significant bits in the low limb. */
- cnt = xn * GMP_NUMB_BITS - MPFR_PREC(x);
+ cnt = xn * BITS_PER_MP_LIMB - MPFR_PREC(x);
xp[0] &= ~((MP_LIMB_T_ONE << cnt) - 1);
}