summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2009-03-03 16:51:07 +0000
committerzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2009-03-03 16:51:07 +0000
commitf5f7883fc7cf47d38ed493a882fd7109bdd589bb (patch)
tree1058cf0d07593fa2cec9f32b4988ac40611b4bff
parentcbd40e1cb659b579e608afbe7a05da5b15a860be (diff)
downloadmpfr-f5f7883fc7cf47d38ed493a882fd7109bdd589bb.tar.gz
GMP_RNDX -> MPFR_RNDX
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@6053 280ebfd0-de03-0410-8827-d642c229c3f4
-rw-r--r--FAQ.html10
-rw-r--r--NEWS3
-rw-r--r--TODO2
-rw-r--r--acos.c20
-rw-r--r--acosh.c22
-rw-r--r--add.c2
-rw-r--r--add1.c8
-rw-r--r--add1sp.c16
-rw-r--r--agm.c26
-rw-r--r--asin.c14
-rw-r--r--asinh.c10
-rw-r--r--atan.c34
-rw-r--r--atan2.c30
-rw-r--r--atanh.c10
-rw-r--r--cache.c14
-rw-r--r--cbrt.c10
-rw-r--r--cmp_d.c2
-rw-r--r--cmp_ld.c2
-rw-r--r--const_catalan.c20
-rw-r--r--const_euler.c22
-rw-r--r--const_log2.c8
-rw-r--r--const_pi.c32
-rw-r--r--cos.c20
-rw-r--r--cosh.c8
-rw-r--r--cot.c8
-rw-r--r--coth.c8
-rw-r--r--csc.c4
-rw-r--r--csch.c4
-rw-r--r--div.c24
-rw-r--r--div_2si.c4
-rw-r--r--div_2ui.c4
-rw-r--r--div_ui.c12
-rw-r--r--eint.c88
-rw-r--r--erf.c62
-rw-r--r--erfc.c84
-rw-r--r--exceptions.c6
-rw-r--r--exp.c24
-rw-r--r--exp2.c18
-rw-r--r--exp3.c32
-rw-r--r--exp_2.c20
-rw-r--r--expm1.c12
-rw-r--r--factorial.c8
-rw-r--r--fits_intmax.c2
-rw-r--r--fits_uintmax.c2
-rw-r--r--fma.c28
-rw-r--r--fms.c28
-rw-r--r--gamma.c94
-rw-r--r--gen_inverse.h10
-rw-r--r--get_d.c12
-rw-r--r--get_d64.c20
-rw-r--r--get_ld.c8
-rw-r--r--get_sj.c2
-rw-r--r--get_str.c20
-rw-r--r--gmp_op.c18
-rw-r--r--hypot.c20
-rw-r--r--jn.c56
-rw-r--r--jyn_asympt.c100
-rw-r--r--li2.c218
-rw-r--r--lngamma.c150
-rw-r--r--log.c18
-rw-r--r--log10.c12
-rw-r--r--log1p.c4
-rw-r--r--log2.c6
-rw-r--r--logging.c2
-rw-r--r--modf.c2
-rw-r--r--mpfr-impl.h28
-rw-r--r--mpfr.h30
-rw-r--r--mpfr.texi28
-rw-r--r--mul.c24
-rw-r--r--mul_2si.c4
-rw-r--r--pow.c66
-rw-r--r--pow_si.c10
-rw-r--r--pow_ui.c6
-rw-r--r--pow_z.c26
-rw-r--r--print_rnd_mode.c20
-rw-r--r--rec_sqrt.c2
-rw-r--r--reldiff.c2
-rw-r--r--rem1.c26
-rwxr-xr-xreplace_all4
-rw-r--r--rint.c26
-rw-r--r--root.c10
-rw-r--r--round_near_x.c4
-rw-r--r--round_p.c2
-rw-r--r--round_prec.c8
-rw-r--r--round_raw_generic.c32
-rw-r--r--sech.c2
-rw-r--r--set_ld.c8
-rw-r--r--set_q.c4
-rw-r--r--set_rnd.c4
-rw-r--r--set_str_raw.c2
-rw-r--r--set_uj.c4
-rw-r--r--set_z.c8
-rw-r--r--sin.c20
-rw-r--r--sin_cos.c28
-rw-r--r--sinh.c18
-rw-r--r--sinh_cosh.c12
-rw-r--r--speed.c4
-rw-r--r--sqr.c4
-rw-r--r--sqrt.c4
-rw-r--r--strtofr.c22
-rw-r--r--sub.c2
-rw-r--r--sub1.c26
-rw-r--r--sub1sp.c56
-rw-r--r--subnormal.c6
-rw-r--r--sum.c8
-rw-r--r--tan.c4
-rw-r--r--tanh.c12
-rw-r--r--tests/mpfr-test.h8
-rw-r--r--tests/reuse.c8
-rw-r--r--tests/rnd_mode.c8
-rw-r--r--tests/tabs.c24
-rw-r--r--tests/tacos.c38
-rw-r--r--tests/tacosh.c40
-rw-r--r--tests/tadd.c352
-rw-r--r--tests/tadd1sp.c10
-rw-r--r--tests/tadd_d.c28
-rw-r--r--tests/tadd_ui.c18
-rw-r--r--tests/tagm.c88
-rw-r--r--tests/tasin.c60
-rw-r--r--tests/tasinh.c32
-rw-r--r--tests/tatan.c166
-rw-r--r--tests/tatanh.c44
-rw-r--r--tests/taway.c32
-rw-r--r--tests/tcan_round.c14
-rw-r--r--tests/tcbrt.c46
-rw-r--r--tests/tcheck.c8
-rw-r--r--tests/tcmp.c16
-rw-r--r--tests/tcmp2.c40
-rw-r--r--tests/tcmp_d.c18
-rw-r--r--tests/tcmp_ld.c18
-rw-r--r--tests/tcmp_ui.c28
-rw-r--r--tests/tcmpabs.c8
-rw-r--r--tests/tcomparisons.c14
-rw-r--r--tests/tconst_catalan.c6
-rw-r--r--tests/tconst_euler.c16
-rw-r--r--tests/tconst_log2.c36
-rw-r--r--tests/tconst_pi.c20
-rw-r--r--tests/tcopysign.c28
-rw-r--r--tests/tcos.c78
-rw-r--r--tests/tcosh.c34
-rw-r--r--tests/tcot.c22
-rw-r--r--tests/tcoth.c48
-rw-r--r--tests/tcsc.c14
-rw-r--r--tests/tcsch.c22
-rw-r--r--tests/td_div.c22
-rw-r--r--tests/td_sub.c18
-rw-r--r--tests/tdim.c26
-rw-r--r--tests/tdiv.c312
-rw-r--r--tests/tdiv_d.c22
-rw-r--r--tests/tdiv_ui.c58
-rw-r--r--tests/teint.c60
-rw-r--r--tests/teq.c36
-rw-r--r--tests/terf.c176
-rw-r--r--tests/tests.c76
-rw-r--r--tests/texceptions.c100
-rw-r--r--tests/texp.c298
-rw-r--r--tests/texp10.c56
-rw-r--r--tests/texp2.c82
-rw-r--r--tests/texpm1.c34
-rw-r--r--tests/tfactorial.c24
-rw-r--r--tests/tfits.c188
-rw-r--r--tests/tfma.c128
-rw-r--r--tests/tfmod.c58
-rw-r--r--tests/tfms.c134
-rw-r--r--tests/tfprintf.c4
-rw-r--r--tests/tfrac.c64
-rw-r--r--tests/tgamma.c120
-rw-r--r--tests/tgeneric.c26
-rw-r--r--tests/tgeneric_ui.c8
-rw-r--r--tests/tget_d.c34
-rw-r--r--tests/tget_d_2exp.c18
-rw-r--r--tests/tget_f.c68
-rw-r--r--tests/tget_ld_2exp.c18
-rw-r--r--tests/tget_set_d64.c144
-rw-r--r--tests/tget_sj.c82
-rw-r--r--tests/tget_str.c300
-rw-r--r--tests/tget_z.c12
-rw-r--r--tests/tgmpop.c68
-rw-r--r--tests/thyperbolic.c50
-rw-r--r--tests/thypot.c84
-rw-r--r--tests/tinp_str.c6
-rw-r--r--tests/tinternals.c12
-rw-r--r--tests/tisnan.c12
-rw-r--r--tests/tj0.c36
-rw-r--r--tests/tj1.c22
-rw-r--r--tests/tjn.c148
-rw-r--r--tests/tl2b.c10
-rw-r--r--tests/tlgamma.c104
-rw-r--r--tests/tli2.c44
-rw-r--r--tests/tlngamma.c68
-rw-r--r--tests/tlog.c270
-rw-r--r--tests/tlog10.c32
-rw-r--r--tests/tlog1p.c36
-rw-r--r--tests/tlog2.c24
-rw-r--r--tests/tminmax.c52
-rw-r--r--tests/tmodf.c26
-rw-r--r--tests/tmul.c250
-rw-r--r--tests/tmul_2exp.c42
-rw-r--r--tests/tmul_d.c20
-rw-r--r--tests/tmul_ui.c64
-rw-r--r--tests/tnext.c38
-rw-r--r--tests/tout_str.c46
-rw-r--r--tests/toutimpl.c18
-rw-r--r--tests/tpow.c416
-rw-r--r--tests/tpow3.c14
-rw-r--r--tests/tpow_all.c102
-rw-r--r--tests/tpow_z.c64
-rw-r--r--tests/tprintf.c4
-rw-r--r--tests/trandom.c2
-rw-r--r--tests/trec_sqrt.c36
-rw-r--r--tests/tremquo.c176
-rw-r--r--tests/trint.c90
-rw-r--r--tests/troot.c86
-rw-r--r--tests/tround_prec.c46
-rw-r--r--tests/tsec.c20
-rw-r--r--tests/tsech.c30
-rw-r--r--tests/tset.c36
-rw-r--r--tests/tset_d.c32
-rw-r--r--tests/tset_exp.c2
-rw-r--r--tests/tset_f.c52
-rw-r--r--tests/tset_ld.c40
-rw-r--r--tests/tset_q.c22
-rw-r--r--tests/tset_si.c142
-rw-r--r--tests/tset_sj.c34
-rw-r--r--tests/tset_str.c190
-rw-r--r--tests/tset_z.c16
-rw-r--r--tests/tsi_op.c34
-rw-r--r--tests/tsin.c106
-rw-r--r--tests/tsin_cos.c70
-rw-r--r--tests/tsinh.c18
-rw-r--r--tests/tsinh_cosh.c28
-rw-r--r--tests/tsprintf.c90
-rw-r--r--tests/tsqr.c18
-rw-r--r--tests/tsqrt.c308
-rw-r--r--tests/tsqrt_ui.c6
-rw-r--r--tests/tstckintc.c10
-rw-r--r--tests/tstrtofr.c304
-rw-r--r--tests/tsub.c98
-rw-r--r--tests/tsub1sp.c4
-rw-r--r--tests/tsub_d.c18
-rw-r--r--tests/tsub_ui.c10
-rw-r--r--tests/tsubnormal.c70
-rw-r--r--tests/tsum.c30
-rw-r--r--tests/tswap.c2
-rw-r--r--tests/ttan.c40
-rw-r--r--tests/ttanh.c20
-rw-r--r--tests/ttrunc.c10
-rw-r--r--tests/tui_div.c42
-rw-r--r--tests/tui_pow.c58
-rw-r--r--tests/tui_sub.c62
-rw-r--r--tests/ty0.c28
-rw-r--r--tests/ty1.c28
-rw-r--r--tests/tyn.c84
-rw-r--r--tests/tzeta.c84
-rw-r--r--tests/tzeta_ui.c16
-rw-r--r--tuneup.c4
-rw-r--r--ui_pow.c2
-rw-r--r--ui_pow_ui.c6
-rw-r--r--vasprintf.c80
-rw-r--r--yn.c110
-rw-r--r--zeta.c122
-rw-r--r--zeta_ui.c20
262 files changed, 5896 insertions, 5889 deletions
diff --git a/FAQ.html b/FAQ.html
index d9e55db74..042a3c05e 100644
--- a/FAQ.html
+++ b/FAQ.html
@@ -182,11 +182,11 @@ infinities, not-a-number (NaN).</p></li>
<cite><acronym>MPFR</acronym></cite>?</dt>
<dd><p>You need to add <q><code>r</code></q> to the function names, and to
-specify the rounding mode (<code>GMP_RNDN</code> for rounding to nearest,
-<code>GMP_RNDZ</code> for rounding towards zero, <code>GMP_RNDU</code>
-for rounding towards plus infinity, <code>GMP_RNDD</code> for rounding
+specify the rounding mode (<code>MPFR_RNDN</code> for rounding to nearest,
+<code>MPFR_RNDZ</code> for rounding towards zero, <code>MPFR_RNDU</code>
+for rounding towards plus infinity, <code>MPFR_RNDD</code> for rounding
towards minus infinity). You can also define macros as follows:
-<code class="block-code">#define mpf_add(a, b, c) mpfr_add(a, b, c, GMP_RNDN)</code></p>
+<code class="block-code">#define mpf_add(a, b, c) mpfr_add(a, b, c, MPFR_RNDN)</code></p>
<p>The header file <samp>mpf2mpfr.h</samp> from the
<cite><acronym>MPFR</acronym></cite> distribution automatically
redefines all <cite><acronym>MPF</acronym></cite> functions in this
@@ -282,7 +282,7 @@ in particular for most exact decimal numbers, such as 0.17, which are
not exactly representable in binary.</p>
<p>Also remember that <cite><acronym>MPFR</acronym></cite> does not track
the accuracy of the results: copying a value <var>x</var> to <var>y</var>
-with <code>mpfr_set (y, x, GMP_RNDN)</code> where the variable <var>y</var>
+with <code>mpfr_set (y, x, MPFR_RNDN)</code> where the variable <var>y</var>
is more precise than the variable <var>x</var> will not make it more
accurate; the (binary) value will remain unchanged.</p></dd>
diff --git a/NEWS b/NEWS
index d27b36424..464edd93b 100644
--- a/NEWS
+++ b/NEWS
@@ -21,7 +21,8 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
##############################################################################
Changes from versions 2.4.* to version 3.0:
-- a new rounding mode (GMP_RNDA) is available to round away from zero
+- rounding modes GMP_RNDX are now MPFR_RNDX (GMP_RNDX kept for compatibility)
+- a new rounding mode (MPFR_RNDA) is available to round away from zero
Changes from versions 2.3.* to version 2.4.0:
- MPFR is now a GNU package.
diff --git a/TODO b/TODO
index 988bb30d8..be3ff9d28 100644
--- a/TODO
+++ b/TODO
@@ -245,7 +245,7 @@ Table of contents:
Also mpfr_atan(x) seems slower (by a factor of 2) for x near from 1.
Example on a Athlon for 10^5 bits: x=1.1 takes 3s, whereas 2.1 takes 1.8s.
The current implementation does not give monotonous timing for the following:
- mpfr_random (x); for (i = 0; i < k; i++) mpfr_atan (y, x, GMP_RNDN);
+ mpfr_random (x); for (i = 0; i < k; i++) mpfr_atan (y, x, MPFR_RNDN);
for precision 300 and k=1000, we get 1070ms, and 500ms only for p=400!
- improve mpfr_sin on values like ~pi (do not compute sin from cos, because
of the cancellation). For instance, reduce the input modulo pi/2 in
diff --git a/acos.c b/acos.c
index d81eab289..434a0fd26 100644
--- a/acos.c
+++ b/acos.c
@@ -56,7 +56,7 @@ mpfr_acos (mpfr_ptr acos, mpfr_srcptr x, mp_rnd_t rnd_mode)
/* Set x_p=|x| */
sign = MPFR_SIGN (x);
mpfr_init2 (xp, MPFR_PREC (x));
- mpfr_abs (xp, x, GMP_RNDN); /* Exact */
+ mpfr_abs (xp, x, MPFR_RNDN); /* Exact */
compared = mpfr_cmp_ui (xp, 1);
@@ -80,7 +80,7 @@ mpfr_acos (mpfr_ptr acos, mpfr_srcptr x, mp_rnd_t rnd_mode)
MPFR_SAVE_EXPO_MARK (expo);
/* Compute the supplement */
- mpfr_ui_sub (xp, 1, xp, GMP_RNDD);
+ mpfr_ui_sub (xp, 1, xp, MPFR_RNDD);
if (MPFR_IS_POS_SIGN (sign))
supplement = 2 - 2 * MPFR_GET_EXP (xp);
else
@@ -113,14 +113,14 @@ mpfr_acos (mpfr_ptr acos, mpfr_srcptr x, mp_rnd_t rnd_mode)
for (;;)
{
/* acos(x) = Pi/2 - asin(x) = Pi/2 - atan(x/sqrt(1-x^2)) */
- mpfr_sqr (tmp, x, GMP_RNDN);
- mpfr_ui_sub (tmp, 1, tmp, GMP_RNDN);
- mpfr_sqrt (tmp, tmp, GMP_RNDN);
- mpfr_div (tmp, x, tmp, GMP_RNDN);
- mpfr_atan (arcc, tmp, GMP_RNDN);
- mpfr_const_pi (tmp, GMP_RNDN);
- mpfr_div_2ui (tmp, tmp, 1, GMP_RNDN);
- mpfr_sub (arcc, tmp, arcc, GMP_RNDN);
+ mpfr_sqr (tmp, x, MPFR_RNDN);
+ mpfr_ui_sub (tmp, 1, tmp, MPFR_RNDN);
+ mpfr_sqrt (tmp, tmp, MPFR_RNDN);
+ mpfr_div (tmp, x, tmp, MPFR_RNDN);
+ mpfr_atan (arcc, tmp, MPFR_RNDN);
+ mpfr_const_pi (tmp, MPFR_RNDN);
+ mpfr_div_2ui (tmp, tmp, 1, MPFR_RNDN);
+ mpfr_sub (arcc, tmp, arcc, MPFR_RNDN);
if (MPFR_LIKELY (MPFR_CAN_ROUND (arcc, prec-supplement,
MPFR_PREC (acos), rnd_mode)))
diff --git a/acosh.c b/acosh.c
index 106b526b6..ddc3ad9c2 100644
--- a/acosh.c
+++ b/acosh.c
@@ -90,7 +90,7 @@ mpfr_acosh (mpfr_ptr y, mpfr_srcptr x , mp_rnd_t rnd_mode)
MPFR_BLOCK_DECL (flags);
/* compute acosh */
- MPFR_BLOCK (flags, mpfr_mul (t, x, x, GMP_RNDD)); /* x^2 */
+ MPFR_BLOCK (flags, mpfr_mul (t, x, x, MPFR_RNDD)); /* x^2 */
if (MPFR_OVERFLOW (flags))
{
mpfr_t ln2;
@@ -100,35 +100,35 @@ mpfr_acosh (mpfr_ptr y, mpfr_srcptr x , mp_rnd_t rnd_mode)
assume that we obtain the same result by evaluating ln(2x).
We need to compute ln(x) + ln(2) as 2x can overflow. TODO:
write a proof and add an MPFR_ASSERTN. */
- mpfr_log (t, x, GMP_RNDN); /* err(log) < 1/2 ulp(t) */
+ mpfr_log (t, x, MPFR_RNDN); /* err(log) < 1/2 ulp(t) */
pln2 = Nt - MPFR_PREC_MIN < MPFR_GET_EXP (t) ?
MPFR_PREC_MIN : Nt - MPFR_GET_EXP (t);
mpfr_init2 (ln2, pln2);
- mpfr_const_log2 (ln2, GMP_RNDN); /* err(ln2) < 1/2 ulp(t) */
- mpfr_add (t, t, ln2, GMP_RNDN); /* err <= 3/2 ulp(t) */
+ mpfr_const_log2 (ln2, MPFR_RNDN); /* err(ln2) < 1/2 ulp(t) */
+ mpfr_add (t, t, ln2, MPFR_RNDN); /* err <= 3/2 ulp(t) */
mpfr_clear (ln2);
err = 1;
}
else
{
exp_te = MPFR_GET_EXP (t);
- mpfr_sub_ui (t, t, 1, GMP_RNDD); /* x^2-1 */
+ mpfr_sub_ui (t, t, 1, MPFR_RNDD); /* x^2-1 */
if (MPFR_UNLIKELY (MPFR_IS_ZERO (t)))
{
/* This means that x is very close to 1: x = 1 + t with
t < 2^(-Nt). We have: acosh(x) = sqrt(2t) (1 - eps(t))
with 0 < eps(t) < t / 12. */
- mpfr_sub_ui (t, x, 1, GMP_RNDD); /* t = x - 1 */
- mpfr_mul_2ui (t, t, 1, GMP_RNDN); /* 2t */
- mpfr_sqrt (t, t, GMP_RNDN); /* sqrt(2t) */
+ mpfr_sub_ui (t, x, 1, MPFR_RNDD); /* t = x - 1 */
+ mpfr_mul_2ui (t, t, 1, MPFR_RNDN); /* 2t */
+ mpfr_sqrt (t, t, MPFR_RNDN); /* sqrt(2t) */
err = 1;
}
else
{
d = exp_te - MPFR_GET_EXP (t);
- mpfr_sqrt (t, t, GMP_RNDN); /* sqrt(x^2-1) */
- mpfr_add (t, t, x, GMP_RNDN); /* sqrt(x^2-1)+x */
- mpfr_log (t, t, GMP_RNDN); /* ln(sqrt(x^2-1)+x) */
+ mpfr_sqrt (t, t, MPFR_RNDN); /* sqrt(x^2-1) */
+ mpfr_add (t, t, x, MPFR_RNDN); /* sqrt(x^2-1)+x */
+ mpfr_log (t, t, MPFR_RNDN); /* ln(sqrt(x^2-1)+x) */
/* error estimate -- see algorithms.tex */
err = 3 + MAX (1, d) - MPFR_GET_EXP (t);
diff --git a/add.c b/add.c
index 1cc8e9bff..a5729b6fa 100644
--- a/add.c
+++ b/add.c
@@ -65,7 +65,7 @@ mpfr_add (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mp_rnd_t rnd_mode)
as for round to zero or to nearest: it always gives +0,
except (-0) + (-0) = -0. */
MPFR_SET_SIGN(a,
- (rnd_mode != GMP_RNDD ?
+ (rnd_mode != MPFR_RNDD ?
((MPFR_IS_NEG(b) && MPFR_IS_NEG(c)) ? -1 : 1) :
((MPFR_IS_POS(b) && MPFR_IS_POS(c)) ? 1 : -1)));
MPFR_SET_ZERO(a);
diff --git a/add1.c b/add1.c
index 5e12ace01..195de5410 100644
--- a/add1.c
+++ b/add1.c
@@ -70,7 +70,7 @@ mpfr_add1 (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mp_rnd_t rnd_mode)
exp = MPFR_GET_EXP (b);
MPFR_SET_SAME_SIGN(a, b);
MPFR_UPDATE2_RND_MODE(rnd_mode, MPFR_SIGN(b));
- /* now rnd_mode is either GMP_RNDN, GMP_RNDZ or GMP_RNDA */
+ /* now rnd_mode is either MPFR_RNDN, MPFR_RNDZ or MPFR_RNDA */
diff_exp = (mp_exp_unsigned_t) exp - MPFR_GET_EXP(c);
/*
@@ -472,7 +472,7 @@ mpfr_add1 (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mp_rnd_t rnd_mode)
rounding:
switch (rnd_mode)
{
- case GMP_RNDN:
+ case MPFR_RNDN:
if (fb == 0)
{
if (rb == 0)
@@ -499,11 +499,11 @@ mpfr_add1 (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mp_rnd_t rnd_mode)
goto add_one_ulp;
}
- case GMP_RNDZ:
+ case MPFR_RNDZ:
inex = rb || fb ? (MPFR_IS_NEG(a) ? 1 : -1) : 0;
goto set_exponent;
- case GMP_RNDA:
+ case MPFR_RNDA:
inex = rb || fb ? (MPFR_IS_POS(a) ? 1 : -1) : 0;
if (inex)
goto add_one_ulp;
diff --git a/add1sp.c b/add1sp.c
index 1478e8c07..1e873eeb2 100644
--- a/add1sp.c
+++ b/add1sp.c
@@ -38,10 +38,10 @@ int mpfr_add1sp (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mp_rnd_t rnd_mode)
mpfr_init2 (tmpb, MPFR_PREC (b));
mpfr_init2 (tmpc, MPFR_PREC (c));
- inexb = mpfr_set (tmpb, b, GMP_RNDN);
+ inexb = mpfr_set (tmpb, b, MPFR_RNDN);
MPFR_ASSERTN (inexb == 0);
- inexc = mpfr_set (tmpc, c, GMP_RNDN);
+ inexc = mpfr_set (tmpc, c, MPFR_RNDN);
MPFR_ASSERTN (inexc == 0);
inexact2 = mpfr_add1 (tmpa, tmpb, tmpc, rnd_mode);
@@ -130,7 +130,7 @@ mpfr_add1sp (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mp_rnd_t rnd_mode)
/* Zero: Truncate
Nearest: Even Rule => truncate or add 1
Away: Add 1 */
- if (MPFR_LIKELY(rnd_mode==GMP_RNDN))
+ if (MPFR_LIKELY(rnd_mode==MPFR_RNDN))
{
if (MPFR_LIKELY((ap[0]&(MPFR_LIMB_ONE<<sh))==0))
{ inexact = -1; goto set_exponent; }
@@ -138,7 +138,7 @@ mpfr_add1sp (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mp_rnd_t rnd_mode)
goto add_one_ulp;
}
MPFR_UPDATE_RND_MODE(rnd_mode, MPFR_IS_NEG(b));
- if (rnd_mode==GMP_RNDZ)
+ if (rnd_mode==MPFR_RNDZ)
{ inexact = -1; goto set_exponent; }
else
goto add_one_ulp;
@@ -151,7 +151,7 @@ mpfr_add1sp (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mp_rnd_t rnd_mode)
/* Away: Add 1
Nearest: Trunc
Zero: Trunc */
- if (MPFR_LIKELY (rnd_mode==GMP_RNDN
+ if (MPFR_LIKELY (rnd_mode==MPFR_RNDN
|| MPFR_IS_LIKE_RNDZ (rnd_mode, MPFR_IS_NEG (b))))
{
copy_set_exponent:
@@ -174,7 +174,7 @@ mpfr_add1sp (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mp_rnd_t rnd_mode)
/* Away: Add 1
Nearest: Even Rule if C is a power of 2, else Add 1
Zero: Trunc */
- if (MPFR_LIKELY(rnd_mode==GMP_RNDN))
+ if (MPFR_LIKELY(rnd_mode==MPFR_RNDN))
{
/* Check if C was a power of 2 */
cp = MPFR_MANT(c);
@@ -331,7 +331,7 @@ mpfr_add1sp (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mp_rnd_t rnd_mode)
Nearest: Truncate but could be exact if Cp==0
Add 1 if C'p+1 !=0,
Even rule else */
- if (MPFR_LIKELY(rnd_mode == GMP_RNDN))
+ if (MPFR_LIKELY(rnd_mode == MPFR_RNDN))
{
if (MPFR_LIKELY(bcp == 0))
{ inexact = MPFR_LIKELY(bcp1) ? -1 : 0; goto set_exponent; }
@@ -341,7 +341,7 @@ mpfr_add1sp (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mp_rnd_t rnd_mode)
goto add_one_ulp;
}
MPFR_UPDATE_RND_MODE(rnd_mode, MPFR_IS_NEG(b));
- if (rnd_mode == GMP_RNDZ)
+ if (rnd_mode == MPFR_RNDZ)
{
inexact = MPFR_LIKELY(bcp || bcp1) ? -1 : 0;
goto set_exponent;
diff --git a/agm.c b/agm.c
index 555d7ebc7..fb5ac3d26 100644
--- a/agm.c
+++ b/agm.c
@@ -118,32 +118,32 @@ mpfr_agm (mpfr_ptr r, mpfr_srcptr op2, mpfr_srcptr op1, mp_rnd_t rnd_mode)
MPFR_TMP_INIT (tmpp, tmp, p, s);
/* Calculus of un and vn */
- mpfr_mul (u, op1, op2, GMP_RNDN); /* Faster since PREC(op) < PREC(u) */
- mpfr_sqrt (u, u, GMP_RNDN);
- mpfr_add (v, op1, op2, GMP_RNDN); /* add with !=prec is still good*/
- mpfr_div_2ui (v, v, 1, GMP_RNDN);
+ mpfr_mul (u, op1, op2, MPFR_RNDN); /* Faster since PREC(op) < PREC(u) */
+ mpfr_sqrt (u, u, MPFR_RNDN);
+ mpfr_add (v, op1, op2, MPFR_RNDN); /* add with !=prec is still good*/
+ mpfr_div_2ui (v, v, 1, MPFR_RNDN);
n = 1;
while (mpfr_cmp2 (u, v, &eq) != 0 && eq <= p - 2)
{
- mpfr_add (tmp, u, v, GMP_RNDN);
- mpfr_div_2ui (tmp, tmp, 1, GMP_RNDN);
+ mpfr_add (tmp, u, v, MPFR_RNDN);
+ mpfr_div_2ui (tmp, tmp, 1, MPFR_RNDN);
/* See proof in algorithms.tex */
if (4*eq > p)
{
mpfr_t w;
/* tmp = U(k) */
mpfr_init2 (w, (p + 1) / 2);
- mpfr_sub (w, v, u, GMP_RNDN); /* e = V(k-1)-U(k-1) */
- mpfr_sqr (w, w, GMP_RNDN); /* e = e^2 */
- mpfr_div_2ui (w, w, 4, GMP_RNDN); /* e*= (1/2)^2*1/4 */
- mpfr_div (w, w, tmp, GMP_RNDN); /* 1/4*e^2/U(k) */
- mpfr_sub (v, tmp, w, GMP_RNDN);
+ mpfr_sub (w, v, u, MPFR_RNDN); /* e = V(k-1)-U(k-1) */
+ mpfr_sqr (w, w, MPFR_RNDN); /* e = e^2 */
+ mpfr_div_2ui (w, w, 4, MPFR_RNDN); /* e*= (1/2)^2*1/4 */
+ mpfr_div (w, w, tmp, MPFR_RNDN); /* 1/4*e^2/U(k) */
+ mpfr_sub (v, tmp, w, MPFR_RNDN);
err = MPFR_GET_EXP (tmp) - MPFR_GET_EXP (v); /* 0 or 1 */
mpfr_clear (w);
break;
}
- mpfr_mul (u, u, v, GMP_RNDN);
- mpfr_sqrt (u, u, GMP_RNDN);
+ mpfr_mul (u, u, v, MPFR_RNDN);
+ mpfr_sqrt (u, u, MPFR_RNDN);
mpfr_swap (v, tmp);
n ++;
}
diff --git a/asin.c b/asin.c
index ae623245c..630a6f886 100644
--- a/asin.c
+++ b/asin.c
@@ -58,7 +58,7 @@ mpfr_asin (mpfr_ptr asin, mpfr_srcptr x, mp_rnd_t rnd_mode)
/* Set x_p=|x| (x is a normal number) */
mpfr_init2 (xp, MPFR_PREC (x));
- inexact = mpfr_abs (xp, x, GMP_RNDN);
+ inexact = mpfr_abs (xp, x, MPFR_RNDN);
MPFR_ASSERTD (inexact == 0);
compared = mpfr_cmp_ui (xp, 1);
@@ -88,7 +88,7 @@ mpfr_asin (mpfr_ptr asin, mpfr_srcptr x, mp_rnd_t rnd_mode)
MPFR_SAVE_EXPO_MARK (expo);
/* Compute exponent of 1 - ABS(x) */
- mpfr_ui_sub (xp, 1, xp, GMP_RNDD);
+ mpfr_ui_sub (xp, 1, xp, MPFR_RNDD);
MPFR_ASSERTD (MPFR_GET_EXP (xp) <= 0);
MPFR_ASSERTD (MPFR_GET_EXP (x) <= 0);
xp_exp = 2 - MPFR_GET_EXP (xp);
@@ -101,11 +101,11 @@ mpfr_asin (mpfr_ptr asin, mpfr_srcptr x, mp_rnd_t rnd_mode)
for (;;)
{
mpfr_set_prec (xp, prec);
- mpfr_sqr (xp, x, GMP_RNDN);
- mpfr_ui_sub (xp, 1, xp, GMP_RNDN);
- mpfr_sqrt (xp, xp, GMP_RNDN);
- mpfr_div (xp, x, xp, GMP_RNDN);
- mpfr_atan (xp, xp, GMP_RNDN);
+ mpfr_sqr (xp, x, MPFR_RNDN);
+ mpfr_ui_sub (xp, 1, xp, MPFR_RNDN);
+ mpfr_sqrt (xp, xp, MPFR_RNDN);
+ mpfr_div (xp, x, xp, MPFR_RNDN);
+ mpfr_atan (xp, xp, MPFR_RNDN);
if (MPFR_LIKELY (MPFR_CAN_ROUND (xp, prec - xp_exp,
MPFR_PREC (asin), rnd_mode)))
break;
diff --git a/asinh.c b/asinh.c
index 4b6e80762..82d2888f1 100644
--- a/asinh.c
+++ b/asinh.c
@@ -87,11 +87,11 @@ mpfr_asinh (mpfr_ptr y, mpfr_srcptr x, mp_rnd_t rnd_mode)
for (;;)
{
/* compute asinh */
- mpfr_mul (t, x, x, GMP_RNDD); /* x^2 */
- mpfr_add_ui (t, t, 1, GMP_RNDD); /* x^2+1 */
- mpfr_sqrt (t, t, GMP_RNDN); /* sqrt(x^2+1) */
- (neg ? mpfr_sub : mpfr_add) (t, t, x, GMP_RNDN); /* sqrt(x^2+1)+x */
- mpfr_log (t, t, GMP_RNDN); /* ln(sqrt(x^2+1)+x)*/
+ mpfr_mul (t, x, x, MPFR_RNDD); /* x^2 */
+ mpfr_add_ui (t, t, 1, MPFR_RNDD); /* x^2+1 */
+ mpfr_sqrt (t, t, MPFR_RNDN); /* sqrt(x^2+1) */
+ (neg ? mpfr_sub : mpfr_add) (t, t, x, MPFR_RNDN); /* sqrt(x^2+1)+x */
+ mpfr_log (t, t, MPFR_RNDN); /* ln(sqrt(x^2+1)+x)*/
if (MPFR_LIKELY (MPFR_IS_PURE_FP (t)))
{
diff --git a/atan.c b/atan.c
index debfdc94f..925ca5abf 100644
--- a/atan.c
+++ b/atan.c
@@ -41,7 +41,7 @@ mpfr_atan_aux (mpfr_ptr y, mpz_ptr p, long r, int m, mpz_t *tab)
if (mpz_cmp_ui (p, 0) == 0)
{
- mpfr_set_ui (y, 1, GMP_RNDN); /* limit(atan(x)/x, x=0) */
+ mpfr_set_ui (y, 1, MPFR_RNDN); /* limit(atan(x)/x, x=0) */
return;
}
@@ -181,7 +181,7 @@ mpfr_atan_aux (mpfr_ptr y, mpz_ptr p, long r, int m, mpz_t *tab)
mpz_mul_2exp (Q[0], Q[0], -diff);
mpz_tdiv_q (S[0], S[0], Q[0]);
- mpfr_set_z (y, S[0], GMP_RNDD);
+ mpfr_set_z (y, S[0], MPFR_RNDD);
MPFR_SET_EXP (y, MPFR_EXP(y) + expo - r * (i - 1));
}
@@ -310,9 +310,9 @@ mpfr_atan (mpfr_ptr atan, mpfr_srcptr x, mp_rnd_t rnd_mode)
}
if (comparaison > 0)
- mpfr_ui_div (sk, 1, xp, GMP_RNDN);
+ mpfr_ui_div (sk, 1, xp, MPFR_RNDN);
else
- mpfr_set (sk, xp, GMP_RNDN);
+ mpfr_set (sk, xp, MPFR_RNDN);
/* sk is 1/|x| if |x| > 1, and |x| otherwise, i.e. min(|x|, 1/|x|) */
@@ -330,7 +330,7 @@ mpfr_atan (mpfr_ptr atan, mpfr_srcptr x, mp_rnd_t rnd_mode)
if (MPFR_UNLIKELY (MPFR_IS_ZERO (sk)))
break;
/* Calculation of trunc(tmp) --> mpz */
- mpfr_mul_2ui (tmp, sk, twopoweri, GMP_RNDN);
+ mpfr_mul_2ui (tmp, sk, twopoweri, MPFR_RNDN);
mpfr_trunc (tmp, tmp);
if (!MPFR_IS_ZERO (tmp))
{
@@ -341,27 +341,27 @@ mpfr_atan (mpfr_ptr atan, mpfr_srcptr x, mp_rnd_t rnd_mode)
MPFR_ASSERTD (exptol < 0);
mpz_tdiv_q_2exp (ukz, ukz, (unsigned long int) (-exptol));
/* Calculation of arctan(Ak) */
- mpfr_set_z (tmp, ukz, GMP_RNDN);
- mpfr_div_2ui (tmp, tmp, twopoweri, GMP_RNDN);
+ mpfr_set_z (tmp, ukz, MPFR_RNDN);
+ mpfr_div_2ui (tmp, tmp, twopoweri, MPFR_RNDN);
mpfr_atan_aux (tmp2, ukz, twopoweri, n0 - i, tabz);
- mpfr_mul (tmp2, tmp2, tmp, GMP_RNDN);
+ mpfr_mul (tmp2, tmp2, tmp, MPFR_RNDN);
/* Addition */
- mpfr_add (arctgt, arctgt, tmp2, GMP_RNDN);
+ mpfr_add (arctgt, arctgt, tmp2, MPFR_RNDN);
/* Next iteration */
- mpfr_sub (tmp2, sk, tmp, GMP_RNDN);
- mpfr_mul (sk, sk, tmp, GMP_RNDN);
- mpfr_add_ui (sk, sk, 1, GMP_RNDN);
- mpfr_div (sk, tmp2, sk, GMP_RNDN);
+ mpfr_sub (tmp2, sk, tmp, MPFR_RNDN);
+ mpfr_mul (sk, sk, tmp, MPFR_RNDN);
+ mpfr_add_ui (sk, sk, 1, MPFR_RNDN);
+ mpfr_div (sk, tmp2, sk, MPFR_RNDN);
}
twopoweri <<= 1;
}
/* Add last step (Arctan(sk) ~= sk */
- mpfr_add (arctgt, arctgt, sk, GMP_RNDN);
+ mpfr_add (arctgt, arctgt, sk, MPFR_RNDN);
if (comparaison > 0)
{
- mpfr_const_pi (tmp, GMP_RNDN);
- mpfr_div_2ui (tmp, tmp, 1, GMP_RNDN);
- mpfr_sub (arctgt, tmp, arctgt, GMP_RNDN);
+ mpfr_const_pi (tmp, MPFR_RNDN);
+ mpfr_div_2ui (tmp, tmp, 1, MPFR_RNDN);
+ mpfr_sub (arctgt, tmp, arctgt, MPFR_RNDN);
}
MPFR_SET_POS (arctgt);
diff --git a/atan2.c b/atan2.c
index 92889fbff..feed91ed4 100644
--- a/atan2.c
+++ b/atan2.c
@@ -129,12 +129,12 @@ mpfr_atan2 (mpfr_ptr dest, mpfr_srcptr y, mpfr_srcptr x, mp_rnd_t rnd_mode)
MPFR_ZIV_INIT (loop2, prec2);
for (;;)
{
- mpfr_const_pi (tmp2, GMP_RNDN);
- mpfr_mul_ui (tmp2, tmp2, 3, GMP_RNDN); /* Error <= 2 */
- mpfr_div_2ui (tmp2, tmp2, 2, GMP_RNDN);
+ mpfr_const_pi (tmp2, MPFR_RNDN);
+ mpfr_mul_ui (tmp2, tmp2, 3, MPFR_RNDN); /* Error <= 2 */
+ mpfr_div_2ui (tmp2, tmp2, 2, MPFR_RNDN);
if (mpfr_round_p (MPFR_MANT (tmp2), MPFR_LIMB_SIZE (tmp2),
MPFR_PREC (tmp2) - 2,
- MPFR_PREC (dest) + (rnd_mode == GMP_RNDN)))
+ MPFR_PREC (dest) + (rnd_mode == MPFR_RNDN)))
break;
MPFR_ZIV_NEXT (loop2, prec2);
mpfr_set_prec (tmp2, prec2);
@@ -173,7 +173,7 @@ mpfr_atan2 (mpfr_ptr dest, mpfr_srcptr y, mpfr_srcptr x, mp_rnd_t rnd_mode)
int div_inex;
MPFR_BLOCK_DECL (flags);
- MPFR_BLOCK (flags, div_inex = mpfr_div (tmp, y, x, GMP_RNDN));
+ MPFR_BLOCK (flags, div_inex = mpfr_div (tmp, y, x, MPFR_RNDN));
if (div_inex == 0)
{
/* Result is exact. */
@@ -189,7 +189,7 @@ mpfr_atan2 (mpfr_ptr dest, mpfr_srcptr y, mpfr_srcptr x, mp_rnd_t rnd_mode)
{
int sign;
- /* In the case GMP_RNDN with 2^(emin-2) < |y/x| < 2^(emin-1):
+ /* In the case MPFR_RNDN with 2^(emin-2) < |y/x| < 2^(emin-1):
The smallest significand value S > 1 of |y/x| is:
* 1 / (1 - 2^(-px)) if py <= px,
* (1 - 2^(-px) + 2^(-py)) / (1 - 2^(-px)) if py >= px.
@@ -198,20 +198,20 @@ mpfr_atan2 (mpfr_ptr dest, mpfr_srcptr y, mpfr_srcptr x, mp_rnd_t rnd_mode)
> z - z^3 / 3.
> 2^(emin-2) * (1 + 2^(-pz) - 2^(2 emin - 5))
Assuming pz <= -2 emin + 5, we can round away from zero
- (this is what mpfr_underflow always does on GMP_RNDN).
- In the case GMP_RNDN with |y/x| <= 2^(emin-2), we round
+ (this is what mpfr_underflow always does on MPFR_RNDN).
+ In the case MPFR_RNDN with |y/x| <= 2^(emin-2), we round
towards zero, as |atan(z)/z| < 1. */
MPFR_ASSERTN (MPFR_PREC_MAX <=
2 * (mpfr_uexp_t) - MPFR_EMIN_MIN + 5);
- if (rnd_mode == GMP_RNDN && MPFR_IS_ZERO (tmp))
- rnd_mode = GMP_RNDZ;
+ if (rnd_mode == MPFR_RNDN && MPFR_IS_ZERO (tmp))
+ rnd_mode = MPFR_RNDZ;
sign = MPFR_SIGN (tmp);
mpfr_clear (tmp);
MPFR_SAVE_EXPO_FREE (expo);
return mpfr_underflow (dest, rnd_mode, sign);
}
- mpfr_atan (tmp, tmp, GMP_RNDN); /* Error <= 2*ulp (tmp) since
+ mpfr_atan (tmp, tmp, MPFR_RNDN); /* Error <= 2*ulp (tmp) since
abs(D(arctan)) <= 1 */
/* TODO: check that the error bound is correct in case of overflow. */
/* FIXME: Error <= ulp(tmp) ? */
@@ -227,15 +227,15 @@ mpfr_atan2 (mpfr_ptr dest, mpfr_srcptr y, mpfr_srcptr x, mp_rnd_t rnd_mode)
mpfr_init2 (pi, prec);
for (;;)
{
- mpfr_div (tmp, y, x, GMP_RNDN); /* Error <= ulp (tmp) */
+ mpfr_div (tmp, y, x, MPFR_RNDN); /* Error <= ulp (tmp) */
/* If tmp is 0, we have |y/x| <= 2^(-emin-2), thus
atan|y/x| < 2^(-emin-2). */
MPFR_SET_POS (tmp); /* no error */
- mpfr_atan (tmp, tmp, GMP_RNDN); /* Error <= 2*ulp (tmp) since
+ mpfr_atan (tmp, tmp, MPFR_RNDN); /* Error <= 2*ulp (tmp) since
abs(D(arctan)) <= 1 */
- mpfr_const_pi (pi, GMP_RNDN); /* Error <= ulp(pi) /2 */
+ mpfr_const_pi (pi, MPFR_RNDN); /* Error <= ulp(pi) /2 */
e = MPFR_NOTZERO(tmp) ? MPFR_GET_EXP (tmp) : __gmpfr_emin - 1;
- mpfr_sub (tmp, pi, tmp, GMP_RNDN); /* see above */
+ mpfr_sub (tmp, pi, tmp, MPFR_RNDN); /* see above */
if (MPFR_IS_NEG (y))
MPFR_CHANGE_SIGN (tmp);
/* Error(tmp) <= (1/2+2^(EXP(pi)-EXP(tmp)-1)+2^(e-EXP(tmp)+1))*ulp
diff --git a/atanh.c b/atanh.c
index a13b3e061..1a80424d4 100644
--- a/atanh.c
+++ b/atanh.c
@@ -94,11 +94,11 @@ mpfr_atanh (mpfr_ptr y, mpfr_srcptr xt , mp_rnd_t rnd_mode)
for (;;)
{
/* compute atanh */
- mpfr_ui_sub (te, 1, x, GMP_RNDU); /* (1-xt)*/
- mpfr_add_ui (t, x, 1, GMP_RNDD); /* (xt+1)*/
- mpfr_div (t, t, te, GMP_RNDN); /* (1+xt)/(1-xt)*/
- mpfr_log (t, t, GMP_RNDN); /* ln((1+xt)/(1-xt))*/
- mpfr_div_2ui (t, t, 1, GMP_RNDN); /* (1/2)*ln((1+xt)/(1-xt))*/
+ mpfr_ui_sub (te, 1, x, MPFR_RNDU); /* (1-xt)*/
+ mpfr_add_ui (t, x, 1, MPFR_RNDD); /* (xt+1)*/
+ mpfr_div (t, t, te, MPFR_RNDN); /* (1+xt)/(1-xt)*/
+ mpfr_log (t, t, MPFR_RNDN); /* ln((1+xt)/(1-xt))*/
+ mpfr_div_2ui (t, t, 1, MPFR_RNDN); /* (1/2)*ln((1+xt)/(1-xt))*/
/* error estimate: see algorithms.tex */
/* FIXME: this does not correspond to the value in algorithms.tex!!! */
diff --git a/cache.c b/cache.c
index 5031f2a68..732eb6145 100644
--- a/cache.c
+++ b/cache.c
@@ -58,8 +58,8 @@ mpfr_cache (mpfr_ptr dest, mpfr_cache_t cache, mp_rnd_t rnd)
/* Update the cache. */
pold = prec;
- mpfr_prec_round (cache->x, pold, GMP_RNDN);
- cache->inexact = (*cache->func) (cache->x, GMP_RNDN);
+ mpfr_prec_round (cache->x, pold, MPFR_RNDN);
+ cache->inexact = (*cache->func) (cache->x, MPFR_RNDN);
/* we assume all cached constants are positive */
MPFR_ASSERTN(MPFR_IS_POS(cache->x));
}
@@ -99,8 +99,8 @@ mpfr_cache (mpfr_ptr dest, mpfr_cache_t cache, mp_rnd_t rnd)
{
switch (rnd)
{
- case GMP_RNDZ:
- case GMP_RNDD:
+ case MPFR_RNDZ:
+ case MPFR_RNDD:
if (MPFR_UNLIKELY (inexact == 0))
{
inexact = cache->inexact;
@@ -108,8 +108,8 @@ mpfr_cache (mpfr_ptr dest, mpfr_cache_t cache, mp_rnd_t rnd)
mpfr_nextbelow (dest);
}
break;
- case GMP_RNDU:
- case GMP_RNDA:
+ case MPFR_RNDU:
+ case MPFR_RNDA:
if (MPFR_UNLIKELY (inexact == 0))
{
inexact = cache->inexact;
@@ -117,7 +117,7 @@ mpfr_cache (mpfr_ptr dest, mpfr_cache_t cache, mp_rnd_t rnd)
mpfr_nextabove (dest);
}
break;
- default: /* GMP_RNDN */
+ default: /* MPFR_RNDN */
if (MPFR_UNLIKELY(inexact == 0))
inexact = cache->inexact;
break;
diff --git a/cbrt.c b/cbrt.c
index fdc19bee6..9f425aa21 100644
--- a/cbrt.c
+++ b/cbrt.c
@@ -87,7 +87,7 @@ mpfr_cbrt (mpfr_ptr y, mpfr_srcptr x, mp_rnd_t rnd_mode)
/* x = (m*2^r) * 2^(e-r) = (m*2^r) * 2^(3*q) */
MPFR_MPZ_SIZEINBASE2 (size_m, m);
- n = MPFR_PREC (y) + (rnd_mode == GMP_RNDN);
+ n = MPFR_PREC (y) + (rnd_mode == MPFR_RNDN);
/* we want 3*n-2 <= size_m + 3*sh + r <= 3*n
i.e. 3*sh + size_m + r <= 3*n */
@@ -123,8 +123,8 @@ mpfr_cbrt (mpfr_ptr y, mpfr_srcptr x, mp_rnd_t rnd_mode)
{
if (negative)
rnd_mode = MPFR_INVERT_RND (rnd_mode);
- if (rnd_mode == GMP_RNDU || rnd_mode == GMP_RNDA
- || (rnd_mode == GMP_RNDN && mpz_tstbit (m, 0)))
+ if (rnd_mode == MPFR_RNDU || rnd_mode == MPFR_RNDA
+ || (rnd_mode == MPFR_RNDN && mpz_tstbit (m, 0)))
inexact = 1, mpz_add_ui (m, m, 1);
else
inexact = -1;
@@ -132,8 +132,8 @@ mpfr_cbrt (mpfr_ptr y, mpfr_srcptr x, mp_rnd_t rnd_mode)
/* either inexact is not zero, and the conversion is exact, i.e. inexact
is not changed; or inexact=0, and inexact is set only when
- rnd_mode=GMP_RNDN and bit (n+1) from m is 1 */
- inexact += mpfr_set_z (y, m, GMP_RNDN);
+ rnd_mode=MPFR_RNDN and bit (n+1) from m is 1 */
+ inexact += mpfr_set_z (y, m, MPFR_RNDN);
MPFR_SET_EXP (y, MPFR_GET_EXP (y) + e / 3);
if (negative)
diff --git a/cmp_d.c b/cmp_d.c
index 5546f2f20..ce02be6fa 100644
--- a/cmp_d.c
+++ b/cmp_d.c
@@ -29,7 +29,7 @@ mpfr_cmp_d (mpfr_srcptr b, double d)
int res;
mpfr_init2 (tmp, IEEE_DBL_MANT_DIG);
- res = mpfr_set_d (tmp, d, GMP_RNDN);
+ res = mpfr_set_d (tmp, d, MPFR_RNDN);
MPFR_ASSERTD (res == 0);
res = mpfr_cmp (b, tmp);
mpfr_clear (tmp);
diff --git a/cmp_ld.c b/cmp_ld.c
index 1569834c9..b170e6bfc 100644
--- a/cmp_ld.c
+++ b/cmp_ld.c
@@ -29,7 +29,7 @@ mpfr_cmp_ld (mpfr_srcptr b, long double d)
int res;
mpfr_init2 (tmp, MPFR_LDBL_MANT_DIG);
- res = mpfr_set_ld (tmp, d, GMP_RNDN);
+ res = mpfr_set_ld (tmp, d, MPFR_RNDN);
MPFR_ASSERTD (res == 0);
res = mpfr_cmp (b, tmp);
mpfr_clear (tmp);
diff --git a/const_catalan.c b/const_catalan.c
index 231098030..93d58ed9a 100644
--- a/const_catalan.c
+++ b/const_catalan.c
@@ -122,18 +122,18 @@ mpfr_const_catalan_internal (mpfr_ptr g, mp_rnd_t rnd_mode)
MPFR_ZIV_INIT (loop, p);
for (;;) {
- mpfr_sqrt_ui (x, 3, GMP_RNDU);
- mpfr_add_ui (x, x, 2, GMP_RNDU);
- mpfr_log (x, x, GMP_RNDU);
- mpfr_const_pi (y, GMP_RNDU);
- mpfr_mul (x, x, y, GMP_RNDN);
+ mpfr_sqrt_ui (x, 3, MPFR_RNDU);
+ mpfr_add_ui (x, x, 2, MPFR_RNDU);
+ mpfr_log (x, x, MPFR_RNDU);
+ mpfr_const_pi (y, MPFR_RNDU);
+ mpfr_mul (x, x, y, MPFR_RNDN);
S (T, P, Q, 0, (p - 1) / 2);
mpz_mul_ui (T, T, 3);
- mpfr_set_z (y, T, GMP_RNDU);
- mpfr_set_z (z, Q, GMP_RNDD);
- mpfr_div (y, y, z, GMP_RNDN);
- mpfr_add (x, x, y, GMP_RNDN);
- mpfr_div_2ui (x, x, 3, GMP_RNDN);
+ mpfr_set_z (y, T, MPFR_RNDU);
+ mpfr_set_z (z, Q, MPFR_RNDD);
+ mpfr_div (y, y, z, MPFR_RNDN);
+ mpfr_add (x, x, y, MPFR_RNDN);
+ mpfr_div_2ui (x, x, 3, MPFR_RNDN);
if (MPFR_LIKELY (MPFR_CAN_ROUND (x, p - 5, pg, rnd_mode)))
break;
diff --git a/const_euler.c b/const_euler.c
index 5617b4fff..cfb7871cc 100644
--- a/const_euler.c
+++ b/const_euler.c
@@ -61,9 +61,9 @@ mpfr_const_euler_internal (mpfr_t x, mp_rnd_t rnd)
MPFR_ASSERTD (n >= 9);
mpfr_const_euler_S2 (y, n); /* error <= 3 ulps */
exp_S = MPFR_EXP(y);
- mpfr_set_ui (z, n, GMP_RNDN);
- mpfr_log (z, z, GMP_RNDD); /* error <= 1 ulp */
- mpfr_sub (y, y, z, GMP_RNDN); /* S'(n) - log(n) */
+ mpfr_set_ui (z, n, MPFR_RNDN);
+ mpfr_log (z, z, MPFR_RNDD); /* error <= 1 ulp */
+ mpfr_sub (y, y, z, MPFR_RNDN); /* S'(n) - log(n) */
/* the error is less than 1/2 + 3*2^(exp_S-EXP(y)) + 2^(EXP(z)-EXP(y))
<= 1/2 + 2^(exp_S+2-EXP(y)) + 2^(EXP(z)-EXP(y))
<= 1/2 + 2^(1+MAX(exp_S+2,EXP(z))-EXP(y)) */
@@ -71,7 +71,7 @@ mpfr_const_euler_internal (mpfr_t x, mp_rnd_t rnd)
err = (err >= -1) ? err + 1 : 0; /* error <= 2^err ulp(y) */
exp_S = MPFR_EXP(y);
mpfr_const_euler_R (z, n); /* err <= ulp(1/2) = 2^(-m) */
- mpfr_sub (y, y, z, GMP_RNDN);
+ mpfr_sub (y, y, z, MPFR_RNDN);
/* err <= 1/2 ulp(y) + 2^(-m) + 2^(err + exp_S - EXP(y)) ulp(y).
Since the result is between 0.5 and 1, ulp(y) = 2^(-m).
So we get 3/2*ulp(y) + 2^(err + exp_S - EXP(y)) ulp(y).
@@ -160,8 +160,8 @@ mpfr_const_euler_S2 (mpfr_t x, unsigned long n)
mpz_init (Q);
mpz_init (T);
mpfr_const_euler_S2_aux (P, Q, T, n, 1, N + 1, 0);
- mpfr_set_z (x, T, GMP_RNDN);
- mpfr_div_z (x, x, Q, GMP_RNDN);
+ mpfr_set_z (x, T, MPFR_RNDN);
+ mpfr_div_z (x, x, Q, MPFR_RNDN);
mpz_clear (P);
mpz_clear (Q);
mpz_clear (T);
@@ -201,15 +201,15 @@ mpfr_const_euler_R (mpfr_t x, unsigned long n)
/* the error on s is at most 1+2+...+n = n*(n+1)/2 */
mpz_div_ui (s, s, n); /* err <= 1 + (n+1)/2 */
MPFR_ASSERTN (MPFR_PREC(x) >= mpz_sizeinbase(s, 2));
- mpfr_set_z (x, s, GMP_RNDD); /* exact */
- mpfr_div_2ui (x, x, m, GMP_RNDD);
+ mpfr_set_z (x, s, MPFR_RNDD); /* exact */
+ mpfr_div_2ui (x, x, m, MPFR_RNDD);
/* now x = 1/n * sum(k!/(-n)^k, k=0..n-2) <= 1/n */
/* err(x) <= (n+1)/2^m <= (n+1)*exp(n)/2^PREC(x) */
mpfr_init2 (y, m);
- mpfr_set_si (y, -(long)n, GMP_RNDD); /* assumed exact */
- mpfr_exp (y, y, GMP_RNDD); /* err <= ulp(y) <= exp(-n)*2^(1-m) */
- mpfr_mul (x, x, y, GMP_RNDD);
+ mpfr_set_si (y, -(long)n, MPFR_RNDD); /* assumed exact */
+ mpfr_exp (y, y, MPFR_RNDD); /* err <= ulp(y) <= exp(-n)*2^(1-m) */
+ mpfr_mul (x, x, y, MPFR_RNDD);
/* err <= ulp(x) + (n + 1 + 2/n) / 2^prec(x)
<= ulp(x) + (n + 1 + 2/n) ulp(x)/x since x*2^(-prec(x)) < ulp(x)
<= ulp(x) + (n + 1 + 2/n) 3/(2n) ulp(x) since x >= 2/3*n for n >= 2
diff --git a/const_log2.c b/const_log2.c
index e4b01ebaf..19f1a2a11 100644
--- a/const_log2.c
+++ b/const_log2.c
@@ -163,9 +163,9 @@ mpfr_const_log2_internal (mpfr_ptr x, mp_rnd_t rnd_mode)
mpfr_set_prec (t, w);
mpfr_set_prec (q, w);
- mpfr_set_z (t, T[0], GMP_RNDN);
- mpfr_set_z (q, Q[0], GMP_RNDN);
- mpfr_div (t, t, q, GMP_RNDN);
+ mpfr_set_z (t, T[0], MPFR_RNDN);
+ mpfr_set_z (q, Q[0], MPFR_RNDN);
+ mpfr_div (t, t, q, MPFR_RNDN);
for (i = 0; i < lgN; i++)
{
@@ -176,7 +176,7 @@ mpfr_const_log2_internal (mpfr_ptr x, mp_rnd_t rnd_mode)
(*__gmp_free_func) (T, 3 * lgN * sizeof (mpz_t));
if (MPFR_LIKELY (ok != 0
- || mpfr_can_round (t, w - 2, GMP_RNDN, rnd_mode, n)))
+ || mpfr_can_round (t, w - 2, MPFR_RNDN, rnd_mode, n)))
break;
MPFR_ZIV_NEXT (loop, w);
diff --git a/const_pi.c b/const_pi.c
index 00e1ca1b7..e59e07215 100644
--- a/const_pi.c
+++ b/const_pi.c
@@ -58,10 +58,10 @@ mpfr_const_pi_internal (mpfr_ptr x, mp_rnd_t rnd_mode)
MPFR_ZIV_INIT (loop, p);
for (;;) {
- mpfr_set_ui (a, 1, GMP_RNDN); /* a = 1 */
- mpfr_set_ui (A, 1, GMP_RNDN); /* A = a^2 = 1 */
- mpfr_set_ui_2exp (B, 1, -1, GMP_RNDN); /* B = b^2 = 1/2 */
- mpfr_set_ui_2exp (D, 1, -2, GMP_RNDN); /* D = 1/4 */
+ mpfr_set_ui (a, 1, MPFR_RNDN); /* a = 1 */
+ mpfr_set_ui (A, 1, MPFR_RNDN); /* A = a^2 = 1 */
+ mpfr_set_ui_2exp (B, 1, -1, MPFR_RNDN); /* B = b^2 = 1/2 */
+ mpfr_set_ui_2exp (D, 1, -2, MPFR_RNDN); /* D = 1/4 */
#define b B
#define ap a
@@ -70,20 +70,20 @@ mpfr_const_pi_internal (mpfr_ptr x, mp_rnd_t rnd_mode)
for (k = 0, cancel = 0; ; k++)
{
/* invariant: 1/2 <= B <= A <= a < 1 */
- mpfr_add (S, A, B, GMP_RNDN); /* 1 <= S <= 2 */
- mpfr_div_2ui (S, S, 2, GMP_RNDN); /* exact, 1/4 <= S <= 1/2 */
- mpfr_sqrt (b, B, GMP_RNDN); /* 1/2 <= b <= 1 */
- mpfr_add (ap, a, b, GMP_RNDN); /* 1 <= ap <= 2 */
- mpfr_div_2ui (ap, ap, 1, GMP_RNDN); /* exact, 1/2 <= ap <= 1 */
- mpfr_mul (Ap, ap, ap, GMP_RNDN); /* 1/4 <= Ap <= 1 */
- mpfr_sub (Bp, Ap, S, GMP_RNDN); /* -1/4 <= Bp <= 3/4 */
- mpfr_mul_2ui (Bp, Bp, 1, GMP_RNDN); /* -1/2 <= Bp <= 3/2 */
- mpfr_sub (S, Ap, Bp, GMP_RNDN);
+ mpfr_add (S, A, B, MPFR_RNDN); /* 1 <= S <= 2 */
+ mpfr_div_2ui (S, S, 2, MPFR_RNDN); /* exact, 1/4 <= S <= 1/2 */
+ mpfr_sqrt (b, B, MPFR_RNDN); /* 1/2 <= b <= 1 */
+ mpfr_add (ap, a, b, MPFR_RNDN); /* 1 <= ap <= 2 */
+ mpfr_div_2ui (ap, ap, 1, MPFR_RNDN); /* exact, 1/2 <= ap <= 1 */
+ mpfr_mul (Ap, ap, ap, MPFR_RNDN); /* 1/4 <= Ap <= 1 */
+ mpfr_sub (Bp, Ap, S, MPFR_RNDN); /* -1/4 <= Bp <= 3/4 */
+ mpfr_mul_2ui (Bp, Bp, 1, MPFR_RNDN); /* -1/2 <= Bp <= 3/2 */
+ mpfr_sub (S, Ap, Bp, MPFR_RNDN);
MPFR_ASSERTN (mpfr_cmp_ui (S, 1) < 0);
cancel = mpfr_cmp_ui (S, 0) ? (mpfr_uexp_t) -mpfr_get_exp(S) : p;
/* MPFR_ASSERTN (cancel >= px || cancel >= 9 * (1 << k) - 4); */
- mpfr_mul_2ui (S, S, k, GMP_RNDN);
- mpfr_sub (D, D, S, GMP_RNDN);
+ mpfr_mul_2ui (S, S, k, MPFR_RNDN);
+ mpfr_sub (D, D, S, MPFR_RNDN);
/* stop when |A_k - B_k| <= 2^(k-p) i.e. cancel >= p-k */
if (cancel + k >= p)
break;
@@ -93,7 +93,7 @@ mpfr_const_pi_internal (mpfr_ptr x, mp_rnd_t rnd_mode)
#undef Ap
#undef Bp
- mpfr_div (A, B, D, GMP_RNDN);
+ mpfr_div (A, B, D, MPFR_RNDN);
/* MPFR_ASSERTN(p >= 2 * k + 8); */
if (MPFR_LIKELY (MPFR_CAN_ROUND (A, p - 2 * k - 8, px, rnd_mode)))
diff --git a/cos.c b/cos.c
index 5e801d977..8ad73ee07 100644
--- a/cos.c
+++ b/cos.c
@@ -106,8 +106,8 @@ mpfr_cos2_aux (mpfr_ptr f, mpfr_srcptr r)
mpz_add (s, s, t);
}
- mpfr_set_z (f, s, GMP_RNDN);
- mpfr_div_2ui (f, f, p + q, GMP_RNDN);
+ mpfr_set_z (f, s, MPFR_RNDN);
+ mpfr_div_2ui (f, f, p + q, MPFR_RNDN);
mpz_clear (x);
mpz_clear (s);
@@ -179,14 +179,14 @@ mpfr_cos (mpfr_ptr y, mpfr_srcptr x, mp_rnd_t rnd_mode)
It follows |cos(xr) - cos(x)| <= 2^(2-m). */
if (reduce)
{
- mpfr_const_pi (c, GMP_RNDN);
- mpfr_mul_2ui (c, c, 1, GMP_RNDN); /* 2Pi */
- mpfr_remainder (xr, x, c, GMP_RNDN);
+ mpfr_const_pi (c, MPFR_RNDN);
+ mpfr_mul_2ui (c, c, 1, MPFR_RNDN); /* 2Pi */
+ mpfr_remainder (xr, x, c, MPFR_RNDN);
/* now |xr| <= 4, thus r <= 16 below */
- mpfr_mul (r, xr, xr, GMP_RNDU); /* err <= 1 ulp */
+ mpfr_mul (r, xr, xr, MPFR_RNDU); /* err <= 1 ulp */
}
else
- mpfr_mul (r, x, x, GMP_RNDU); /* err <= 1 ulp */
+ mpfr_mul (r, x, x, MPFR_RNDU); /* err <= 1 ulp */
/* now |x| < 4 (or xr if reduce = 1), thus |r| <= 16 */
@@ -204,9 +204,9 @@ mpfr_cos (mpfr_ptr y, mpfr_srcptr x, mp_rnd_t rnd_mode)
MPFR_SET_ONE (r);
for (k = 0; k < K; k++)
{
- mpfr_sqr (s, s, GMP_RNDU); /* err <= 2*olderr */
+ mpfr_sqr (s, s, MPFR_RNDU); /* err <= 2*olderr */
MPFR_SET_EXP (s, MPFR_GET_EXP (s) + 1); /* Can't overflow */
- mpfr_sub (s, s, r, GMP_RNDN); /* err <= 4*olderr */
+ mpfr_sub (s, s, r, MPFR_RNDN); /* err <= 4*olderr */
if (MPFR_IS_ZERO(s))
goto ziv_next;
MPFR_ASSERTD (MPFR_GET_EXP (s) <= 1);
@@ -233,7 +233,7 @@ mpfr_cos (mpfr_ptr y, mpfr_srcptr x, mp_rnd_t rnd_mode)
than 2^(-precy) for directed rounding, or 2^(-precy-1) for rounding
to nearest. */
{
- if (m > k && (m - k >= precy + (rnd_mode == GMP_RNDN)))
+ if (m > k && (m - k >= precy + (rnd_mode == MPFR_RNDN)))
{
/* If round to nearest or away, result is s = 1 or -1,
otherwise it is round(nexttoward (s, 0)). However in order to
diff --git a/cosh.c b/cosh.c
index f93d9b20d..8ef515939 100644
--- a/cosh.c
+++ b/cosh.c
@@ -90,7 +90,7 @@ mpfr_cosh (mpfr_ptr y, mpfr_srcptr xt , mp_rnd_t rnd_mode)
MPFR_BLOCK_DECL (flags);
/* Compute cosh */
- MPFR_BLOCK (flags, mpfr_exp (te, x, GMP_RNDD)); /* exp(x) */
+ MPFR_BLOCK (flags, mpfr_exp (te, x, MPFR_RNDD)); /* exp(x) */
/* exp can overflow (but not underflow since x>0) */
if (MPFR_OVERFLOW (flags))
/* cosh(x) > exp(x), cosh(x) underflows too */
@@ -99,9 +99,9 @@ mpfr_cosh (mpfr_ptr y, mpfr_srcptr xt , mp_rnd_t rnd_mode)
MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, MPFR_FLAGS_OVERFLOW);
break;
}
- mpfr_ui_div (t, 1, te, GMP_RNDU); /* 1/exp(x) */
- mpfr_add (t, te, t, GMP_RNDU); /* exp(x) + 1/exp(x)*/
- mpfr_div_2ui (t, t, 1, GMP_RNDN); /* 1/2(exp(x) + 1/exp(x))*/
+ mpfr_ui_div (t, 1, te, MPFR_RNDU); /* 1/exp(x) */
+ mpfr_add (t, te, t, MPFR_RNDU); /* exp(x) + 1/exp(x)*/
+ mpfr_div_2ui (t, t, 1, MPFR_RNDN); /* 1/2(exp(x) + 1/exp(x))*/
/* Estimation of the error */
err = Nt - 3;
diff --git a/cot.c b/cot.c
index 9d844470a..edea6b6fa 100644
--- a/cot.c
+++ b/cot.c
@@ -60,20 +60,20 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
{ \
/* Case |x| = 2^emin. 1/x is not representable; so, compute \
1/(2x) instead (exact), and correct the result later. */ \
- mpfr_set_si_2exp (y, signx, __gmpfr_emax, GMP_RNDN); \
+ mpfr_set_si_2exp (y, signx, __gmpfr_emax, MPFR_RNDN); \
inexact = 0; \
} \
else \
inexact = mpfr_ui_div (y, 1, x, r); \
if (inexact == 0) /* x is a power of two */ \
{ /* result always 1/x, except when rounding to zero */ \
- if (rnd_mode == GMP_RNDU || (rnd_mode == GMP_RNDZ && signx < 0)) \
+ if (rnd_mode == MPFR_RNDU || (rnd_mode == MPFR_RNDZ && signx < 0)) \
{ \
if (signx < 0) \
mpfr_nextabove (y); /* -2^k + epsilon */ \
inexact = 1; \
} \
- else if (rnd_mode == GMP_RNDD || rnd_mode == GMP_RNDZ) \
+ else if (rnd_mode == MPFR_RNDD || rnd_mode == MPFR_RNDZ) \
{ \
if (signx > 0) \
mpfr_nextbelow (y); /* 2^k - epsilon */ \
@@ -82,7 +82,7 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
else /* round to nearest */ \
inexact = signx; \
if (two2emin) \
- mpfr_mul_2ui (y, y, 1, r); /* overflow in GMP_RNDN */ \
+ mpfr_mul_2ui (y, y, 1, r); /* overflow in MPFR_RNDN */ \
} \
/* Underflow is not possible with emin = - emax, but we cannot */ \
/* add an assert as the underflow flag could have already been */ \
diff --git a/coth.c b/coth.c
index ddd27ac1a..3222d7c17 100644
--- a/coth.c
+++ b/coth.c
@@ -42,10 +42,10 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
if (MPFR_GET_EXP(z) == 1) /* 1 <= |z| < 2 */ \
{ \
/* the following is exact by Sterbenz theorem */ \
- mpfr_sub_si (z, z, MPFR_SIGN(z) > 0 ? 1 : -1, GMP_RNDN); \
+ mpfr_sub_si (z, z, MPFR_SIGN(z) > 0 ? 1 : -1, MPFR_RNDN); \
if (MPFR_IS_ZERO(z) || MPFR_GET_EXP(z) <= - (mp_exp_t) precy) \
{ \
- mpfr_add_si (z, z, MPFR_SIGN(z) > 0 ? 1 : -1, GMP_RNDN); \
+ mpfr_add_si (z, z, MPFR_SIGN(z) > 0 ? 1 : -1, MPFR_RNDN); \
break; \
} \
}
@@ -69,13 +69,13 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
inexact = mpfr_ui_div (y, 1, x, r); \
if (inexact == 0) /* x is a power of two */ \
{ /* result always 1/x, except when rounding away from zero */ \
- if (rnd_mode == GMP_RNDU) \
+ if (rnd_mode == MPFR_RNDU) \
{ \
if (signx > 0) \
mpfr_nextabove (y); /* 2^k + epsilon */ \
inexact = 1; \
} \
- else if (rnd_mode == GMP_RNDD) \
+ else if (rnd_mode == MPFR_RNDD) \
{ \
if (signx < 0) \
mpfr_nextbelow (y); /* -2^k - epsilon */ \
diff --git a/csc.c b/csc.c
index f4755f102..7bfe305dd 100644
--- a/csc.c
+++ b/csc.c
@@ -52,13 +52,13 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
inexact = mpfr_ui_div (y, 1, x, r); \
if (inexact == 0) /* x is a power of two */ \
{ /* result always 1/x, except when rounding away from zero */ \
- if (rnd_mode == GMP_RNDU) \
+ if (rnd_mode == MPFR_RNDU) \
{ \
if (signx > 0) \
mpfr_nextabove (y); /* 2^k + epsilon */ \
inexact = 1; \
} \
- else if (rnd_mode == GMP_RNDD) \
+ else if (rnd_mode == MPFR_RNDD) \
{ \
if (signx < 0) \
mpfr_nextbelow (y); /* -2^k - epsilon */ \
diff --git a/csch.c b/csch.c
index 1c972c82c..5ecdf5790 100644
--- a/csch.c
+++ b/csch.c
@@ -55,13 +55,13 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
inexact = mpfr_ui_div (y, 1, x, r); \
if (inexact == 0) /* x is a power of two */ \
{ /* result always 1/x, except when rounding to zero */ \
- if (rnd_mode == GMP_RNDU || (rnd_mode == GMP_RNDZ && signx < 0)) \
+ if (rnd_mode == MPFR_RNDU || (rnd_mode == MPFR_RNDZ && signx < 0)) \
{ \
if (signx < 0) \
mpfr_nextabove (y); /* -2^k + epsilon */ \
inexact = 1; \
} \
- else if (rnd_mode == GMP_RNDD || rnd_mode == GMP_RNDZ) \
+ else if (rnd_mode == MPFR_RNDD || rnd_mode == MPFR_RNDZ) \
{ \
if (signx > 0) \
mpfr_nextbelow (y); /* 2^k - epsilon */ \
diff --git a/div.c b/div.c
index 4161d1a0e..f7dd1d323 100644
--- a/div.c
+++ b/div.c
@@ -259,7 +259,7 @@ mpfr_div (mpfr_ptr q, mpfr_srcptr u, mpfr_srcptr v, mp_rnd_t rnd_mode)
MPFR_UNSIGNED_MINUS_MODULO(sh, MPFR_PREC(q));
- if (MPFR_UNLIKELY(rnd_mode == GMP_RNDN && sh == 0))
+ if (MPFR_UNLIKELY(rnd_mode == MPFR_RNDN && sh == 0))
{ /* we compute the quotient with one more limb, in order to get
the round bit in the quotient, and the remainder only contains
sticky bits */
@@ -343,7 +343,7 @@ mpfr_div (mpfr_ptr q, mpfr_srcptr u, mpfr_srcptr v, mp_rnd_t rnd_mode)
sticky3 = qp[0] & MPFR_LIMB_MASK(sh); /* does nothing when sh=0 */
sh2 = sh;
}
- else /* qsize = q0size + 1: only happens when rnd_mode=GMP_RNDN and sh=0 */
+ else /* qsize = q0size + 1: only happens when rnd_mode=MPFR_RNDN and sh=0 */
{
MPN_COPY (q0p, qp + 1, q0size);
sticky3 = qp[0];
@@ -359,8 +359,8 @@ mpfr_div (mpfr_ptr q, mpfr_srcptr u, mpfr_srcptr v, mp_rnd_t rnd_mode)
(unsigned long) sticky, (unsigned long) sticky3, inex);
#endif
- like_rndz = rnd_mode == GMP_RNDZ ||
- rnd_mode == (sign_quotient < 0 ? GMP_RNDU : GMP_RNDD);
+ like_rndz = rnd_mode == MPFR_RNDZ ||
+ rnd_mode == (sign_quotient < 0 ? MPFR_RNDU : MPFR_RNDD);
/* to round, we distinguish two cases:
(a) vsize <= qsize: we used the full divisor
@@ -373,7 +373,7 @@ mpfr_div (mpfr_ptr q, mpfr_srcptr u, mpfr_srcptr v, mp_rnd_t rnd_mode)
#endif
if (MPFR_LIKELY(vsize <= qsize)) /* use the full divisor */
{
- if (MPFR_LIKELY(rnd_mode == GMP_RNDN))
+ if (MPFR_LIKELY(rnd_mode == MPFR_RNDN))
{
round_bit = sticky3 & (MPFR_LIMB_ONE << (sh2 - 1));
sticky = (sticky3 ^ round_bit) | sticky_u;
@@ -399,7 +399,7 @@ mpfr_div (mpfr_ptr q, mpfr_srcptr u, mpfr_srcptr v, mp_rnd_t rnd_mode)
inexact flag for 000...000 or 000...001.)
*/
mp_limb_t sticky3orig = sticky3;
- if (rnd_mode == GMP_RNDN)
+ if (rnd_mode == MPFR_RNDN)
{
round_bit = sticky3 & (MPFR_LIMB_ONE << (sh2 - 1));
sticky3 = sticky3 ^ round_bit;
@@ -520,7 +520,7 @@ mpfr_div (mpfr_ptr q, mpfr_srcptr u, mpfr_srcptr v, mp_rnd_t rnd_mode)
{ /* round_bit=0, sticky3=0: q1-1 is exact only
when sh=0 */
inex = (cmp_s_r || sh) ? -1 : 0;
- if (rnd_mode == GMP_RNDN ||
+ if (rnd_mode == MPFR_RNDN ||
(! like_rndz && inex != 0))
{
inex = 1;
@@ -537,10 +537,10 @@ mpfr_div (mpfr_ptr q, mpfr_srcptr u, mpfr_srcptr v, mp_rnd_t rnd_mode)
}
else /* q1-2 < u/v < q1-1 */
{
- /* if rnd=GMP_RNDN, the result is q1 when
+ /* if rnd=MPFR_RNDN, the result is q1 when
q1-2 >= q1-2^(sh-1), i.e. sh >= 2,
otherwise (sh=1) it is q1-2 */
- if (rnd_mode == GMP_RNDN) /* sh > 0 */
+ if (rnd_mode == MPFR_RNDN) /* sh > 0 */
{
/* Case sh=1: sb=0 always, and q1-rb is exactly
representable, like q1-rb-2.
@@ -608,7 +608,7 @@ mpfr_div (mpfr_ptr q, mpfr_srcptr u, mpfr_srcptr v, mp_rnd_t rnd_mode)
inex = round_bit == MPFR_LIMB_ZERO && sticky == MPFR_LIMB_ZERO ? 0 : -1;
goto truncate;
}
- else if (rnd_mode == GMP_RNDN) /* sticky <> 0 or round <> 0 */
+ else if (rnd_mode == MPFR_RNDN) /* sticky <> 0 or round <> 0 */
{
if (round_bit == MPFR_LIMB_ZERO) /* necessarily sticky <> 0 */
{
@@ -665,9 +665,9 @@ mpfr_div (mpfr_ptr q, mpfr_srcptr u, mpfr_srcptr v, mp_rnd_t rnd_mode)
return mpfr_overflow (q, rnd_mode, sign_quotient);
else if (MPFR_UNLIKELY(qexp < __gmpfr_emin))
{
- if (rnd_mode == GMP_RNDN && ((qexp < __gmpfr_emin - 1) ||
+ if (rnd_mode == MPFR_RNDN && ((qexp < __gmpfr_emin - 1) ||
(inex >= 0 && mpfr_powerof2_raw (q))))
- rnd_mode = GMP_RNDZ;
+ rnd_mode = MPFR_RNDZ;
return mpfr_underflow (q, rnd_mode, sign_quotient);
}
MPFR_SET_EXP(q, qexp);
diff --git a/div_2si.c b/div_2si.c
index 55ba0fd42..80eb3d77e 100644
--- a/div_2si.c
+++ b/div_2si.c
@@ -38,11 +38,11 @@ mpfr_div_2si (mpfr_ptr y, mpfr_srcptr x, long int n, mp_rnd_t rnd_mode)
if (MPFR_UNLIKELY( n > 0 && (__gmpfr_emin > MPFR_EMAX_MAX - n ||
exp < __gmpfr_emin + n)) )
{
- if (rnd_mode == GMP_RNDN &&
+ if (rnd_mode == MPFR_RNDN &&
(__gmpfr_emin > MPFR_EMAX_MAX - (n - 1) ||
exp < __gmpfr_emin + (n - 1) ||
(inexact >= 0 && mpfr_powerof2_raw (y))))
- rnd_mode = GMP_RNDZ;
+ rnd_mode = MPFR_RNDZ;
return mpfr_underflow (y, rnd_mode, MPFR_SIGN(y));
}
diff --git a/div_2ui.c b/div_2ui.c
index 8de8a5ffe..cc4bfc09d 100644
--- a/div_2ui.c
+++ b/div_2ui.c
@@ -55,11 +55,11 @@ mpfr_div_2ui (mpfr_ptr y, mpfr_srcptr x, unsigned long n, mp_rnd_t rnd_mode)
if (MPFR_UNLIKELY( __gmpfr_emin > MPFR_EMAX_MAX - (long) n ||
exp < __gmpfr_emin + (long) n) )
{
- if (rnd_mode == GMP_RNDN &&
+ if (rnd_mode == MPFR_RNDN &&
(__gmpfr_emin > MPFR_EMAX_MAX - (long) (n - 1) ||
exp < __gmpfr_emin + (long) (n - 1) ||
(inexact >= 0 && mpfr_powerof2_raw (y))))
- rnd_mode = GMP_RNDZ;
+ rnd_mode = MPFR_RNDZ;
return mpfr_underflow (y, rnd_mode, MPFR_SIGN(y));
}
diff --git a/div_ui.c b/div_ui.c
index 62eb99801..001ffdf0c 100644
--- a/div_ui.c
+++ b/div_ui.c
@@ -112,7 +112,7 @@ mpfr_div_ui (mpfr_ptr y, mpfr_srcptr x, unsigned long int u, mp_rnd_t rnd_mode)
* the divisor. The test must be performed with a subtraction, so as *
* to prevent carries. */
- if (MPFR_LIKELY (rnd_mode == GMP_RNDN))
+ if (MPFR_LIKELY (rnd_mode == MPFR_RNDN))
{
if (c < (mp_limb_t) u - c) /* We have u > c */
middle = -1;
@@ -185,7 +185,7 @@ mpfr_div_ui (mpfr_ptr y, mpfr_srcptr x, unsigned long int u, mp_rnd_t rnd_mode)
MPFR_TMP_FREE (marker);
if (exp < __gmpfr_emin - 1)
- return mpfr_underflow (y, rnd_mode == GMP_RNDN ? GMP_RNDZ : rnd_mode,
+ return mpfr_underflow (y, rnd_mode == MPFR_RNDN ? MPFR_RNDZ : rnd_mode,
MPFR_SIGN (y));
if (MPFR_UNLIKELY (d == 0 && inexact == 0))
@@ -195,18 +195,18 @@ mpfr_div_ui (mpfr_ptr y, mpfr_srcptr x, unsigned long int u, mp_rnd_t rnd_mode)
MPFR_UPDATE2_RND_MODE(rnd_mode, MPFR_SIGN (y));
switch (rnd_mode)
{
- case GMP_RNDZ:
+ case MPFR_RNDZ:
inexact = - MPFR_INT_SIGN (y); /* result is inexact */
nexttoinf = 0;
break;
- case GMP_RNDA:
+ case MPFR_RNDA:
inexact = MPFR_INT_SIGN (y);
nexttoinf = 1;
break;
- default: /* should be GMP_RNDN */
- MPFR_ASSERTD (rnd_mode == GMP_RNDN);
+ default: /* should be MPFR_RNDN */
+ MPFR_ASSERTD (rnd_mode == MPFR_RNDN);
/* We have one more significant bit in yn. */
if (sh && d < (MPFR_LIMB_ONE << (sh - 1)))
{
diff --git a/eint.c b/eint.c
index 3170cccfb..5c75a7a62 100644
--- a/eint.c
+++ b/eint.c
@@ -50,7 +50,7 @@ mpfr_eint_aux (mpfr_t y, mpfr_srcptr x)
if (MPFR_GET_EXP(x) <= - (mp_exp_t) w)
{
- mpfr_set (y, x, GMP_RNDN);
+ mpfr_set (y, x, MPFR_RNDN);
return 0;
}
@@ -74,8 +74,8 @@ mpfr_eint_aux (mpfr_t y, mpfr_srcptr x)
/* initialize t to 2^w */
mpz_set_ui (t, 1);
mpz_mul_2exp (t, t, w);
- mpfr_set_ui (eps, 0, GMP_RNDN); /* eps[0] = 0 */
- mpfr_set_ui (errs, 0, GMP_RNDN);
+ mpfr_set_ui (eps, 0, MPFR_RNDN); /* eps[0] = 0 */
+ mpfr_set_ui (errs, 0, MPFR_RNDN);
for (k = 1;; k++)
{
/* let eps[k] be the absolute error on t[k]:
@@ -83,12 +83,12 @@ mpfr_eint_aux (mpfr_t y, mpfr_srcptr x)
eps[k+1] <= 1 + eps[k-1]*m*2^e/k + t[k-1]*m*2^(1-w)*2^e/k
= 1 + (eps[k-1] + t[k-1]*2^(1-w))*m*2^e/k
= 1 + (eps[k-1]*2^(w-1) + t[k-1])*2^(1-w)*m*2^e/k */
- mpfr_mul_2ui (eps, eps, w - 1, GMP_RNDU);
- mpfr_add_z (eps, eps, t, GMP_RNDU);
+ mpfr_mul_2ui (eps, eps, w - 1, MPFR_RNDU);
+ mpfr_add_z (eps, eps, t, MPFR_RNDU);
MPFR_MPZ_SIZEINBASE2 (sizeinbase, m);
- mpfr_mul_2si (eps, eps, sizeinbase - (w - 1) + e, GMP_RNDU);
- mpfr_div_ui (eps, eps, k, GMP_RNDU);
- mpfr_add_ui (eps, eps, 1, GMP_RNDU);
+ mpfr_mul_2si (eps, eps, sizeinbase - (w - 1) + e, MPFR_RNDU);
+ mpfr_div_ui (eps, eps, k, MPFR_RNDU);
+ mpfr_add_ui (eps, eps, 1, MPFR_RNDU);
mpz_mul (t, t, m);
if (e < 0)
mpz_tdiv_q_2exp (t, t, -e);
@@ -98,10 +98,10 @@ mpfr_eint_aux (mpfr_t y, mpfr_srcptr x)
mpz_tdiv_q_ui (u, t, k);
mpz_add (s, s, u);
/* the absolute error on u is <= 1 + eps[k]/k */
- mpfr_div_ui (erru, eps, k, GMP_RNDU);
- mpfr_add_ui (erru, erru, 1, GMP_RNDU);
+ mpfr_div_ui (erru, eps, k, MPFR_RNDU);
+ mpfr_add_ui (erru, erru, 1, MPFR_RNDU);
/* and that on s is the sum of all errors on u */
- mpfr_add (errs, errs, erru, GMP_RNDU);
+ mpfr_add (errs, errs, erru, MPFR_RNDU);
/* we are done when t is smaller than errs */
if (mpz_sgn (t) == 0)
sizeinbase = 0;
@@ -113,11 +113,11 @@ mpfr_eint_aux (mpfr_t y, mpfr_srcptr x)
/* the truncation error is bounded by (|t|+eps)/k*(|x|/k + |x|^2/k^2 + ...)
<= (|t|+eps)/k*|x|/(k-|x|) */
mpz_abs (t, t);
- mpfr_add_z (eps, eps, t, GMP_RNDU);
- mpfr_div_ui (eps, eps, k, GMP_RNDU);
- mpfr_abs (erru, x, GMP_RNDU); /* |x| */
- mpfr_mul (eps, eps, erru, GMP_RNDU);
- mpfr_ui_sub (erru, k, erru, GMP_RNDD);
+ mpfr_add_z (eps, eps, t, MPFR_RNDU);
+ mpfr_div_ui (eps, eps, k, MPFR_RNDU);
+ mpfr_abs (erru, x, MPFR_RNDU); /* |x| */
+ mpfr_mul (eps, eps, erru, MPFR_RNDU);
+ mpfr_ui_sub (erru, k, erru, MPFR_RNDD);
if (MPFR_IS_NEG (erru))
{
/* the truncated series does not converge, return fail */
@@ -125,10 +125,10 @@ mpfr_eint_aux (mpfr_t y, mpfr_srcptr x)
}
else
{
- mpfr_div (eps, eps, erru, GMP_RNDU);
- mpfr_add (errs, errs, eps, GMP_RNDU);
- mpfr_set_z (y, s, GMP_RNDN);
- mpfr_div_2ui (y, y, w, GMP_RNDN);
+ mpfr_div (eps, eps, erru, MPFR_RNDU);
+ mpfr_add (errs, errs, eps, MPFR_RNDU);
+ mpfr_set_z (y, s, MPFR_RNDN);
+ mpfr_div_2ui (y, y, w, MPFR_RNDN);
/* errs was an absolute error bound on s. We must convert it to an error
in terms of ulp(y). Since ulp(y) = 2^(EXP(y)-PREC(y)), we must
divide the error by 2^(EXP(y)-PREC(y)), but since we divided also
@@ -159,30 +159,30 @@ mpfr_eint_asympt (mpfr_ptr y, mpfr_srcptr x)
mpfr_init2 (t, p);
mpfr_init2 (invx, p);
mpfr_init2 (err, 31); /* error in ulps on y */
- mpfr_ui_div (invx, 1, x, GMP_RNDN); /* invx = 1/x*(1+u) with |u|<=2^(1-p) */
- mpfr_set_ui (t, 1, GMP_RNDN); /* exact */
- mpfr_set (y, t, GMP_RNDN);
- mpfr_set_ui (err, 0, GMP_RNDN);
+ mpfr_ui_div (invx, 1, x, MPFR_RNDN); /* invx = 1/x*(1+u) with |u|<=2^(1-p) */
+ mpfr_set_ui (t, 1, MPFR_RNDN); /* exact */
+ mpfr_set (y, t, MPFR_RNDN);
+ mpfr_set_ui (err, 0, MPFR_RNDN);
for (k = 1; MPFR_GET_EXP(t) + (mp_exp_t) p > MPFR_GET_EXP(y); k++)
{
- mpfr_mul (t, t, invx, GMP_RNDN); /* 2 more roundings */
- mpfr_mul_ui (t, t, k, GMP_RNDN); /* 1 more rounding: t = k!/x^k*(1+u)^e
+ mpfr_mul (t, t, invx, MPFR_RNDN); /* 2 more roundings */
+ mpfr_mul_ui (t, t, k, MPFR_RNDN); /* 1 more rounding: t = k!/x^k*(1+u)^e
with u=2^{-p} and |e| <= 3*k */
/* we use the fact that |(1+u)^n-1| <= 2*|n*u| for |n*u| <= 1, thus
the error on t is less than 6*k*2^{-p}*t <= 6*k*ulp(t) */
/* err is in terms of ulp(y): transform it in terms of ulp(t) */
- mpfr_mul_2si (err, err, MPFR_GET_EXP(y) - MPFR_GET_EXP(t), GMP_RNDU);
- mpfr_add_ui (err, err, 6 * k, GMP_RNDU);
+ mpfr_mul_2si (err, err, MPFR_GET_EXP(y) - MPFR_GET_EXP(t), MPFR_RNDU);
+ mpfr_add_ui (err, err, 6 * k, MPFR_RNDU);
/* transform back in terms of ulp(y) */
- mpfr_div_2si (err, err, MPFR_GET_EXP(y) - MPFR_GET_EXP(t), GMP_RNDU);
- mpfr_add (y, y, t, GMP_RNDN);
+ mpfr_div_2si (err, err, MPFR_GET_EXP(y) - MPFR_GET_EXP(t), MPFR_RNDU);
+ mpfr_add (y, y, t, MPFR_RNDN);
}
/* add the truncation error bounded by ulp(y): 1 ulp */
- mpfr_mul (y, y, invx, GMP_RNDN); /* err <= 2*err + 3/2 */
- mpfr_exp (t, x, GMP_RNDN); /* err(t) <= 1/2*ulp(t) */
- mpfr_mul (y, y, t, GMP_RNDN); /* again: err <= 2*err + 3/2 */
- mpfr_mul_2ui (err, err, 2, GMP_RNDU);
- mpfr_add_ui (err, err, 8, GMP_RNDU);
+ mpfr_mul (y, y, invx, MPFR_RNDN); /* err <= 2*err + 3/2 */
+ mpfr_exp (t, x, MPFR_RNDN); /* err(t) <= 1/2*ulp(t) */
+ mpfr_mul (y, y, t, MPFR_RNDN); /* again: err <= 2*err + 3/2 */
+ mpfr_mul_2ui (err, err, 2, MPFR_RNDU);
+ mpfr_add_ui (err, err, 8, MPFR_RNDU);
err_exp = MPFR_GET_EXP(err);
mpfr_clear (t);
mpfr_clear (invx);
@@ -240,10 +240,10 @@ mpfr_eint (mpfr_ptr y, mpfr_srcptr x, mp_rnd_t rnd)
then log2(eint(x)) >= emax, and eint(x) >= 2^emax, i.e. it overflows. */
mpfr_init2 (tmp, 64);
mpfr_init2 (ump, 64);
- mpfr_log (tmp, x, GMP_RNDU);
- mpfr_sub (ump, x, tmp, GMP_RNDD);
- mpfr_const_log2 (tmp, GMP_RNDU);
- mpfr_div (ump, ump, tmp, GMP_RNDD);
+ mpfr_log (tmp, x, MPFR_RNDU);
+ mpfr_sub (ump, x, tmp, MPFR_RNDD);
+ mpfr_const_log2 (tmp, MPFR_RNDU);
+ mpfr_div (ump, ump, tmp, MPFR_RNDD);
/* FIXME: We really need mpfr_set_exp_t and mpfr_cmp_exp_t functions. */
MPFR_ASSERTN (MPFR_EMAX_MAX <= LONG_MAX);
if (mpfr_cmp_ui (ump, __gmpfr_emax) >= 0)
@@ -262,7 +262,7 @@ mpfr_eint (mpfr_ptr y, mpfr_srcptr x, mp_rnd_t rnd)
if (MPFR_GET_EXP(x) == -1) /* 1/4 <= x < 1/2 */
{
double d;
- d = mpfr_get_d (x, GMP_RNDN) - 0.37250741078136663;
+ d = mpfr_get_d (x, MPFR_RNDN) - 0.37250741078136663;
d = (d == 0.0) ? -53 : __gmpfr_ceil_log2 (d);
prec += -d;
}
@@ -283,16 +283,16 @@ mpfr_eint (mpfr_ptr y, mpfr_srcptr x, mp_rnd_t rnd)
{
err = mpfr_eint_aux (tmp, x); /* error <= 2^err ulp(tmp) */
te = MPFR_GET_EXP(tmp);
- mpfr_const_euler (ump, GMP_RNDN); /* 0.577 -> EXP(ump)=0 */
- mpfr_add (tmp, tmp, ump, GMP_RNDN);
+ mpfr_const_euler (ump, MPFR_RNDN); /* 0.577 -> EXP(ump)=0 */
+ mpfr_add (tmp, tmp, ump, MPFR_RNDN);
/* error <= 1/2 + 1/2*2^(EXP(ump)-EXP(tmp)) + 2^(te-EXP(tmp)+err)
<= 1/2 + 2^(MAX(EXP(ump), te+err+1) - EXP(tmp))
<= 2^(MAX(0, 1 + MAX(EXP(ump), te+err+1) - EXP(tmp))) */
err = MAX(1, te + err + 2) - MPFR_GET_EXP(tmp);
err = MAX(0, err);
te = MPFR_GET_EXP(tmp);
- mpfr_log (ump, x, GMP_RNDN);
- mpfr_add (tmp, tmp, ump, GMP_RNDN);
+ mpfr_log (ump, x, MPFR_RNDN);
+ mpfr_add (tmp, tmp, ump, MPFR_RNDN);
/* same formula as above, except now EXP(ump) is not 0 */
err += te + 1;
if (MPFR_LIKELY (!MPFR_IS_ZERO (ump)))
diff --git a/erf.c b/erf.c
index 0964f11f1..caca26052 100644
--- a/erf.c
+++ b/erf.c
@@ -45,11 +45,11 @@ mpfr_erf (mpfr_ptr y, mpfr_srcptr x, mp_rnd_t rnd_mode)
MPFR_RET_NAN;
}
else if (MPFR_IS_INF (x)) /* erf(+inf) = +1, erf(-inf) = -1 */
- return mpfr_set_si (y, MPFR_INT_SIGN (x), GMP_RNDN);
+ return mpfr_set_si (y, MPFR_INT_SIGN (x), MPFR_RNDN);
else /* erf(+0) = +0, erf(-0) = -0 */
{
MPFR_ASSERTD (MPFR_IS_ZERO (x));
- return mpfr_set (y, x, GMP_RNDN); /* should keep the sign of x */
+ return mpfr_set (y, x, MPFR_RNDN); /* should keep the sign of x */
}
}
@@ -78,21 +78,21 @@ mpfr_erf (mpfr_ptr y, mpfr_srcptr x, mp_rnd_t rnd_mode)
mpfr_init2 (l, MPFR_PREC(y) + 17);
mpfr_init2 (h, MPFR_PREC(y) + 17);
/* first compute l */
- mpfr_mul (l, x, x, GMP_RNDU);
- mpfr_div_ui (l, l, 3, GMP_RNDU); /* upper bound on x^2/3 */
- mpfr_ui_sub (l, 1, l, GMP_RNDZ); /* lower bound on 1 - x^2/3 */
- mpfr_const_pi (h, GMP_RNDU); /* upper bound of Pi */
- mpfr_sqrt (h, h, GMP_RNDU); /* upper bound on sqrt(Pi) */
- mpfr_div (l, l, h, GMP_RNDZ); /* lower bound on 1/sqrt(Pi) (1 - x^2/3) */
- mpfr_mul_2ui (l, l, 1, GMP_RNDZ); /* 2/sqrt(Pi) (1 - x^2/3) */
- mpfr_mul (l, l, x, GMP_RNDZ); /* |l| is a lower bound on
+ mpfr_mul (l, x, x, MPFR_RNDU);
+ mpfr_div_ui (l, l, 3, MPFR_RNDU); /* upper bound on x^2/3 */
+ mpfr_ui_sub (l, 1, l, MPFR_RNDZ); /* lower bound on 1 - x^2/3 */
+ mpfr_const_pi (h, MPFR_RNDU); /* upper bound of Pi */
+ mpfr_sqrt (h, h, MPFR_RNDU); /* upper bound on sqrt(Pi) */
+ mpfr_div (l, l, h, MPFR_RNDZ); /* lower bound on 1/sqrt(Pi) (1 - x^2/3) */
+ mpfr_mul_2ui (l, l, 1, MPFR_RNDZ); /* 2/sqrt(Pi) (1 - x^2/3) */
+ mpfr_mul (l, l, x, MPFR_RNDZ); /* |l| is a lower bound on
|2x/sqrt(Pi) (1 - x^2/3)| */
/* now compute h */
- mpfr_const_pi (h, GMP_RNDD); /* lower bound on Pi */
- mpfr_sqrt (h, h, GMP_RNDD); /* lower bound on sqrt(Pi) */
- mpfr_div_2ui (h, h, 1, GMP_RNDD); /* lower bound on sqrt(Pi)/2 */
+ mpfr_const_pi (h, MPFR_RNDD); /* lower bound on Pi */
+ mpfr_sqrt (h, h, MPFR_RNDD); /* lower bound on sqrt(Pi) */
+ mpfr_div_2ui (h, h, 1, MPFR_RNDD); /* lower bound on sqrt(Pi)/2 */
/* since sqrt(Pi)/2 < 1, the following should not underflow */
- mpfr_div (h, x, h, MPFR_IS_POS(x) ? GMP_RNDU : GMP_RNDD);
+ mpfr_div (h, x, h, MPFR_IS_POS(x) ? MPFR_RNDU : MPFR_RNDD);
/* round l and h to precision PREC(y) */
inex = mpfr_prec_round (l, MPFR_PREC(y), rnd_mode);
inex2 = mpfr_prec_round (h, MPFR_PREC(y), rnd_mode);
@@ -110,10 +110,10 @@ mpfr_erf (mpfr_ptr y, mpfr_srcptr x, mp_rnd_t rnd_mode)
}
mpfr_init2 (xf, 53);
- mpfr_const_log2 (xf, GMP_RNDU);
- mpfr_div (xf, x, xf, GMP_RNDZ); /* round to zero ensures we get a lower
+ mpfr_const_log2 (xf, MPFR_RNDU);
+ mpfr_div (xf, x, xf, MPFR_RNDZ); /* round to zero ensures we get a lower
bound of |x/log(2)| */
- mpfr_mul (xf, xf, x, GMP_RNDZ);
+ mpfr_mul (xf, xf, x, MPFR_RNDZ);
large = mpfr_cmp_ui (xf, MPFR_PREC (y) + 1) > 0;
mpfr_clear (xf);
@@ -125,7 +125,7 @@ mpfr_erf (mpfr_ptr y, mpfr_srcptr x, mp_rnd_t rnd_mode)
/* |erf x| = 1 or 1- */
{
mp_rnd_t rnd2 = MPFR_IS_POS (x) ? rnd_mode : MPFR_INVERT_RND(rnd_mode);
- if (rnd2 == GMP_RNDN || rnd2 == GMP_RNDU || rnd2 == GMP_RNDA)
+ if (rnd2 == MPFR_RNDN || rnd2 == MPFR_RNDU || rnd2 == MPFR_RNDA)
{
inex = MPFR_INT_SIGN (x);
mpfr_set_si (y, inex, rnd2);
@@ -142,7 +142,7 @@ mpfr_erf (mpfr_ptr y, mpfr_srcptr x, mp_rnd_t rnd_mode)
double xf2;
/* FIXME: get rid of doubles/mpfr_get_d here */
- xf2 = mpfr_get_d (x, GMP_RNDN);
+ xf2 = mpfr_get_d (x, MPFR_RNDN);
xf2 = xf2 * xf2; /* xf2 ~ x^2 */
inex = mpfr_erf_0 (y, x, xf2, rnd_mode);
}
@@ -202,21 +202,21 @@ mpfr_erf_0 (mpfr_ptr res, mpfr_srcptr x, double xf2, mp_rnd_t rnd_mode)
MPFR_ZIV_INIT (loop, m);
for (;;)
{
- mpfr_mul (y, x, x, GMP_RNDU); /* err <= 1 ulp */
- mpfr_set_ui (s, 1, GMP_RNDN);
- mpfr_set_ui (t, 1, GMP_RNDN);
+ mpfr_mul (y, x, x, MPFR_RNDU); /* err <= 1 ulp */
+ mpfr_set_ui (s, 1, MPFR_RNDN);
+ mpfr_set_ui (t, 1, MPFR_RNDN);
tauk = 0.0;
for (k = 1; ; k++)
{
- mpfr_mul (t, y, t, GMP_RNDU);
- mpfr_div_ui (t, t, k, GMP_RNDU);
- mpfr_div_ui (u, t, 2 * k + 1, GMP_RNDU);
+ mpfr_mul (t, y, t, MPFR_RNDU);
+ mpfr_div_ui (t, t, k, MPFR_RNDU);
+ mpfr_div_ui (u, t, 2 * k + 1, MPFR_RNDU);
sigmak = MPFR_GET_EXP (s);
if (k % 2)
- mpfr_sub (s, s, u, GMP_RNDN);
+ mpfr_sub (s, s, u, MPFR_RNDN);
else
- mpfr_add (s, s, u, GMP_RNDN);
+ mpfr_add (s, s, u, MPFR_RNDN);
sigmak -= MPFR_GET_EXP(s);
nuk = MPFR_GET_EXP(u) - MPFR_GET_EXP(s);
@@ -228,12 +228,12 @@ mpfr_erf_0 (mpfr_ptr res, mpfr_srcptr x, double xf2, mp_rnd_t rnd_mode)
+ mul_2exp (1.0 + 8.0 * (double) k, nuk);
}
- mpfr_mul (s, x, s, GMP_RNDU);
+ mpfr_mul (s, x, s, MPFR_RNDU);
MPFR_SET_EXP (s, MPFR_GET_EXP (s) + 1);
- mpfr_const_pi (t, GMP_RNDZ);
- mpfr_sqrt (t, t, GMP_RNDZ);
- mpfr_div (s, s, t, GMP_RNDN);
+ mpfr_const_pi (t, MPFR_RNDZ);
+ mpfr_sqrt (t, t, MPFR_RNDZ);
+ mpfr_div (s, s, t, MPFR_RNDN);
tauk = 4.0 * tauk + 11.0; /* final ulp-error on s */
log2tauk = __gmpfr_ceil_log2 (tauk);
diff --git a/erfc.c b/erfc.c
index 5d12746ae..5cd1a6136 100644
--- a/erfc.c
+++ b/erfc.c
@@ -43,49 +43,49 @@ mpfr_erfc_asympt (mpfr_ptr y, mpfr_srcptr x)
mpfr_init2 (err, 31);
/* let u = 2^(1-p), and let us represent the error as (1+u)^err
with a bound for err */
- mpfr_mul (xx, x, x, GMP_RNDD); /* err <= 1 */
- mpfr_ui_div (xx, 1, xx, GMP_RNDU); /* upper bound for 1/(2x^2), err <= 2 */
- mpfr_div_2ui (xx, xx, 1, GMP_RNDU); /* exact */
- mpfr_set_ui (t, 1, GMP_RNDN); /* current term, exact */
- mpfr_set (y, t, GMP_RNDN); /* current sum */
- mpfr_set_ui (err, 0, GMP_RNDN);
+ mpfr_mul (xx, x, x, MPFR_RNDD); /* err <= 1 */
+ mpfr_ui_div (xx, 1, xx, MPFR_RNDU); /* upper bound for 1/(2x^2), err <= 2 */
+ mpfr_div_2ui (xx, xx, 1, MPFR_RNDU); /* exact */
+ mpfr_set_ui (t, 1, MPFR_RNDN); /* current term, exact */
+ mpfr_set (y, t, MPFR_RNDN); /* current sum */
+ mpfr_set_ui (err, 0, MPFR_RNDN);
for (k = 1; ; k++)
{
- mpfr_mul_ui (t, t, 2 * k - 1, GMP_RNDU); /* err <= 4k-3 */
- mpfr_mul (t, t, xx, GMP_RNDU); /* err <= 4k */
+ mpfr_mul_ui (t, t, 2 * k - 1, MPFR_RNDU); /* err <= 4k-3 */
+ mpfr_mul (t, t, xx, MPFR_RNDU); /* err <= 4k */
/* for -1 < x < 1, and |nx| < 1, we have |(1+x)^n| <= 1+7/4|nx|.
Indeed, for x>=0: log((1+x)^n) = n*log(1+x) <= n*x. Let y=n*x < 1,
then exp(y) <= 1+7/4*y.
For x<=0, let x=-x, we can prove by induction that (1-x)^n >= 1-n*x.*/
- mpfr_mul_2si (err, err, MPFR_GET_EXP (y) - MPFR_GET_EXP (t), GMP_RNDU);
- mpfr_add_ui (err, err, 14 * k, GMP_RNDU); /* 2^(1-p) * t <= 2 ulp(t) */
- mpfr_div_2si (err, err, MPFR_GET_EXP (y) - MPFR_GET_EXP (t), GMP_RNDU);
+ mpfr_mul_2si (err, err, MPFR_GET_EXP (y) - MPFR_GET_EXP (t), MPFR_RNDU);
+ mpfr_add_ui (err, err, 14 * k, MPFR_RNDU); /* 2^(1-p) * t <= 2 ulp(t) */
+ mpfr_div_2si (err, err, MPFR_GET_EXP (y) - MPFR_GET_EXP (t), MPFR_RNDU);
if (MPFR_GET_EXP (t) + (mp_exp_t) prec <= MPFR_GET_EXP (y))
{
/* the truncation error is bounded by |t| < ulp(y) */
- mpfr_add_ui (err, err, 1, GMP_RNDU);
+ mpfr_add_ui (err, err, 1, MPFR_RNDU);
break;
}
if (k & 1)
- mpfr_sub (y, y, t, GMP_RNDN);
+ mpfr_sub (y, y, t, MPFR_RNDN);
else
- mpfr_add (y, y, t, GMP_RNDN);
+ mpfr_add (y, y, t, MPFR_RNDN);
}
/* the error on y is bounded by err*ulp(y) */
- mpfr_mul (t, x, x, GMP_RNDU); /* rel. err <= 2^(1-p) */
- mpfr_div_2ui (err, err, 3, GMP_RNDU); /* err/8 */
- mpfr_add (err, err, t, GMP_RNDU); /* err/8 + xx */
- mpfr_mul_2ui (err, err, 3, GMP_RNDU); /* err + 8*xx */
- mpfr_exp (t, t, GMP_RNDU); /* err <= 1/2*ulp(t) + err(x*x)*t
+ mpfr_mul (t, x, x, MPFR_RNDU); /* rel. err <= 2^(1-p) */
+ mpfr_div_2ui (err, err, 3, MPFR_RNDU); /* err/8 */
+ mpfr_add (err, err, t, MPFR_RNDU); /* err/8 + xx */
+ mpfr_mul_2ui (err, err, 3, MPFR_RNDU); /* err + 8*xx */
+ mpfr_exp (t, t, MPFR_RNDU); /* err <= 1/2*ulp(t) + err(x*x)*t
<= 1/2*ulp(t)+2*|x*x|*ulp(t)
<= (2*|x*x|+1/2)*ulp(t) */
- mpfr_mul (t, t, x, GMP_RNDN); /* err <= 1/2*ulp(t) + (4*|x*x|+1)*ulp(t)
+ mpfr_mul (t, t, x, MPFR_RNDN); /* err <= 1/2*ulp(t) + (4*|x*x|+1)*ulp(t)
<= (4*|x*x|+3/2)*ulp(t) */
- mpfr_const_pi (xx, GMP_RNDZ); /* err <= ulp(Pi) */
- mpfr_sqrt (xx, xx, GMP_RNDN); /* err <= 1/2*ulp(xx) + ulp(Pi)/2/sqrt(Pi)
+ mpfr_const_pi (xx, MPFR_RNDZ); /* err <= ulp(Pi) */
+ mpfr_sqrt (xx, xx, MPFR_RNDN); /* err <= 1/2*ulp(xx) + ulp(Pi)/2/sqrt(Pi)
<= 3/2*ulp(xx) */
- mpfr_mul (t, t, xx, GMP_RNDN); /* err <= (8 |xx| + 13/2) * ulp(t) */
- mpfr_div (y, y, t, GMP_RNDN); /* the relative error on input y is bounded
+ mpfr_mul (t, t, xx, MPFR_RNDN); /* err <= (8 |xx| + 13/2) * ulp(t) */
+ mpfr_div (y, y, t, MPFR_RNDN); /* the relative error on input y is bounded
by (1+u)^err with u = 2^(1-p), that on
t is bounded by (1+u)^(8 |xx| + 13/2),
thus that on output y is bounded by
@@ -97,12 +97,12 @@ mpfr_erfc_asympt (mpfr_ptr y, mpfr_srcptr x)
using the fact that erfc(x) <= exp(-x^2)/sqrt(Pi)/x for x >= 0.
We compute an upper approximation of exp(-x^2)/sqrt(Pi)/x.
*/
- mpfr_mul (t, x, x, GMP_RNDD); /* t <= x^2 */
- mpfr_neg (t, t, GMP_RNDU); /* -x^2 <= t */
- mpfr_exp (t, t, GMP_RNDU); /* exp(-x^2) <= t */
- mpfr_const_pi (xx, GMP_RNDD); /* xx <= sqrt(Pi), cached */
- mpfr_mul (xx, xx, x, GMP_RNDD); /* xx <= sqrt(Pi)*x */
- mpfr_div (y, t, xx, GMP_RNDN); /* if y is zero, this means that the upper
+ mpfr_mul (t, x, x, MPFR_RNDD); /* t <= x^2 */
+ mpfr_neg (t, t, MPFR_RNDU); /* -x^2 <= t */
+ mpfr_exp (t, t, MPFR_RNDU); /* exp(-x^2) <= t */
+ mpfr_const_pi (xx, MPFR_RNDD); /* xx <= sqrt(Pi), cached */
+ mpfr_mul (xx, xx, x, MPFR_RNDD); /* xx <= sqrt(Pi)*x */
+ mpfr_div (y, t, xx, MPFR_RNDN); /* if y is zero, this means that the upper
approximation of exp(-x^2)/sqrt(Pi)/x
is nearer from 0 than from 2^(-emin-1),
thus we have underflow. */
@@ -110,7 +110,7 @@ mpfr_erfc_asympt (mpfr_ptr y, mpfr_srcptr x)
}
else
{
- mpfr_add_ui (err, err, 7, GMP_RNDU);
+ mpfr_add_ui (err, err, 7, MPFR_RNDU);
exp_err = MPFR_GET_EXP (err);
}
@@ -151,7 +151,7 @@ mpfr_erfc (mpfr_ptr y, mpfr_srcptr x, mp_rnd_t rnd)
{
/* for x >= 27282, erfc(x) < 2^(-2^30-1) */
if (mpfr_cmp_ui (x, 27282) >= 0)
- return mpfr_underflow (y, (rnd == GMP_RNDN) ? GMP_RNDZ : rnd, 1);
+ return mpfr_underflow (y, (rnd == MPFR_RNDN) ? MPFR_RNDZ : rnd, 1);
}
if (MPFR_SIGN (x) < 0)
@@ -170,9 +170,9 @@ mpfr_erfc (mpfr_ptr y, mpfr_srcptr x, mp_rnd_t rnd)
mpfr_cmp_si (x, -27282) <= 0)
{
near_two:
- mpfr_set_ui (y, 2, GMP_RNDN);
+ mpfr_set_ui (y, 2, MPFR_RNDN);
mpfr_set_inexflag ();
- if (rnd == GMP_RNDZ || rnd == GMP_RNDD)
+ if (rnd == MPFR_RNDZ || rnd == MPFR_RNDD)
{
mpfr_nextbelow (y);
return -1;
@@ -188,11 +188,11 @@ mpfr_erfc (mpfr_ptr y, mpfr_srcptr x, mp_rnd_t rnd)
mpfr_init2 (u, 32);
/* the following is 1/log(2) rounded to zero on 32 bits */
mpfr_set_str_binary (t, "1.0111000101010100011101100101001");
- mpfr_sqr (u, x, GMP_RNDZ);
- mpfr_mul (t, t, u, GMP_RNDZ); /* t <= x^2/log(2) */
- mpfr_neg (u, x, GMP_RNDZ); /* 0 <= u <= |x| */
- mpfr_log2 (u, u, GMP_RNDZ); /* u <= log2(|x|) */
- mpfr_add (t, t, u, GMP_RNDZ); /* t <= log2|x| + x^2 / log(2) */
+ mpfr_sqr (u, x, MPFR_RNDZ);
+ mpfr_mul (t, t, u, MPFR_RNDZ); /* t <= x^2/log(2) */
+ mpfr_neg (u, x, MPFR_RNDZ); /* 0 <= u <= |x| */
+ mpfr_log2 (u, u, MPFR_RNDZ); /* u <= log2(|x|) */
+ mpfr_add (t, t, u, MPFR_RNDZ); /* t <= log2|x| + x^2 / log(2) */
near_2 = mpfr_cmp_ui (t, MPFR_PREC(y)) >= 0;
mpfr_clear (t);
mpfr_clear (u);
@@ -229,15 +229,15 @@ mpfr_erfc (mpfr_ptr y, mpfr_srcptr x, mp_rnd_t rnd)
{
mpfr_clear (tmp);
MPFR_SAVE_EXPO_FREE (expo);
- return mpfr_underflow (y, (rnd == GMP_RNDN) ? GMP_RNDZ : rnd, 1);
+ return mpfr_underflow (y, (rnd == MPFR_RNDN) ? MPFR_RNDZ : rnd, 1);
}
}
else
{
- mpfr_erf (tmp, x, GMP_RNDN);
+ mpfr_erf (tmp, x, MPFR_RNDN);
MPFR_ASSERTD (!MPFR_IS_SINGULAR (tmp)); /* FIXME: 0 only for x=0 ? */
te = MPFR_GET_EXP (tmp);
- mpfr_ui_sub (tmp, 1, tmp, GMP_RNDN);
+ mpfr_ui_sub (tmp, 1, tmp, MPFR_RNDN);
/* See error analysis in algorithms.tex for details */
if (MPFR_IS_ZERO (tmp))
{
diff --git a/exceptions.c b/exceptions.c
index 1f14b4726..a98ca3c29 100644
--- a/exceptions.c
+++ b/exceptions.c
@@ -205,11 +205,11 @@ mpfr_check_range (mpfr_ptr x, int t, mp_rnd_t rnd_mode)
* _ |x| = 2^(emin-2) and the absolute value of the exact
* result is <= 2^(emin-2).
*/
- if (rnd_mode == GMP_RNDN &&
+ if (rnd_mode == MPFR_RNDN &&
(exp + 1 < __gmpfr_emin ||
(mpfr_powerof2_raw(x) &&
(MPFR_IS_NEG(x) ? t <= 0 : t >= 0))))
- rnd_mode = GMP_RNDZ;
+ rnd_mode = MPFR_RNDZ;
return mpfr_underflow(x, rnd_mode, MPFR_SIGN(x));
}
if (MPFR_UNLIKELY( exp > __gmpfr_emax) )
@@ -284,7 +284,7 @@ mpfr_erangeflag_p (void)
/* Note: In the rounding to the nearest mode, mpfr_underflow
always rounds away from 0. In this rounding mode, you must call
- mpfr_underflow with rnd_mode = GMP_RNDZ if the exact result
+ mpfr_underflow with rnd_mode = MPFR_RNDZ if the exact result
is <= 2^(emin-2) in absolute value. */
int
diff --git a/exp.c b/exp.c
index f92ac1518..e23899535 100644
--- a/exp.c
+++ b/exp.c
@@ -68,10 +68,10 @@ mpfr_exp (mpfr_ptr y, mpfr_srcptr x, mp_rnd_t rnd_mode)
mpfr_init2 (e, sizeof (mp_exp_t) * CHAR_BIT);
mpfr_init2 (bound, 32);
- inexact = mpfr_set_exp_t (e, expo.saved_emax, GMP_RNDN);
+ inexact = mpfr_set_exp_t (e, expo.saved_emax, MPFR_RNDN);
MPFR_ASSERTD (inexact == 0);
- mpfr_const_log2 (bound, expo.saved_emax < 0 ? GMP_RNDD : GMP_RNDU);
- mpfr_mul (bound, bound, e, GMP_RNDU);
+ mpfr_const_log2 (bound, expo.saved_emax < 0 ? MPFR_RNDD : MPFR_RNDU);
+ mpfr_mul (bound, bound, e, MPFR_RNDU);
if (MPFR_UNLIKELY (mpfr_cmp (x, bound) >= 0))
{
/* x > log(2^emax), thus exp(x) > 2^emax */
@@ -80,18 +80,18 @@ mpfr_exp (mpfr_ptr y, mpfr_srcptr x, mp_rnd_t rnd_mode)
return mpfr_overflow (y, rnd_mode, 1);
}
- inexact = mpfr_set_exp_t (e, expo.saved_emin, GMP_RNDN);
+ inexact = mpfr_set_exp_t (e, expo.saved_emin, MPFR_RNDN);
MPFR_ASSERTD (inexact == 0);
- inexact = mpfr_sub_ui (e, e, 2, GMP_RNDN);
+ inexact = mpfr_sub_ui (e, e, 2, MPFR_RNDN);
MPFR_ASSERTD (inexact == 0);
- mpfr_const_log2 (bound, expo.saved_emin < 0 ? GMP_RNDU : GMP_RNDD);
- mpfr_mul (bound, bound, e, GMP_RNDD);
+ mpfr_const_log2 (bound, expo.saved_emin < 0 ? MPFR_RNDU : MPFR_RNDD);
+ mpfr_mul (bound, bound, e, MPFR_RNDD);
if (MPFR_UNLIKELY (mpfr_cmp (x, bound) <= 0))
{
/* x < log(2^(emin - 2)), thus exp(x) < 2^(emin - 2) */
mpfr_clears (e, bound, (mpfr_ptr) 0);
MPFR_SAVE_EXPO_FREE (expo);
- return mpfr_underflow (y, rnd_mode == GMP_RNDN ? GMP_RNDZ : rnd_mode,
+ return mpfr_underflow (y, rnd_mode == MPFR_RNDN ? MPFR_RNDZ : rnd_mode,
1);
}
@@ -114,8 +114,8 @@ mpfr_exp (mpfr_ptr y, mpfr_srcptr x, mp_rnd_t rnd_mode)
int signx = MPFR_SIGN (x);
MPFR_SET_POS (y);
- if (MPFR_IS_NEG_SIGN (signx) && (rnd_mode == GMP_RNDD ||
- rnd_mode == GMP_RNDZ))
+ if (MPFR_IS_NEG_SIGN (signx) && (rnd_mode == MPFR_RNDD ||
+ rnd_mode == MPFR_RNDZ))
{
__gmpfr_emin = 0;
__gmpfr_emax = 0;
@@ -127,8 +127,8 @@ mpfr_exp (mpfr_ptr y, mpfr_srcptr x, mp_rnd_t rnd_mode)
__gmpfr_emin = 1;
__gmpfr_emax = 1;
mpfr_setmin (y, 1); /* y = 1 */
- if (MPFR_IS_POS_SIGN (signx) && (rnd_mode == GMP_RNDU ||
- rnd_mode == GMP_RNDA))
+ if (MPFR_IS_POS_SIGN (signx) && (rnd_mode == MPFR_RNDU ||
+ rnd_mode == MPFR_RNDA))
{
mp_size_t yn;
int sh;
diff --git a/exp2.c b/exp2.c
index 94ee4a3fc..de9543697 100644
--- a/exp2.c
+++ b/exp2.c
@@ -64,9 +64,9 @@ mpfr_exp2 (mpfr_ptr y, mpfr_srcptr x, mp_rnd_t rnd_mode)
{
mp_rnd_t rnd2 = rnd_mode;
/* in round to nearest mode, round to zero when x <= __gmpfr_emin-2 */
- if (rnd_mode == GMP_RNDN &&
+ if (rnd_mode == MPFR_RNDN &&
mpfr_cmp_si_2exp (x, __gmpfr_emin - 2, 0) <= 0)
- rnd2 = GMP_RNDZ;
+ rnd2 = MPFR_RNDZ;
return mpfr_underflow (y, rnd2, 1);
}
@@ -84,13 +84,13 @@ mpfr_exp2 (mpfr_ptr y, mpfr_srcptr x, mp_rnd_t rnd_mode)
MPFR_SMALL_INPUT_AFTER_SAVE_EXPO (y, __gmpfr_one, - MPFR_GET_EXP (x), 0,
MPFR_SIGN(x) > 0, rnd_mode, expo, {});
- xint = mpfr_get_si (x, GMP_RNDZ);
+ xint = mpfr_get_si (x, MPFR_RNDZ);
mpfr_init2 (xfrac, MPFR_PREC (x));
- mpfr_sub_si (xfrac, x, xint, GMP_RNDN); /* exact */
+ mpfr_sub_si (xfrac, x, xint, MPFR_RNDN); /* exact */
if (MPFR_IS_ZERO (xfrac))
{
- mpfr_set_ui (y, 1, GMP_RNDN);
+ mpfr_set_ui (y, 1, MPFR_RNDN);
inexact = 0;
}
else
@@ -116,10 +116,10 @@ mpfr_exp2 (mpfr_ptr y, mpfr_srcptr x, mp_rnd_t rnd_mode)
for (;;)
{
/* compute exp(x*ln(2))*/
- mpfr_const_log2 (t, GMP_RNDU); /* ln(2) */
- mpfr_mul (t, xfrac, t, GMP_RNDU); /* xfrac * ln(2) */
+ mpfr_const_log2 (t, MPFR_RNDU); /* ln(2) */
+ mpfr_mul (t, xfrac, t, MPFR_RNDU); /* xfrac * ln(2) */
err = Nt - (MPFR_GET_EXP (t) + 2); /* Estimate of the error */
- mpfr_exp (t, t, GMP_RNDN); /* exp(xfrac * ln(2)) */
+ mpfr_exp (t, t, MPFR_RNDN); /* exp(xfrac * ln(2)) */
if (MPFR_LIKELY (MPFR_CAN_ROUND (t, err, Ny, rnd_mode)))
break;
@@ -137,7 +137,7 @@ mpfr_exp2 (mpfr_ptr y, mpfr_srcptr x, mp_rnd_t rnd_mode)
mpfr_clear (xfrac);
mpfr_clear_flags ();
- mpfr_mul_2si (y, y, xint, GMP_RNDN); /* exact or overflow */
+ mpfr_mul_2si (y, y, xint, MPFR_RNDN); /* exact or overflow */
/* Note: We can have an overflow only when t was rounded up to 2. */
MPFR_ASSERTD (MPFR_IS_PURE_FP (y) || inexact > 0);
MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, __gmpfr_flags);
diff --git a/exp3.c b/exp3.c
index 570bb6e1c..f1be2c731 100644
--- a/exp3.c
+++ b/exp3.c
@@ -143,7 +143,7 @@ mpfr_exp_rational (mpfr_ptr y, mpz_ptr p, long r, int m,
mpz_mul_2exp (Q[0], Q[0], -diff);
mpz_tdiv_q (S[0], S[0], Q[0]);
- mpfr_set_z (y, S[0], GMP_RNDD);
+ mpfr_set_z (y, S[0], MPFR_RNDD);
MPFR_SET_EXP (y, MPFR_GET_EXP (y) + expo - r * (i - 1) );
}
@@ -180,13 +180,13 @@ mpfr_exp_3 (mpfr_ptr y, mpfr_srcptr x, mp_rnd_t rnd_mode)
ttt = MPFR_GET_EXP (x);
mpfr_init2 (x_copy, MPFR_PREC(x));
- mpfr_set (x_copy, x, GMP_RNDD);
+ mpfr_set (x_copy, x, MPFR_RNDD);
/* we shift to get a number less than 1 */
if (ttt > 0)
{
shift_x = ttt;
- mpfr_div_2ui (x_copy, x, ttt, GMP_RNDN);
+ mpfr_div_2ui (x_copy, x, ttt, MPFR_RNDN);
ttt = MPFR_GET_EXP (x_copy);
}
else
@@ -223,7 +223,7 @@ mpfr_exp_3 (mpfr_ptr y, mpfr_srcptr x, mp_rnd_t rnd_mode)
MPFR_ASSERTD (mpz_cmp_ui (uk, 0) != 0);
mpfr_exp_rational (tmp, uk, shift + twopoweri - ttt, k + 1, P, mult);
for (loop = 0; loop < shift; loop++)
- mpfr_sqr (tmp, tmp, GMP_RNDD);
+ mpfr_sqr (tmp, tmp, MPFR_RNDD);
twopoweri *= 2;
/* General case */
@@ -234,7 +234,7 @@ mpfr_exp_3 (mpfr_ptr y, mpfr_srcptr x, mp_rnd_t rnd_mode)
if (MPFR_LIKELY (mpz_cmp_ui (uk, 0) != 0))
{
mpfr_exp_rational (t, uk, twopoweri - ttt, k - i + 1, P, mult);
- mpfr_mul (tmp, tmp, t, GMP_RNDD);
+ mpfr_mul (tmp, tmp, t, MPFR_RNDD);
}
MPFR_ASSERTN (twopoweri <= LONG_MAX/2);
twopoweri *=2;
@@ -250,8 +250,8 @@ mpfr_exp_3 (mpfr_ptr y, mpfr_srcptr x, mp_rnd_t rnd_mode)
{
MPFR_BLOCK (flags, {
for (loop = 0; loop < shift_x - 1; loop++)
- mpfr_sqr (tmp, tmp, GMP_RNDD);
- mpfr_sqr (t, tmp, GMP_RNDD);
+ mpfr_sqr (tmp, tmp, MPFR_RNDD);
+ mpfr_sqr (t, tmp, MPFR_RNDD);
} );
if (MPFR_UNLIKELY (MPFR_OVERFLOW (flags)))
@@ -266,14 +266,14 @@ mpfr_exp_3 (mpfr_ptr y, mpfr_srcptr x, mp_rnd_t rnd_mode)
{
/* This may be a spurious underflow. So, let's scale
the result. */
- mpfr_mul_2ui (tmp, tmp, 1, GMP_RNDD); /* no overflow, exact */
- mpfr_sqr (t, tmp, GMP_RNDD);
+ mpfr_mul_2ui (tmp, tmp, 1, MPFR_RNDD); /* no overflow, exact */
+ mpfr_sqr (t, tmp, MPFR_RNDD);
if (MPFR_IS_ZERO (t))
{
/* approximate result < 2^(emin - 3), thus
exact result < 2^(emin - 2). */
- inexact = mpfr_underflow (y, (rnd_mode == GMP_RNDN) ?
- GMP_RNDZ : rnd_mode, 1);
+ inexact = mpfr_underflow (y, (rnd_mode == MPFR_RNDN) ?
+ MPFR_RNDZ : rnd_mode, 1);
MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, MPFR_FLAGS_UNDERFLOW);
break;
}
@@ -281,8 +281,8 @@ mpfr_exp_3 (mpfr_ptr y, mpfr_srcptr x, mp_rnd_t rnd_mode)
}
}
- if (mpfr_can_round (shift_x > 0 ? t : tmp, realprec, GMP_RNDD, GMP_RNDZ,
- MPFR_PREC(y) + (rnd_mode == GMP_RNDN)))
+ if (mpfr_can_round (shift_x > 0 ? t : tmp, realprec, MPFR_RNDD, MPFR_RNDZ,
+ MPFR_PREC(y) + (rnd_mode == MPFR_RNDN)))
{
inexact = mpfr_set (y, shift_x > 0 ? t : tmp, rnd_mode);
if (MPFR_UNLIKELY (scaled && MPFR_IS_PURE_FP (y)))
@@ -295,16 +295,16 @@ mpfr_exp_3 (mpfr_ptr y, mpfr_srcptr x, mp_rnd_t rnd_mode)
inex2 = mpfr_mul_2si (y, y, -2, rnd_mode);
if (inex2) /* underflow */
{
- if (rnd_mode == GMP_RNDN && inexact < 0 &&
+ if (rnd_mode == MPFR_RNDN && inexact < 0 &&
MPFR_IS_ZERO (y) && ey == __gmpfr_emin + 1)
{
- /* Double rounding case: in GMP_RNDN, the scaled
+ /* Double rounding case: in MPFR_RNDN, the scaled
result has been rounded downward to 2^emin.
As the exact result is > 2^(emin - 2), correct
rounding must be done upward. */
/* TODO: make sure in coverage tests that this line
is reached. */
- inexact = mpfr_underflow (y, GMP_RNDU, 1);
+ inexact = mpfr_underflow (y, MPFR_RNDU, 1);
}
else
{
diff --git a/exp_2.c b/exp_2.c
index ca0ef7315..bcbf6b8b8 100644
--- a/exp_2.c
+++ b/exp_2.c
@@ -108,9 +108,9 @@ mpfr_exp_2 (mpfr_ptr y, mpfr_srcptr x, mp_rnd_t rnd_mode)
else
{
mpfr_init2 (r, sizeof (long) * CHAR_BIT);
- mpfr_const_log2 (r, GMP_RNDZ);
- mpfr_div (r, x, r, GMP_RNDN);
- n = mpfr_get_si (r, GMP_RNDN);
+ mpfr_const_log2 (r, MPFR_RNDZ);
+ mpfr_div (r, x, r, MPFR_RNDN);
+ n = mpfr_get_si (r, MPFR_RNDN);
mpfr_clear (r);
}
MPFR_LOG_MSG (("d(x)=%1.30e n=%ld\n", mpfr_get_d1(x), n));
@@ -150,10 +150,10 @@ mpfr_exp_2 (mpfr_ptr y, mpfr_srcptr x, mp_rnd_t rnd_mode)
/* if n<0, we have to get an upper bound of log(2)
in order to get an upper bound of r = x-n*log(2) */
- mpfr_const_log2 (s, (n >= 0) ? GMP_RNDZ : GMP_RNDU);
+ mpfr_const_log2 (s, (n >= 0) ? MPFR_RNDZ : MPFR_RNDU);
/* s is within 1 ulp of log(2) */
- mpfr_mul_ui (r, s, (n < 0) ? -n : n, (n >= 0) ? GMP_RNDZ : GMP_RNDU);
+ mpfr_mul_ui (r, s, (n < 0) ? -n : n, (n >= 0) ? MPFR_RNDZ : MPFR_RNDU);
/* r is within 3 ulps of |n|*log(2) */
if (n < 0)
MPFR_CHANGE_SIGN (r);
@@ -162,7 +162,7 @@ mpfr_exp_2 (mpfr_ptr y, mpfr_srcptr x, mp_rnd_t rnd_mode)
MPFR_LOG_VAR (x);
MPFR_LOG_VAR (r);
- mpfr_sub (r, x, r, GMP_RNDU);
+ mpfr_sub (r, x, r, MPFR_RNDU);
/* possible cancellation here: if r is zero, increase the working
precision (Ziv's loop); otherwise, the error on r is at most
3*2^(EXP(old_r)-EXP(new_r)) ulps */
@@ -180,12 +180,12 @@ mpfr_exp_2 (mpfr_ptr y, mpfr_srcptr x, mp_rnd_t rnd_mode)
while (MPFR_IS_NEG (r))
{ /* initial approximation n was too large */
n--;
- mpfr_add (r, r, s, GMP_RNDU);
+ mpfr_add (r, r, s, MPFR_RNDU);
}
- mpfr_prec_round (r, q, GMP_RNDU);
+ mpfr_prec_round (r, q, MPFR_RNDU);
MPFR_LOG_VAR (r);
MPFR_ASSERTD (MPFR_IS_POS (r));
- mpfr_div_2ui (r, r, K, GMP_RNDU); /* r = (x-n*log(2))/2^K, exact */
+ mpfr_div_2ui (r, r, K, MPFR_RNDU); /* r = (x-n*log(2))/2^K, exact */
MPFR_TMP_MARK(marker);
MY_INIT_MPZ(ss, 3 + 2*((q-1)/BITS_PER_MP_LIMB));
@@ -205,7 +205,7 @@ mpfr_exp_2 (mpfr_ptr y, mpfr_srcptr x, mp_rnd_t rnd_mode)
exps <<= 1;
exps += mpz_normalize (ss, ss, q);
}
- mpfr_set_z (s, ss, GMP_RNDN);
+ mpfr_set_z (s, ss, MPFR_RNDN);
MPFR_SET_EXP(s, MPFR_GET_EXP (s) + exps);
MPFR_TMP_FREE(marker); /* don't need ss anymore */
diff --git a/expm1.c b/expm1.c
index 72593c0bd..b9d523740 100644
--- a/expm1.c
+++ b/expm1.c
@@ -82,13 +82,13 @@ mpfr_expm1 (mpfr_ptr y, mpfr_srcptr x , mp_rnd_t rnd_mode)
mpfr_init2 (minus_one, 2);
mpfr_init2 (t, 64);
- mpfr_set_si (minus_one, -1, GMP_RNDN);
- mpfr_const_log2 (t, GMP_RNDU); /* round upward since x is negative */
- mpfr_div (t, x, t, GMP_RNDU); /* > x / ln(2) */
+ mpfr_set_si (minus_one, -1, MPFR_RNDN);
+ mpfr_const_log2 (t, MPFR_RNDU); /* round upward since x is negative */
+ mpfr_div (t, x, t, MPFR_RNDU); /* > x / ln(2) */
err = mpfr_cmp_si (t, MPFR_EMIN_MIN >= -LONG_MAX ?
MPFR_EMIN_MIN : -LONG_MAX) <= 0 ?
- (MPFR_EMIN_MIN >= -LONG_MAX ? MPFR_EMIN_MIN : -LONG_MAX) :
- - mpfr_get_si (t, GMP_RNDU);
+ - mpfr_get_si (t, MPFR_RNDU);
/* exp(x) = 2^(x/ln(2))
<= 2^max(MPFR_EMIN_MIN,-LONG_MAX,ceil(x/ln(2)+epsilon))
with epsilon > 0 */
@@ -127,7 +127,7 @@ mpfr_expm1 (mpfr_ptr y, mpfr_srcptr x , mp_rnd_t rnd_mode)
MPFR_BLOCK_DECL (flags);
/* exp(x) may overflow and underflow */
- MPFR_BLOCK (flags, mpfr_exp (t, x, GMP_RNDN));
+ MPFR_BLOCK (flags, mpfr_exp (t, x, MPFR_RNDN));
if (MPFR_OVERFLOW (flags))
{
inexact = mpfr_overflow (y, rnd_mode, MPFR_SIGN_POS);
@@ -148,7 +148,7 @@ mpfr_expm1 (mpfr_ptr y, mpfr_srcptr x , mp_rnd_t rnd_mode)
}
exp_te = MPFR_GET_EXP (t); /* FIXME: exp(x) may overflow! */
- mpfr_sub_ui (t, t, 1, GMP_RNDN); /* exp(x)-1 */
+ mpfr_sub_ui (t, t, 1, MPFR_RNDN); /* exp(x)-1 */
/* error estimate */
/*err=Nt-(__gmpfr_ceil_log2(1+pow(2,MPFR_EXP(te)-MPFR_EXP(t))));*/
diff --git a/factorial.c b/factorial.c
index cbfce242c..86a35781a 100644
--- a/factorial.c
+++ b/factorial.c
@@ -59,7 +59,7 @@ mpfr_fac_ui (mpfr_ptr y, unsigned long int x, mp_rnd_t rnd_mode)
mpfr_init2 (t, Nt); /* initialise of intermediary variable */
- rnd = GMP_RNDZ;
+ rnd = MPFR_RNDZ;
MPFR_ZIV_INIT (loop, Nt);
for (;;)
{
@@ -76,8 +76,8 @@ mpfr_fac_ui (mpfr_ptr y, unsigned long int x, mp_rnd_t rnd_mode)
err = Nt - 1 - MPFR_INT_CEIL_LOG2 (Nt);
- round = !inexact || mpfr_can_round (t, err, rnd, GMP_RNDZ,
- Ny + (rnd_mode == GMP_RNDN));
+ round = !inexact || mpfr_can_round (t, err, rnd, MPFR_RNDZ,
+ Ny + (rnd_mode == MPFR_RNDN));
if (MPFR_LIKELY (round))
{
@@ -96,7 +96,7 @@ mpfr_fac_ui (mpfr_ptr y, unsigned long int x, mp_rnd_t rnd_mode)
else /* inexact and round have opposite signs: we cannot
compute the inexact flag. Restart using the
symmetric rounding. */
- rnd = (rnd == GMP_RNDZ) ? GMP_RNDU : GMP_RNDZ;
+ rnd = (rnd == MPFR_RNDZ) ? MPFR_RNDU : MPFR_RNDZ;
}
MPFR_ZIV_NEXT (loop, Nt);
mpfr_set_prec (t, Nt);
diff --git a/fits_intmax.c b/fits_intmax.c
index 9a504bc0c..b930ccff7 100644
--- a/fits_intmax.c
+++ b/fits_intmax.c
@@ -93,7 +93,7 @@ mpfr_fits_intmax_p (mpfr_srcptr f, mp_rnd_t rnd)
mpfr_init2 (y, prec);
mpfr_set (x, f, rnd);
- mpfr_set_sj (y, neg ? INTMAX_MIN : INTMAX_MAX, GMP_RNDN);
+ mpfr_set_sj (y, neg ? INTMAX_MIN : INTMAX_MAX, MPFR_RNDN);
res = (neg
? (mpfr_cmp (x, y) >= 0)
diff --git a/fits_uintmax.c b/fits_uintmax.c
index a8911d70a..0d4b20e04 100644
--- a/fits_uintmax.c
+++ b/fits_uintmax.c
@@ -86,7 +86,7 @@ mpfr_fits_uintmax_p (mpfr_srcptr f, mp_rnd_t rnd)
mpfr_init2 (x, prec);
mpfr_init2 (y, prec);
mpfr_set (x, f, rnd);
- res = mpfr_set_uj (y, UINTMAX_MAX, GMP_RNDN);
+ res = mpfr_set_uj (y, UINTMAX_MAX, MPFR_RNDN);
MPFR_ASSERTD (res == 0);
res = mpfr_cmp (x, y) <= 0;
mpfr_clear (y);
diff --git a/fma.c b/fma.c
index 66411e015..b4901ac56 100644
--- a/fma.c
+++ b/fma.c
@@ -82,7 +82,7 @@ mpfr_fma (mpfr_ptr s, mpfr_srcptr x, mpfr_srcptr y, mpfr_srcptr z,
{
int sign_p;
sign_p = MPFR_MULT_SIGN( MPFR_SIGN(x) , MPFR_SIGN(y) );
- MPFR_SET_SIGN(s,(rnd_mode != GMP_RNDD ?
+ MPFR_SET_SIGN(s,(rnd_mode != MPFR_RNDD ?
((MPFR_IS_NEG_SIGN(sign_p) && MPFR_IS_NEG(z))
? -1 : 1) :
((MPFR_IS_POS_SIGN(sign_p) && MPFR_IS_POS(z))
@@ -105,12 +105,12 @@ mpfr_fma (mpfr_ptr s, mpfr_srcptr x, mpfr_srcptr y, mpfr_srcptr z,
MPFR_SAVE_EXPO_MARK (expo);
mpfr_init2 (u, MPFR_PREC(x) + MPFR_PREC(y));
- if (MPFR_UNLIKELY (mpfr_mul (u, x, y, GMP_RNDN)))
+ if (MPFR_UNLIKELY (mpfr_mul (u, x, y, MPFR_RNDN)))
{
/* overflow or underflow - this case is regarded as rare, thus
does not need to be very efficient (even if some tests below
could have been done earlier).
- It is an overflow iff u is an infinity (since GMP_RNDN was used).
+ It is an overflow iff u is an infinity (since MPFR_RNDN was used).
Alternatively, we could test the overflow flag, but in this case,
mpfr_clear_flags would have been necessary. */
if (MPFR_IS_INF (u)) /* overflow */
@@ -133,9 +133,9 @@ mpfr_fma (mpfr_ptr s, mpfr_srcptr x, mpfr_srcptr y, mpfr_srcptr z,
is exact with an unbounded exponent range). It does not
underflow either, because x*y overflows and the exponent
range is large enough. */
- inexact = mpfr_div_2ui (u, x, 2, GMP_RNDN);
+ inexact = mpfr_div_2ui (u, x, 2, MPFR_RNDN);
MPFR_ASSERTN (inexact == 0);
- inexact = mpfr_mul (u, u, y, GMP_RNDN);
+ inexact = mpfr_mul (u, u, y, MPFR_RNDN);
MPFR_ASSERTN (inexact == 0);
/* Now, we need to add z/4... But it may underflow! */
@@ -153,7 +153,7 @@ mpfr_fma (mpfr_ptr s, mpfr_srcptr x, mpfr_srcptr y, mpfr_srcptr z,
else
{
mpfr_init2 (zo4, MPFR_PREC (z));
- if (mpfr_div_2ui (zo4, z, 2, GMP_RNDZ))
+ if (mpfr_div_2ui (zo4, z, 2, MPFR_RNDZ))
{
/* The division by 4 underflowed! */
MPFR_ASSERTN (0); /* TODO... */
@@ -216,7 +216,7 @@ mpfr_fma (mpfr_ptr s, mpfr_srcptr x, mpfr_srcptr y, mpfr_srcptr z,
MPFR_ASSERTN (uscale <= ULONG_MAX);
scale = uscale;
mpfr_init2 (scaled_z, MPFR_PREC (z));
- inexact = mpfr_mul_2ui (scaled_z, z, scale, GMP_RNDN);
+ inexact = mpfr_mul_2ui (scaled_z, z, scale, MPFR_RNDN);
MPFR_ASSERTN (inexact == 0); /* TODO: overflow case */
new_z = scaled_z;
/* Now we need to recompute u = xy * 2^scale. */
@@ -224,14 +224,14 @@ mpfr_fma (mpfr_ptr s, mpfr_srcptr x, mpfr_srcptr y, mpfr_srcptr z,
if (MPFR_GET_EXP (x) < MPFR_GET_EXP (y))
{
mpfr_init2 (scaled_v, MPFR_PREC (x));
- mpfr_mul_2ui (scaled_v, x, scale, GMP_RNDN);
- mpfr_mul (u, scaled_v, y, GMP_RNDN);
+ mpfr_mul_2ui (scaled_v, x, scale, MPFR_RNDN);
+ mpfr_mul (u, scaled_v, y, MPFR_RNDN);
}
else
{
mpfr_init2 (scaled_v, MPFR_PREC (y));
- mpfr_mul_2ui (scaled_v, y, scale, GMP_RNDN);
- mpfr_mul (u, x, scaled_v, GMP_RNDN);
+ mpfr_mul_2ui (scaled_v, y, scale, MPFR_RNDN);
+ mpfr_mul (u, x, scaled_v, MPFR_RNDN);
});
mpfr_clear (scaled_v);
MPFR_ASSERTN (! MPFR_OVERFLOW (flags));
@@ -268,10 +268,10 @@ mpfr_fma (mpfr_ptr s, mpfr_srcptr x, mpfr_srcptr y, mpfr_srcptr z,
is not possible, but let's check that anyway. */
MPFR_ASSERTN (! MPFR_OVERFLOW (flags)); /* TODO... */
MPFR_ASSERTN (! MPFR_UNDERFLOW (flags)); /* not possible */
- inex2 = mpfr_div_2ui (s, s, scale, GMP_RNDN);
- /* FIXME: this seems incorrect. GMP_RNDN -> rnd_mode?
+ inex2 = mpfr_div_2ui (s, s, scale, MPFR_RNDN);
+ /* FIXME: this seems incorrect. MPFR_RNDN -> rnd_mode?
Also, handle the double rounding case:
- s / 2^scale = 2^(emin - 2) in GMP_RNDN. */
+ s / 2^scale = 2^(emin - 2) in MPFR_RNDN. */
if (inex2) /* underflow */
inexact = inex2;
}
diff --git a/fms.c b/fms.c
index 54126bb55..6560ab671 100644
--- a/fms.c
+++ b/fms.c
@@ -84,7 +84,7 @@ mpfr_fms (mpfr_ptr s, mpfr_srcptr x, mpfr_srcptr y, mpfr_srcptr z,
{
int sign_p;
sign_p = MPFR_MULT_SIGN( MPFR_SIGN(x) , MPFR_SIGN(y) );
- MPFR_SET_SIGN(s,(rnd_mode != GMP_RNDD ?
+ MPFR_SET_SIGN(s,(rnd_mode != MPFR_RNDD ?
((MPFR_IS_NEG_SIGN(sign_p) && MPFR_IS_POS(z))
? -1 : 1) :
((MPFR_IS_POS_SIGN(sign_p) && MPFR_IS_NEG(z))
@@ -107,12 +107,12 @@ mpfr_fms (mpfr_ptr s, mpfr_srcptr x, mpfr_srcptr y, mpfr_srcptr z,
MPFR_SAVE_EXPO_MARK (expo);
mpfr_init2 (u, MPFR_PREC(x) + MPFR_PREC(y));
- if (MPFR_UNLIKELY (mpfr_mul (u, x, y, GMP_RNDN)))
+ if (MPFR_UNLIKELY (mpfr_mul (u, x, y, MPFR_RNDN)))
{
/* overflow or underflow - this case is regarded as rare, thus
does not need to be very efficient (even if some tests below
could have been done earlier).
- It is an overflow iff u is an infinity (since GMP_RNDN was used).
+ It is an overflow iff u is an infinity (since MPFR_RNDN was used).
Alternatively, we could test the overflow flag, but in this case,
mpfr_clear_flags would have been necessary. */
if (MPFR_IS_INF (u)) /* overflow */
@@ -135,9 +135,9 @@ mpfr_fms (mpfr_ptr s, mpfr_srcptr x, mpfr_srcptr y, mpfr_srcptr z,
is exact with an unbounded exponent range). It does not
underflow either, because x*y overflows and the exponent
range is large enough. */
- inexact = mpfr_div_2ui (u, x, 2, GMP_RNDN);
+ inexact = mpfr_div_2ui (u, x, 2, MPFR_RNDN);
MPFR_ASSERTN (inexact == 0);
- inexact = mpfr_mul (u, u, y, GMP_RNDN);
+ inexact = mpfr_mul (u, u, y, MPFR_RNDN);
MPFR_ASSERTN (inexact == 0);
/* Now, we need to subtract z/4... But it may underflow! */
@@ -155,7 +155,7 @@ mpfr_fms (mpfr_ptr s, mpfr_srcptr x, mpfr_srcptr y, mpfr_srcptr z,
else
{
mpfr_init2 (zo4, MPFR_PREC (z));
- if (mpfr_div_2ui (zo4, z, 2, GMP_RNDZ))
+ if (mpfr_div_2ui (zo4, z, 2, MPFR_RNDZ))
{
/* The division by 4 underflowed! */
MPFR_ASSERTN (0); /* TODO... */
@@ -218,7 +218,7 @@ mpfr_fms (mpfr_ptr s, mpfr_srcptr x, mpfr_srcptr y, mpfr_srcptr z,
MPFR_ASSERTN (uscale <= ULONG_MAX);
scale = uscale;
mpfr_init2 (scaled_z, MPFR_PREC (z));
- inexact = mpfr_mul_2ui (scaled_z, z, scale, GMP_RNDN);
+ inexact = mpfr_mul_2ui (scaled_z, z, scale, MPFR_RNDN);
MPFR_ASSERTN (inexact == 0); /* TODO: overflow case */
new_z = scaled_z;
/* Now we need to recompute u = xy * 2^scale. */
@@ -226,14 +226,14 @@ mpfr_fms (mpfr_ptr s, mpfr_srcptr x, mpfr_srcptr y, mpfr_srcptr z,
if (MPFR_GET_EXP (x) < MPFR_GET_EXP (y))
{
mpfr_init2 (scaled_v, MPFR_PREC (x));
- mpfr_mul_2ui (scaled_v, x, scale, GMP_RNDN);
- mpfr_mul (u, scaled_v, y, GMP_RNDN);
+ mpfr_mul_2ui (scaled_v, x, scale, MPFR_RNDN);
+ mpfr_mul (u, scaled_v, y, MPFR_RNDN);
}
else
{
mpfr_init2 (scaled_v, MPFR_PREC (y));
- mpfr_mul_2ui (scaled_v, y, scale, GMP_RNDN);
- mpfr_mul (u, x, scaled_v, GMP_RNDN);
+ mpfr_mul_2ui (scaled_v, y, scale, MPFR_RNDN);
+ mpfr_mul (u, x, scaled_v, MPFR_RNDN);
});
mpfr_clear (scaled_v);
MPFR_ASSERTN (! MPFR_OVERFLOW (flags));
@@ -270,10 +270,10 @@ mpfr_fms (mpfr_ptr s, mpfr_srcptr x, mpfr_srcptr y, mpfr_srcptr z,
is not possible, but let's check that anyway. */
MPFR_ASSERTN (! MPFR_OVERFLOW (flags)); /* TODO... */
MPFR_ASSERTN (! MPFR_UNDERFLOW (flags)); /* not possible */
- inex2 = mpfr_div_2ui (s, s, scale, GMP_RNDN);
- /* FIXME: this seems incorrect. GMP_RNDN -> rnd_mode?
+ inex2 = mpfr_div_2ui (s, s, scale, MPFR_RNDN);
+ /* FIXME: this seems incorrect. MPFR_RNDN -> rnd_mode?
Also, handle the double rounding case:
- s / 2^scale = 2^(emin - 2) in GMP_RNDN. */
+ s / 2^scale = 2^(emin - 2) in MPFR_RNDN. */
if (inex2) /* underflow */
inexact = inex2;
}
diff --git a/gamma.c b/gamma.c
index 858bd58ef..e50cd5722 100644
--- a/gamma.c
+++ b/gamma.c
@@ -72,16 +72,16 @@ bits_fac (unsigned long n)
unsigned long r, k;
mpfr_init2 (x, 38);
mpfr_init2 (y, 38);
- mpfr_set_ui (x, n, GMP_RNDZ);
+ mpfr_set_ui (x, n, MPFR_RNDZ);
mpfr_set_str_binary (y, "10.101101111110000101010001011000101001"); /* upper bound of e */
- mpfr_div (x, x, y, GMP_RNDZ);
- mpfr_pow_ui (x, x, n, GMP_RNDZ);
- mpfr_const_pi (y, GMP_RNDZ);
- mpfr_mul_ui (y, y, 2 * n, GMP_RNDZ);
- mpfr_sqrt (y, y, GMP_RNDZ);
- mpfr_mul (x, x, y, GMP_RNDZ);
- mpfr_log2 (x, x, GMP_RNDZ);
- r = mpfr_get_ui (x, GMP_RNDU);
+ mpfr_div (x, x, y, MPFR_RNDZ);
+ mpfr_pow_ui (x, x, n, MPFR_RNDZ);
+ mpfr_const_pi (y, MPFR_RNDZ);
+ mpfr_mul_ui (y, y, 2 * n, MPFR_RNDZ);
+ mpfr_sqrt (y, y, MPFR_RNDZ);
+ mpfr_mul (x, x, y, MPFR_RNDZ);
+ mpfr_log2 (x, x, MPFR_RNDZ);
+ r = mpfr_get_ui (x, MPFR_RNDU);
for (k = 2; k <= n; k *= 2)
r -= n / k;
mpfr_clear (x);
@@ -168,7 +168,7 @@ mpfr_gamma (mpfr_ptr gamma, mpfr_srcptr x, mp_rnd_t rnd_mode)
{
if (positive)
{
- if (rnd_mode == GMP_RNDU || rnd_mode == GMP_RNDN)
+ if (rnd_mode == MPFR_RNDU || rnd_mode == MPFR_RNDN)
inex = 1;
else /* round to zero or to -Inf */
{
@@ -178,7 +178,7 @@ mpfr_gamma (mpfr_ptr gamma, mpfr_srcptr x, mp_rnd_t rnd_mode)
}
else /* negative */
{
- if (rnd_mode == GMP_RNDU || rnd_mode == GMP_RNDZ)
+ if (rnd_mode == MPFR_RNDU || rnd_mode == MPFR_RNDZ)
{
mpfr_nextabove (gamma); /* -2^k + epsilon */
inex = 1;
@@ -210,12 +210,12 @@ mpfr_gamma (mpfr_ptr gamma, mpfr_srcptr x, mp_rnd_t rnd_mode)
Warning: since the generic code does not handle exact cases,
we want all cases where gamma(x) is exact to be treated here.
*/
- if (is_integer && mpfr_fits_ulong_p (x, GMP_RNDN))
+ if (is_integer && mpfr_fits_ulong_p (x, MPFR_RNDN))
{
unsigned long int u;
mp_prec_t p = MPFR_PREC(gamma);
- u = mpfr_get_ui (x, GMP_RNDN);
- if (u < 44787929UL && bits_fac (u - 1) <= p + (rnd_mode == GMP_RNDN))
+ u = mpfr_get_ui (x, MPFR_RNDN);
+ if (u < 44787929UL && bits_fac (u - 1) <= p + (rnd_mode == MPFR_RNDN))
/* bits_fac: lower bound on the number of bits of m,
where gamma(x) = (u-1)! = m*2^e with m odd. */
return mpfr_fac_ui (gamma, u - 1, rnd_mode);
@@ -238,14 +238,14 @@ mpfr_gamma (mpfr_ptr gamma, mpfr_srcptr x, mp_rnd_t rnd_mode)
mpfr_init2 (xp, 53);
mpfr_init2 (yp, 53);
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_mul (xp, x, xp, MPFR_RNDZ);
+ mpfr_sub_ui (yp, x, 2, MPFR_RNDZ);
+ mpfr_pow (xp, xp, yp, MPFR_RNDZ); /* (x/e)^(x-2) */
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); /* lower bound on x^(x-1) / e^x */
- MPFR_BLOCK (flags, mpfr_mul_2ui (xp, xp, 1, GMP_RNDZ));
+ mpfr_mul (xp, xp, yp, MPFR_RNDZ); /* x^(x-2) / e^(x-1) */
+ mpfr_mul (xp, xp, yp, MPFR_RNDZ); /* x^(x-2) / e^x */
+ mpfr_mul (xp, xp, x, MPFR_RNDZ); /* lower bound on x^(x-1) / e^x */
+ MPFR_BLOCK (flags, mpfr_mul_2ui (xp, xp, 1, MPFR_RNDZ));
mpfr_clear (xp);
mpfr_clear (yp);
return MPFR_OVERFLOW (flags) ? mpfr_overflow (gamma, rnd_mode, 1)
@@ -273,10 +273,10 @@ mpfr_gamma (mpfr_ptr gamma, mpfr_srcptr x, mp_rnd_t rnd_mode)
mpfr_init2 (tmp2, 53);
/* we want an upper bound for x * [log(2-x)-1].
since x < 0, we need a lower bound on log(2-x) */
- mpfr_ui_sub (xp, 2, x, GMP_RNDD);
- mpfr_log (xp, xp, GMP_RNDD);
- mpfr_sub_ui (xp, xp, 1, GMP_RNDD);
- mpfr_mul (xp, xp, x, GMP_RNDU);
+ mpfr_ui_sub (xp, 2, x, MPFR_RNDD);
+ mpfr_log (xp, xp, MPFR_RNDD);
+ mpfr_sub_ui (xp, xp, 1, MPFR_RNDD);
+ mpfr_mul (xp, xp, x, MPFR_RNDU);
/* we need an upper bound on 1/|sin(Pi*(2-x))|,
thus a lower bound on |sin(Pi*(2-x))|.
@@ -288,23 +288,23 @@ mpfr_gamma (mpfr_ptr gamma, mpfr_srcptr x, mp_rnd_t rnd_mode)
w += 17; /* to get tmp2 small enough */
mpfr_set_prec (tmp, w);
mpfr_set_prec (tmp2, w);
- ck = mpfr_ui_sub (tmp, 2, x, GMP_RNDN);
+ ck = mpfr_ui_sub (tmp, 2, x, MPFR_RNDN);
MPFR_ASSERTD (ck == 0);
- mpfr_const_pi (tmp2, GMP_RNDN);
- mpfr_mul (tmp2, tmp2, tmp, GMP_RNDN); /* Pi*(2-x) */
- mpfr_sin (tmp, tmp2, GMP_RNDN); /* sin(Pi*(2-x)) */
+ mpfr_const_pi (tmp2, MPFR_RNDN);
+ mpfr_mul (tmp2, tmp2, tmp, MPFR_RNDN); /* Pi*(2-x) */
+ mpfr_sin (tmp, tmp2, MPFR_RNDN); /* sin(Pi*(2-x)) */
sgn = mpfr_sgn (tmp);
- mpfr_abs (tmp, tmp, GMP_RNDN);
- mpfr_mul_ui (tmp2, tmp2, 3, GMP_RNDU); /* 3Pi(2-x) */
- mpfr_add_ui (tmp2, tmp2, 1, GMP_RNDU); /* 3Pi(2-x)+1 */
- mpfr_div_2ui (tmp2, tmp2, mpfr_get_prec (tmp), GMP_RNDU);
+ mpfr_abs (tmp, tmp, MPFR_RNDN);
+ mpfr_mul_ui (tmp2, tmp2, 3, MPFR_RNDU); /* 3Pi(2-x) */
+ mpfr_add_ui (tmp2, tmp2, 1, MPFR_RNDU); /* 3Pi(2-x)+1 */
+ mpfr_div_2ui (tmp2, tmp2, mpfr_get_prec (tmp), MPFR_RNDU);
/* if tmp2<|tmp|, we get a lower bound */
if (mpfr_cmp (tmp2, tmp) < 0)
{
- mpfr_sub (tmp, tmp, tmp2, GMP_RNDZ); /* low bnd on |sin(Pi*(2-x))| */
- mpfr_ui_div (tmp, 12, tmp, GMP_RNDU); /* upper bound */
- mpfr_log (tmp, tmp, GMP_RNDU);
- mpfr_add (tmp, tmp, xp, GMP_RNDU);
+ mpfr_sub (tmp, tmp, tmp2, MPFR_RNDZ); /* low bnd on |sin(Pi*(2-x))| */
+ mpfr_ui_div (tmp, 12, tmp, MPFR_RNDU); /* upper bound */
+ mpfr_log (tmp, tmp, MPFR_RNDU);
+ mpfr_add (tmp, tmp, xp, MPFR_RNDU);
underflow = mpfr_cmp_si (xp, expo.saved_emin - 2) <= 0;
}
@@ -314,7 +314,7 @@ mpfr_gamma (mpfr_ptr gamma, mpfr_srcptr x, mp_rnd_t rnd_mode)
if (underflow) /* the sign is the opposite of that of sin(Pi*(2-x)) */
{
MPFR_SAVE_EXPO_FREE (expo);
- return mpfr_underflow (gamma, (rnd_mode == GMP_RNDN) ? GMP_RNDZ : rnd_mode, -sgn);
+ return mpfr_underflow (gamma, (rnd_mode == MPFR_RNDN) ? MPFR_RNDZ : rnd_mode, -sgn);
}
}
@@ -344,13 +344,13 @@ mpfr_gamma (mpfr_ptr gamma, mpfr_srcptr x, mp_rnd_t rnd_mode)
/* reflection formula: gamma(x) = Pi*(x-1)/sin(Pi*(2-x))/gamma(2-x) */
- ck = mpfr_ui_sub (xp, 2, x, GMP_RNDN);
+ ck = mpfr_ui_sub (xp, 2, x, MPFR_RNDN);
MPFR_ASSERTD(ck == 0); /* 2-x, exact */
- mpfr_gamma (tmp, xp, GMP_RNDN); /* gamma(2-x), error (1+u) */
- mpfr_const_pi (tmp2, GMP_RNDN); /* Pi, error (1+u) */
- mpfr_mul (GammaTrial, tmp2, xp, GMP_RNDN); /* Pi*(2-x), error (1+u)^2 */
+ mpfr_gamma (tmp, xp, MPFR_RNDN); /* gamma(2-x), error (1+u) */
+ mpfr_const_pi (tmp2, MPFR_RNDN); /* Pi, error (1+u) */
+ mpfr_mul (GammaTrial, tmp2, xp, MPFR_RNDN); /* Pi*(2-x), error (1+u)^2 */
err_g = MPFR_GET_EXP(GammaTrial);
- mpfr_sin (GammaTrial, GammaTrial, GMP_RNDN); /* sin(Pi*(2-x)) */
+ mpfr_sin (GammaTrial, GammaTrial, MPFR_RNDN); /* sin(Pi*(2-x)) */
err_g = err_g + 1 - MPFR_GET_EXP(GammaTrial);
/* let g0 the true value of Pi*(2-x), g the computed value.
We have g = g0 + h with |h| <= |(1+u^2)-1|*g.
@@ -358,17 +358,17 @@ mpfr_gamma (mpfr_ptr gamma, mpfr_srcptr x, mp_rnd_t rnd_mode)
The relative error is thus bounded by |(1+u^2)-1|*g/sin(g)
<= |(1+u^2)-1|*2^err_g. <= 2.25*u*2^err_g for |u|<=1/4.
With the rounding error, this gives (0.5 + 2.25*2^err_g)*u. */
- ck = mpfr_sub_ui (xp, x, 1, GMP_RNDN);
+ ck = mpfr_sub_ui (xp, x, 1, MPFR_RNDN);
MPFR_ASSERTD(ck == 0); /* x-1, exact */
- mpfr_mul (xp, tmp2, xp, GMP_RNDN); /* Pi*(x-1), error (1+u)^2 */
- mpfr_mul (GammaTrial, GammaTrial, tmp, GMP_RNDN);
+ mpfr_mul (xp, tmp2, xp, MPFR_RNDN); /* Pi*(x-1), error (1+u)^2 */
+ mpfr_mul (GammaTrial, GammaTrial, tmp, MPFR_RNDN);
/* [1 + (0.5 + 2.25*2^err_g)*u]*(1+u)^2 = 1 + (2.5 + 2.25*2^err_g)*u
+ (0.5 + 2.25*2^err_g)*u*(2u+u^2) + u^2.
For err_g <= realprec-2, we have (0.5 + 2.25*2^err_g)*u <=
0.5*u + 2.25/4 <= 0.6875 and u^2 <= u/4, thus
(0.5 + 2.25*2^err_g)*u*(2u+u^2) + u^2 <= 0.6875*(2u+u/4) + u/4
<= 1.8*u, thus the rel. error is bounded by (4.5 + 2.25*2^err_g)*u. */
- mpfr_div (GammaTrial, xp, GammaTrial, GMP_RNDN);
+ mpfr_div (GammaTrial, xp, GammaTrial, MPFR_RNDN);
/* the error is of the form (1+u)^3/[1 + (4.5 + 2.25*2^err_g)*u].
For realprec >= 5 and err_g <= realprec-2, [(4.5 + 2.25*2^err_g)*u]^2
<= 0.71, and for |y|<=0.71, 1/(1-y) can be written 1+a*y with a<=4.
diff --git a/gen_inverse.h b/gen_inverse.h
index db558d16a..a23ab61aa 100644
--- a/gen_inverse.h
+++ b/gen_inverse.h
@@ -36,7 +36,7 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
#define INVERSE mpfr_cos
#define ACTION_NAN(y) do { MPFR_SET_NAN(y); MPFR_RET_NAN; } while (1)
#define ACTION_INF(y) do { MPFR_SET_NAN(y); MPFR_RET_NAN; } while (1)
-#define ACTION_ZERO(y) return mpfr_set_ui (y, 1, GMP_RNDN)
+#define ACTION_ZERO(y) return mpfr_set_ui (y, 1, MPFR_RNDN)
#include "gen_inverse.h"
*/
@@ -72,7 +72,7 @@ FUNCTION (mpfr_ptr y, mpfr_srcptr x, mp_rnd_t rnd_mode)
{
MPFR_BLOCK_DECL (flags);
- MPFR_BLOCK (flags, INVERSE (z, x, GMP_RNDZ)); /* error k_u < 1 ulp */
+ MPFR_BLOCK (flags, INVERSE (z, x, MPFR_RNDZ)); /* error k_u < 1 ulp */
/* FIXME: the following assumes that if an overflow happens with
MPFR_EMAX_MAX, then necessarily an underflow happens with
__gmpfr_emin */
@@ -82,10 +82,10 @@ FUNCTION (mpfr_ptr y, mpfr_srcptr x, mp_rnd_t rnd_mode)
MPFR_ZIV_FREE (loop);
mpfr_clear (z);
MPFR_SAVE_EXPO_FREE (expo);
- return mpfr_underflow (y, (rnd_mode == GMP_RNDN) ?
- GMP_RNDZ : rnd_mode, s);
+ return mpfr_underflow (y, (rnd_mode == MPFR_RNDN) ?
+ MPFR_RNDZ : rnd_mode, s);
}
- mpfr_ui_div (z, 1, z, GMP_RNDN);
+ mpfr_ui_div (z, 1, z, MPFR_RNDN);
/* the error is less than c_w + 2*c_u*k_u (see algorithms.tex),
where c_w = 1/2, c_u = 1 since z was rounded towards zero,
thus 1/2 + 2 < 4 */
diff --git a/get_d.c b/get_d.c
index 128b33721..6c420f70c 100644
--- a/get_d.c
+++ b/get_d.c
@@ -182,11 +182,11 @@ mpfr_get_d (mpfr_srcptr src, mp_rnd_t rnd_mode)
as this gives 0 instead of the correct result with gcc on some
Alpha machines. */
d = negative ?
- (rnd_mode == GMP_RNDD ||
- (rnd_mode == GMP_RNDN && mpfr_cmp_si_2exp(src, -1, -1075) < 0)
+ (rnd_mode == MPFR_RNDD ||
+ (rnd_mode == MPFR_RNDN && mpfr_cmp_si_2exp(src, -1, -1075) < 0)
? -DBL_MIN : DBL_NEG_ZERO) :
- (rnd_mode == GMP_RNDU ||
- (rnd_mode == GMP_RNDN && mpfr_cmp_si_2exp(src, 1, -1075) > 0)
+ (rnd_mode == MPFR_RNDU ||
+ (rnd_mode == MPFR_RNDN && mpfr_cmp_si_2exp(src, 1, -1075) > 0)
? DBL_MIN : 0.0);
if (d != 0.0)
d *= DBL_EPSILON;
@@ -195,9 +195,9 @@ mpfr_get_d (mpfr_srcptr src, mp_rnd_t rnd_mode)
else if (MPFR_UNLIKELY (e > 1024))
{
d = negative ?
- (rnd_mode == GMP_RNDZ || rnd_mode == GMP_RNDU ?
+ (rnd_mode == MPFR_RNDZ || rnd_mode == MPFR_RNDU ?
-DBL_MAX : MPFR_DBL_INFM) :
- (rnd_mode == GMP_RNDZ || rnd_mode == GMP_RNDD ?
+ (rnd_mode == MPFR_RNDZ || rnd_mode == MPFR_RNDD ?
DBL_MAX : MPFR_DBL_INFP);
}
else
diff --git a/get_d64.c b/get_d64.c
index 7785f7984..ade90be98 100644
--- a/get_d64.c
+++ b/get_d64.c
@@ -322,9 +322,9 @@ mpfr_get_decimal64 (mpfr_srcptr src, mp_rnd_t rnd_mode)
with 2^(-1323) < 10^(-398) < 2^(-1322) */
if (MPFR_UNLIKELY (e < -1323)) /* src <= 2^(-1324) < 1/2*10^(-398) */
{
- if (rnd_mode == GMP_RNDZ || rnd_mode == GMP_RNDN
- || (rnd_mode == GMP_RNDD && negative == 0)
- || (rnd_mode == GMP_RNDU && negative != 0))
+ if (rnd_mode == MPFR_RNDZ || rnd_mode == MPFR_RNDN
+ || (rnd_mode == MPFR_RNDD && negative == 0)
+ || (rnd_mode == MPFR_RNDU && negative != 0))
return get_decimal64_zero (negative);
else /* return the smallest non-zero number */
return get_decimal64_min (negative);
@@ -332,8 +332,8 @@ mpfr_get_decimal64 (mpfr_srcptr src, mp_rnd_t rnd_mode)
/* the largest decimal64 number is just below 10^(385) < 2^1279 */
else if (MPFR_UNLIKELY (e > 1279)) /* then src >= 2^1279 */
{
- if (GMP_RNDZ || (rnd_mode == GMP_RNDU && negative != 0)
- || (rnd_mode == GMP_RNDD && negative == 0))
+ if (MPFR_RNDZ || (rnd_mode == MPFR_RNDU && negative != 0)
+ || (rnd_mode == MPFR_RNDD && negative == 0))
return get_decimal64_max (negative);
else
return get_decimal64_inf (negative);
@@ -352,9 +352,9 @@ mpfr_get_decimal64 (mpfr_srcptr src, mp_rnd_t rnd_mode)
which corresponds to s=[0.]1000...000 and e=-397 */
if (e < -397)
{
- if (rnd_mode == GMP_RNDZ || rnd_mode == GMP_RNDN
- || (rnd_mode == GMP_RNDD && negative == 0)
- || (rnd_mode == GMP_RNDU && negative != 0))
+ if (rnd_mode == MPFR_RNDZ || rnd_mode == MPFR_RNDN
+ || (rnd_mode == MPFR_RNDD && negative == 0)
+ || (rnd_mode == MPFR_RNDU && negative != 0))
return get_decimal64_zero (negative);
else /* return the smallest non-zero number */
return get_decimal64_min (negative);
@@ -376,8 +376,8 @@ mpfr_get_decimal64 (mpfr_srcptr src, mp_rnd_t rnd_mode)
which corresponds to s=[0.]9999...999 and e=385 */
else if (e > 385)
{
- if (GMP_RNDZ || (rnd_mode == GMP_RNDU && negative != 0)
- || (rnd_mode == GMP_RNDD && negative == 0))
+ if (MPFR_RNDZ || (rnd_mode == MPFR_RNDU && negative != 0)
+ || (rnd_mode == MPFR_RNDD && negative == 0))
return get_decimal64_max (negative);
else
return get_decimal64_inf (negative);
diff --git a/get_ld.c b/get_ld.c
index 757fd2d2c..46cefb34e 100644
--- a/get_ld.c
+++ b/get_ld.c
@@ -56,10 +56,10 @@ mpfr_get_ld (mpfr_srcptr x, mp_rnd_t rnd_mode)
r = 0.0;
do {
- s = mpfr_get_d (y, GMP_RNDN); /* high part of y */
+ s = mpfr_get_d (y, MPFR_RNDN); /* high part of y */
r += (long double) s;
- mpfr_set_d (z, s, GMP_RNDN); /* exact */
- mpfr_sub (y, y, z, GMP_RNDN); /* exact */
+ mpfr_set_d (z, s, MPFR_RNDN); /* exact */
+ mpfr_sub (y, y, z, MPFR_RNDN); /* exact */
} while (!MPFR_IS_ZERO (y));
mpfr_clear (z);
@@ -115,7 +115,7 @@ mpfr_get_ld (mpfr_srcptr x, mp_rnd_t rnd_mode)
mpfr_init2 (tmp, MPFR_LDBL_MANT_DIG);
mpfr_subnormalize(tmp, mpfr_set (tmp, x, rnd_mode), rnd_mode);
- mpfr_prec_round (tmp, 64, GMP_RNDZ); /* exact */
+ mpfr_prec_round (tmp, 64, MPFR_RNDZ); /* exact */
if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (tmp)))
ld.ld = (long double) mpfr_get_d (tmp, rnd_mode);
else
diff --git a/get_sj.c b/get_sj.c
index 7968c713c..3f7a280a5 100644
--- a/get_sj.c
+++ b/get_sj.c
@@ -64,7 +64,7 @@ mpfr_get_sj (mpfr_srcptr f, mpfr_rnd_t rnd)
}
/* Note: though INTMAX_MAX would have been sufficient for the conversion,
we chose INTMAX_MIN so that INTMAX_MIN - 1 is always representable in
- precision prec; this is useful to detect overflows in GMP_RNDZ (will
+ precision prec; this is useful to detect overflows in MPFR_RNDZ (will
be needed later). */
/* Now, r = 0. */
diff --git a/get_str.c b/get_str.c
index f822a5480..0b04900b4 100644
--- a/get_str.c
+++ b/get_str.c
@@ -110,7 +110,7 @@ mpfr_get_str_aux (char *const str, mp_exp_t *const exp, mp_limb_t *const r,
n * BITS_PER_MP_LIMB + f */
if (exact || mpfr_can_round_raw (r, n, (mp_size_t) 1,
- n * BITS_PER_MP_LIMB - e, GMP_RNDN, rnd, n * BITS_PER_MP_LIMB + f))
+ n * BITS_PER_MP_LIMB - e, MPFR_RNDN, rnd, n * BITS_PER_MP_LIMB + f))
{
/* compute the nearest integer to R */
@@ -163,14 +163,14 @@ mpfr_get_str_aux (char *const str, mp_exp_t *const exp, mp_limb_t *const r,
rnd1 = rnd;
/* round to nearest case */
- if (rnd == GMP_RNDN)
+ if (rnd == MPFR_RNDN)
{
if (2 * str1[size_s1 - 1] == b)
{
if (dir == 0 && exact) /* exact: even rounding */
{
rnd1 = ((str1[size_s1-2] & 1) == 0)
- ? GMP_RNDD : GMP_RNDU;
+ ? MPFR_RNDD : MPFR_RNDU;
}
else
{
@@ -184,16 +184,16 @@ mpfr_get_str_aux (char *const str, mp_exp_t *const exp, mp_limb_t *const r,
}
}
else if (2 * str1[size_s1 - 1] < b)
- rnd1 = GMP_RNDD;
+ rnd1 = MPFR_RNDD;
else
- rnd1 = GMP_RNDU;
+ rnd1 = MPFR_RNDU;
}
- /* now rnd1 is either GMP_RNDD or GMP_RNDZ -> truncate
+ /* now rnd1 is either MPFR_RNDD or MPFR_RNDZ -> truncate
or GMP_RDNU -> round towards infinity */
/* round away from zero */
- if (rnd1 == GMP_RNDU)
+ if (rnd1 == MPFR_RNDU)
{
if (str1[size_s1 - 1] != 0)
{
@@ -1375,9 +1375,9 @@ ceil_mul (mp_exp_t e, int beta, int i)
p = &__gmpfr_l2b[beta-2][i];
mpfr_init2 (t, sizeof (mp_exp_t) * CHAR_BIT);
- mpfr_set_exp_t (t, e, GMP_RNDU);
- mpfr_mul (t, t, p, GMP_RNDU);
- r = mpfr_get_exp_t (t, GMP_RNDU);
+ mpfr_set_exp_t (t, e, MPFR_RNDU);
+ mpfr_mul (t, t, p, MPFR_RNDU);
+ r = mpfr_get_exp_t (t, MPFR_RNDU);
mpfr_clear (t);
return r;
}
diff --git a/gmp_op.c b/gmp_op.c
index 510037248..4e044f7e5 100644
--- a/gmp_op.c
+++ b/gmp_op.c
@@ -35,7 +35,7 @@ init_set_z (mpfr_ptr t, mpz_srcptr z)
else
MPFR_MPZ_SIZEINBASE2 (p, z);
mpfr_init2 (t, p);
- i = mpfr_set_z (t, z, GMP_RNDN);
+ i = mpfr_set_z (t, z, MPFR_RNDN);
MPFR_ASSERTD (i == 0);
}
@@ -109,7 +109,7 @@ mpfr_mul_q (mpfr_ptr y, mpfr_srcptr x, mpq_srcptr z, mp_rnd_t rnd_mode)
{
MPFR_MPZ_SIZEINBASE2 (p, mpq_numref (z));
mpfr_init2 (tmp, MPFR_PREC (x) + p);
- res = mpfr_mul_z (tmp, x, mpq_numref(z), GMP_RNDN );
+ res = mpfr_mul_z (tmp, x, mpq_numref(z), MPFR_RNDN );
MPFR_ASSERTD (res == 0);
res = mpfr_div_z (y, tmp, mpq_denref(z), rnd_mode);
mpfr_clear (tmp);
@@ -131,7 +131,7 @@ mpfr_div_q (mpfr_ptr y, mpfr_srcptr x, mpq_srcptr z, mp_rnd_t rnd_mode)
else
MPFR_MPZ_SIZEINBASE2 (p, mpq_denref (z));
mpfr_init2 (tmp, MPFR_PREC(x) + p);
- res = mpfr_mul_z (tmp, x, mpq_denref(z), GMP_RNDN );
+ res = mpfr_mul_z (tmp, x, mpq_denref(z), MPFR_RNDN );
MPFR_ASSERTD( res == 0 );
res = mpfr_div_z (y, tmp, mpq_numref(z), rnd_mode);
mpfr_clear (tmp);
@@ -178,7 +178,7 @@ mpfr_add_q (mpfr_ptr y, mpfr_srcptr x, mpq_srcptr z, mp_rnd_t rnd_mode)
MPFR_ZIV_INIT (loop, p);
for (;;)
{
- res = mpfr_set_q (q, z, GMP_RNDN); /* Error <= 1/2 ulp(q) */
+ res = mpfr_set_q (q, z, MPFR_RNDN); /* Error <= 1/2 ulp(q) */
/* If z if @INF@ (1/0), res = 0, so it quits immediately */
if (MPFR_UNLIKELY (res == 0))
/* Result is exact so we can add it directly! */
@@ -186,7 +186,7 @@ mpfr_add_q (mpfr_ptr y, mpfr_srcptr x, mpq_srcptr z, mp_rnd_t rnd_mode)
res = mpfr_add (y, x, q, rnd_mode);
break;
}
- mpfr_add (t, x, q, GMP_RNDN); /* Error <= 1/2 ulp(t) */
+ mpfr_add (t, x, q, MPFR_RNDN); /* Error <= 1/2 ulp(t) */
/* Error / ulp(t) <= 1/2 + 1/2 * 2^(EXP(q)-EXP(t))
If EXP(q)-EXP(t)>0, <= 2^(EXP(q)-EXP(t)-1)*(1+2^-(EXP(q)-EXP(t)))
<= 2^(EXP(q)-EXP(t))
@@ -256,7 +256,7 @@ mpfr_sub_q (mpfr_ptr y, mpfr_srcptr x, mpq_srcptr z,mp_rnd_t rnd_mode)
MPFR_ZIV_INIT (loop, p);
for(;;)
{
- res = mpfr_set_q(q, z, GMP_RNDN); /* Error <= 1/2 ulp(q) */
+ res = mpfr_set_q(q, z, MPFR_RNDN); /* Error <= 1/2 ulp(q) */
/* If z if @INF@ (1/0), res = 0, so it quits immediately */
if (MPFR_UNLIKELY (res == 0))
/* Result is exact so we can add it directly!*/
@@ -264,7 +264,7 @@ mpfr_sub_q (mpfr_ptr y, mpfr_srcptr x, mpq_srcptr z,mp_rnd_t rnd_mode)
res = mpfr_sub (y, x, q, rnd_mode);
break;
}
- mpfr_sub (t, x, q, GMP_RNDN); /* Error <= 1/2 ulp(t) */
+ mpfr_sub (t, x, q, MPFR_RNDN); /* Error <= 1/2 ulp(t) */
/* Error / ulp(t) <= 1/2 + 1/2 * 2^(EXP(q)-EXP(t))
If EXP(q)-EXP(t)>0, <= 2^(EXP(q)-EXP(t)-1)*(1+2^-(EXP(q)-EXP(t)))
<= 2^(EXP(q)-EXP(t))
@@ -300,7 +300,7 @@ mpfr_cmp_q (mpfr_srcptr x, mpq_srcptr z)
MPFR_ASSERTD (mpz_sgn (mpq_denref (z)) != 0);
MPFR_MPZ_SIZEINBASE2 (p, mpq_denref (z));
mpfr_init2 (t, MPFR_PREC(x) + p);
- res = mpfr_mul_z (t, x, mpq_denref (z), GMP_RNDN );
+ res = mpfr_mul_z (t, x, mpq_denref (z), MPFR_RNDN );
MPFR_ASSERTD (res == 0);
res = mpfr_cmp_z (t, mpq_numref (z) );
mpfr_clear (t);
@@ -314,7 +314,7 @@ mpfr_cmp_f (mpfr_srcptr x, mpf_srcptr z)
int res;
mpfr_init2 (t, MPFR_PREC_MIN + ABS(SIZ(z)) * BITS_PER_MP_LIMB );
- res = mpfr_set_f (t, z, GMP_RNDN);
+ res = mpfr_set_f (t, z, MPFR_RNDN);
MPFR_ASSERTD (res == 0);
res = mpfr_cmp (x, t);
mpfr_clear (t);
diff --git a/hypot.c b/hypot.c
index cf68720f4..31d15986d 100644
--- a/hypot.c
+++ b/hypot.c
@@ -78,16 +78,16 @@ mpfr_hypot (mpfr_ptr z, mpfr_srcptr x, mpfr_srcptr y, mp_rnd_t rnd_mode)
N = MPFR_PREC (x); /* Precision of input variable */
Nz = MPFR_PREC (z); /* Precision of output variable */
- threshold = (MAX (N, Nz) + (rnd_mode == GMP_RNDN ? 1 : 0)) << 1;
- if (rnd_mode == GMP_RNDA)
- rnd_mode = GMP_RNDU; /* since the result is positive, RNDA = RNDU */
+ threshold = (MAX (N, Nz) + (rnd_mode == MPFR_RNDN ? 1 : 0)) << 1;
+ if (rnd_mode == MPFR_RNDA)
+ rnd_mode = MPFR_RNDU; /* since the result is positive, RNDA = RNDU */
/* Is |x| a suitable approximation to the precision Nz ?
(see algorithms.tex for explanations) */
if (diff_exp > threshold)
/* result is |x| or |x|+ulp(|x|,Nz) */
{
- if (MPFR_UNLIKELY (rnd_mode == GMP_RNDU))
+ if (MPFR_UNLIKELY (rnd_mode == MPFR_RNDU))
{
/* If z > abs(x), then it was already rounded up; otherwise
z = abs(x), and we need to add one ulp due to y. */
@@ -95,7 +95,7 @@ mpfr_hypot (mpfr_ptr z, mpfr_srcptr x, mpfr_srcptr y, mp_rnd_t rnd_mode)
mpfr_nexttoinf (z);
MPFR_RET (1);
}
- else /* GMP_RNDZ, GMP_RNDD, GMP_RNDN */
+ else /* MPFR_RNDZ, MPFR_RNDD, MPFR_RNDN */
{
if (MPFR_LIKELY (Nz >= N))
{
@@ -144,12 +144,12 @@ mpfr_hypot (mpfr_ptr z, mpfr_srcptr x, mpfr_srcptr y, mp_rnd_t rnd_mode)
{
mp_prec_t err;
- exact = mpfr_mul_2si (te, x, sh, GMP_RNDZ);
- exact |= mpfr_mul_2si (ti, y, sh, GMP_RNDZ);
- exact |= mpfr_sqr (te, te, GMP_RNDZ);
+ exact = mpfr_mul_2si (te, x, sh, MPFR_RNDZ);
+ exact |= mpfr_mul_2si (ti, y, sh, MPFR_RNDZ);
+ exact |= mpfr_sqr (te, te, MPFR_RNDZ);
/* Use fma in order to avoid underflow when diff_exp<=MPFR_EMAX_MAX-2 */
- exact |= mpfr_fma (t, ti, ti, te, GMP_RNDZ);
- exact |= mpfr_sqrt (t, t, GMP_RNDZ);
+ exact |= mpfr_fma (t, ti, ti, te, MPFR_RNDZ);
+ exact |= mpfr_sqrt (t, t, MPFR_RNDZ);
err = Nt < N ? 4 : 2;
if (MPFR_LIKELY (exact == 0
diff --git a/jn.c b/jn.c
index 3874486fe..23d7704ac 100644
--- a/jn.c
+++ b/jn.c
@@ -54,17 +54,17 @@ mpfr_jn_k0 (long n, mpfr_srcptr z)
mpfr_init2 (t, 32);
mpfr_init2 (u, 32);
- mpfr_div_si (t, z, n, GMP_RNDN);
- mpfr_sqr (t, t, GMP_RNDN);
- mpfr_add_ui (t, t, 1, GMP_RNDN);
- mpfr_sqrt (t, t, GMP_RNDN);
- mpfr_sub_ui (t, t, 1, GMP_RNDN);
- mpfr_mul_si (t, t, n, GMP_RNDN);
+ mpfr_div_si (t, z, n, MPFR_RNDN);
+ mpfr_sqr (t, t, MPFR_RNDN);
+ mpfr_add_ui (t, t, 1, MPFR_RNDN);
+ mpfr_sqrt (t, t, MPFR_RNDN);
+ mpfr_sub_ui (t, t, 1, MPFR_RNDN);
+ mpfr_mul_si (t, t, n, MPFR_RNDN);
/* the following is a 32-bit approximation to nearest of log(2) */
mpfr_set_str_binary (u, "0.10110001011100100001011111111");
- mpfr_div (t, t, u, GMP_RNDN);
- if (mpfr_fits_ulong_p (t, GMP_RNDN))
- k0 = mpfr_get_ui (t, GMP_RNDN);
+ mpfr_div (t, t, u, MPFR_RNDN);
+ if (mpfr_fits_ulong_p (t, MPFR_RNDN))
+ k0 = mpfr_get_ui (t, MPFR_RNDN);
else
k0 = ULONG_MAX;
mpfr_clear (t);
@@ -149,13 +149,13 @@ mpfr_jn (mpfr_ptr res, long n, mpfr_srcptr z, mp_rnd_t r)
/* the following is an upper 32-bit approximation of exp(1)/2 */
mpfr_set_str_binary (y, "1.0101101111110000101010001011001");
if (MPFR_SIGN(z) > 0)
- mpfr_mul (y, y, z, GMP_RNDU);
+ mpfr_mul (y, y, z, MPFR_RNDU);
else
{
- mpfr_mul (y, y, z, GMP_RNDD);
- mpfr_neg (y, y, GMP_RNDU);
+ mpfr_mul (y, y, z, MPFR_RNDD);
+ mpfr_neg (y, y, MPFR_RNDU);
}
- mpfr_div_ui (y, y, absn, GMP_RNDU);
+ mpfr_div_ui (y, y, absn, MPFR_RNDU);
/* now y is an upper approximation of |ze/2n|: y < 2^EXP(y),
thus |j(n,z)| < 1/2*y^n < 2^(n*EXP(y)-1).
If n*EXP(y) < __gmpfr_emin then we have an underflow.
@@ -165,7 +165,7 @@ mpfr_jn (mpfr_ptr res, long n, mpfr_srcptr z, mp_rnd_t r)
MPFR_EXP(y) < __gmpfr_emin / (mp_exp_t) absn))
{
mpfr_clear (y);
- return mpfr_underflow (res, (r == GMP_RNDN) ? GMP_RNDZ : r,
+ return mpfr_underflow (res, (r == MPFR_RNDN) ? MPFR_RNDZ : r,
(n % 2) ? ((n > 0) ? MPFR_SIGN(z) : -MPFR_SIGN(z))
: MPFR_SIGN_POS);
}
@@ -186,33 +186,33 @@ mpfr_jn (mpfr_ptr res, long n, mpfr_srcptr z, mp_rnd_t r)
mpfr_set_prec (y, prec);
mpfr_set_prec (s, prec);
mpfr_set_prec (t, prec);
- mpfr_pow_ui (t, z, absn, GMP_RNDN); /* z^|n| */
- mpfr_mul (y, z, z, GMP_RNDN); /* z^2 */
- zz = mpfr_get_ui (y, GMP_RNDU);
+ mpfr_pow_ui (t, z, absn, MPFR_RNDN); /* z^|n| */
+ mpfr_mul (y, z, z, MPFR_RNDN); /* z^2 */
+ zz = mpfr_get_ui (y, MPFR_RNDU);
MPFR_ASSERTN (zz < ULONG_MAX);
- mpfr_div_2ui (y, y, 2, GMP_RNDN); /* z^2/4 */
- mpfr_fac_ui (s, absn, GMP_RNDN); /* |n|! */
- mpfr_div (t, t, s, GMP_RNDN);
+ mpfr_div_2ui (y, y, 2, MPFR_RNDN); /* z^2/4 */
+ mpfr_fac_ui (s, absn, MPFR_RNDN); /* |n|! */
+ mpfr_div (t, t, s, MPFR_RNDN);
if (absn > 0)
- mpfr_div_2ui (t, t, absn, GMP_RNDN);
- mpfr_set (s, t, GMP_RNDN);
+ mpfr_div_2ui (t, t, absn, MPFR_RNDN);
+ mpfr_set (s, t, MPFR_RNDN);
exps = MPFR_EXP (s);
expT = exps;
for (k = 1; ; k++)
{
- mpfr_mul (t, t, y, GMP_RNDN);
- mpfr_neg (t, t, GMP_RNDN);
+ mpfr_mul (t, t, y, MPFR_RNDN);
+ mpfr_neg (t, t, MPFR_RNDN);
if (k + absn <= ULONG_MAX / k)
- mpfr_div_ui (t, t, k * (k + absn), GMP_RNDN);
+ mpfr_div_ui (t, t, k * (k + absn), MPFR_RNDN);
else
{
- mpfr_div_ui (t, t, k, GMP_RNDN);
- mpfr_div_ui (t, t, k + absn, GMP_RNDN);
+ mpfr_div_ui (t, t, k, MPFR_RNDN);
+ mpfr_div_ui (t, t, k + absn, MPFR_RNDN);
}
exps = MPFR_EXP (t);
if (exps > expT)
expT = exps;
- mpfr_add (s, s, t, GMP_RNDN);
+ mpfr_add (s, s, t, MPFR_RNDN);
exps = MPFR_EXP (s);
if (exps > expT)
expT = exps;
diff --git a/jyn_asympt.c b/jyn_asympt.c
index 61ceaa079..ba6a198e6 100644
--- a/jyn_asympt.c
+++ b/jyn_asympt.c
@@ -67,51 +67,51 @@ FUNCTION (mpfr_ptr res, long n, mpfr_srcptr z, mp_rnd_t r)
/* Approximate sin(z) and cos(z). In the following, err <= k means that
the approximate value y and the true value x are related by
y = x * (1 + u)^k with |u| <= 2^(-w), following Higham's method. */
- mpfr_sin_cos (s, c, z, GMP_RNDN);
+ mpfr_sin_cos (s, c, z, MPFR_RNDN);
if (MPFR_IS_NEG(z))
- mpfr_neg (s, s, GMP_RNDN); /* compute jn/yn(|z|), fix sign later */
+ mpfr_neg (s, s, MPFR_RNDN); /* compute jn/yn(|z|), fix sign later */
/* The absolute error on s/c is bounded by 1/2 ulp(1/2) <= 2^(-w-1). */
- mpfr_add (t, s, c, GMP_RNDN);
- mpfr_sub (c, s, c, GMP_RNDN);
+ mpfr_add (t, s, c, MPFR_RNDN);
+ mpfr_sub (c, s, c, MPFR_RNDN);
mpfr_swap (s, t);
/* now s approximates sin(z)+cos(z), and c approximates sin(z)-cos(z),
with total absolute error bounded by 2^(1-w). */
/* precompute 1/(8|z|) */
- mpfr_si_div (iz, MPFR_IS_POS(z) ? 1 : -1, z, GMP_RNDN); /* err <= 1 */
- mpfr_div_2ui (iz, iz, 3, GMP_RNDN);
+ mpfr_si_div (iz, MPFR_IS_POS(z) ? 1 : -1, z, MPFR_RNDN); /* err <= 1 */
+ mpfr_div_2ui (iz, iz, 3, MPFR_RNDN);
/* compute P and Q */
- mpfr_set_ui (P, 1, GMP_RNDN);
- mpfr_set_ui (Q, 0, GMP_RNDN);
- mpfr_set_ui (t, 1, GMP_RNDN); /* current term */
- mpfr_set_ui (err_t, 0, GMP_RNDN); /* error on t */
- mpfr_set_ui (err_s, 0, GMP_RNDN); /* error on P and Q (sum of errors) */
+ mpfr_set_ui (P, 1, MPFR_RNDN);
+ mpfr_set_ui (Q, 0, MPFR_RNDN);
+ mpfr_set_ui (t, 1, MPFR_RNDN); /* current term */
+ mpfr_set_ui (err_t, 0, MPFR_RNDN); /* error on t */
+ mpfr_set_ui (err_s, 0, MPFR_RNDN); /* error on P and Q (sum of errors) */
for (k = 1, stop = 0; stop < 4; k++)
{
/* compute next term: t(k)/t(k-1) = (2n+2k-1)(2n-2k+1)/(8kz) */
- mpfr_mul_si (t, t, 2 * (n + k) - 1, GMP_RNDN); /* err <= err_k + 1 */
- mpfr_mul_si (t, t, 2 * (n - k) + 1, GMP_RNDN); /* err <= err_k + 2 */
- mpfr_div_ui (t, t, k, GMP_RNDN); /* err <= err_k + 3 */
- mpfr_mul (t, t, iz, GMP_RNDN); /* err <= err_k + 5 */
+ mpfr_mul_si (t, t, 2 * (n + k) - 1, MPFR_RNDN); /* err <= err_k + 1 */
+ mpfr_mul_si (t, t, 2 * (n - k) + 1, MPFR_RNDN); /* err <= err_k + 2 */
+ mpfr_div_ui (t, t, k, MPFR_RNDN); /* err <= err_k + 3 */
+ mpfr_mul (t, t, iz, MPFR_RNDN); /* err <= err_k + 5 */
/* the relative error on t is bounded by (1+u)^(5k)-1, which is
bounded by 6ku for 6ku <= 0.02: first |5 log(1+u)| <= |5.5u|
for |u| <= 0.15, then |exp(5.5u)-1| <= 6u for |u| <= 0.02. */
- mpfr_mul_ui (err_t, t, 6 * k, MPFR_IS_POS(t) ? GMP_RNDU : GMP_RNDD);
- mpfr_abs (err_t, err_t, GMP_RNDN); /* exact */
+ mpfr_mul_ui (err_t, t, 6 * k, MPFR_IS_POS(t) ? MPFR_RNDU : MPFR_RNDD);
+ mpfr_abs (err_t, err_t, MPFR_RNDN); /* exact */
/* the absolute error on t is bounded by err_t * 2^(-w) */
- mpfr_abs (err_u, t, GMP_RNDU);
- mpfr_mul_2ui (err_u, err_u, w, GMP_RNDU); /* t * 2^w */
- mpfr_add (err_u, err_u, err_t, GMP_RNDU); /* max|t| * 2^w */
+ mpfr_abs (err_u, t, MPFR_RNDU);
+ mpfr_mul_2ui (err_u, err_u, w, MPFR_RNDU); /* t * 2^w */
+ mpfr_add (err_u, err_u, err_t, MPFR_RNDU); /* max|t| * 2^w */
if (stop >= 2)
{
/* take into account the neglected terms: t * 2^w */
- mpfr_div_2ui (err_s, err_s, w, GMP_RNDU);
+ mpfr_div_2ui (err_s, err_s, w, MPFR_RNDU);
if (MPFR_IS_POS(t))
- mpfr_add (err_s, err_s, t, GMP_RNDU);
+ mpfr_add (err_s, err_s, t, MPFR_RNDU);
else
- mpfr_sub (err_s, err_s, t, GMP_RNDU);
- mpfr_mul_2ui (err_s, err_s, w, GMP_RNDU);
+ mpfr_sub (err_s, err_s, t, MPFR_RNDU);
+ mpfr_mul_2ui (err_s, err_s, w, MPFR_RNDU);
stop ++;
}
/* if k is odd, add to Q, otherwise to P */
@@ -119,9 +119,9 @@ FUNCTION (mpfr_ptr res, long n, mpfr_srcptr z, mp_rnd_t r)
{
/* if k = 1 mod 4, add, otherwise subtract */
if ((k & 2) == 0)
- mpfr_add (Q, Q, t, GMP_RNDN);
+ mpfr_add (Q, Q, t, MPFR_RNDN);
else
- mpfr_sub (Q, Q, t, GMP_RNDN);
+ mpfr_sub (Q, Q, t, MPFR_RNDN);
/* check if the next term is smaller than ulp(Q): if EXP(err_u)
<= EXP(Q), since the current term is bounded by
err_u * 2^(-w), it is bounded by ulp(Q) */
@@ -134,16 +134,16 @@ FUNCTION (mpfr_ptr res, long n, mpfr_srcptr z, mp_rnd_t r)
{
/* if k = 0 mod 4, add, otherwise subtract */
if ((k & 2) == 0)
- mpfr_add (P, P, t, GMP_RNDN);
+ mpfr_add (P, P, t, MPFR_RNDN);
else
- mpfr_sub (P, P, t, GMP_RNDN);
+ mpfr_sub (P, P, t, MPFR_RNDN);
/* check if the next term is smaller than ulp(P) */
if (MPFR_EXP(err_u) <= MPFR_EXP(P))
stop ++;
else
stop = 0;
}
- mpfr_add (err_s, err_s, err_t, GMP_RNDU);
+ mpfr_add (err_s, err_s, err_t, MPFR_RNDU);
/* the sum of the rounding errors on P and Q is bounded by
err_s * 2^(-w) */
@@ -168,42 +168,42 @@ FUNCTION (mpfr_ptr res, long n, mpfr_srcptr z, mp_rnd_t r)
Q * (sin + cos) + P (sin - cos) for yn */
{
#ifdef MPFR_JN
- mpfr_mul (c, c, Q, GMP_RNDN); /* Q * (sin - cos) */
- mpfr_mul (s, s, P, GMP_RNDN); /* P * (sin + cos) */
+ mpfr_mul (c, c, Q, MPFR_RNDN); /* Q * (sin - cos) */
+ mpfr_mul (s, s, P, MPFR_RNDN); /* P * (sin + cos) */
#else
- mpfr_mul (c, c, P, GMP_RNDN); /* P * (sin - cos) */
- mpfr_mul (s, s, Q, GMP_RNDN); /* Q * (sin + cos) */
+ mpfr_mul (c, c, P, MPFR_RNDN); /* P * (sin - cos) */
+ mpfr_mul (s, s, Q, MPFR_RNDN); /* Q * (sin + cos) */
#endif
err = MPFR_EXP(c);
if (MPFR_EXP(s) > err)
err = MPFR_EXP(s);
#ifdef MPFR_JN
- mpfr_sub (s, s, c, GMP_RNDN);
+ mpfr_sub (s, s, c, MPFR_RNDN);
#else
- mpfr_add (s, s, c, GMP_RNDN);
+ mpfr_add (s, s, c, MPFR_RNDN);
#endif
}
else /* n odd: P * (sin - cos) + Q (cos + sin) for jn,
Q * (sin - cos) - P (cos + sin) for yn */
{
#ifdef MPFR_JN
- mpfr_mul (c, c, P, GMP_RNDN); /* P * (sin - cos) */
- mpfr_mul (s, s, Q, GMP_RNDN); /* Q * (sin + cos) */
+ mpfr_mul (c, c, P, MPFR_RNDN); /* P * (sin - cos) */
+ mpfr_mul (s, s, Q, MPFR_RNDN); /* Q * (sin + cos) */
#else
- mpfr_mul (c, c, Q, GMP_RNDN); /* Q * (sin - cos) */
- mpfr_mul (s, s, P, GMP_RNDN); /* P * (sin + cos) */
+ mpfr_mul (c, c, Q, MPFR_RNDN); /* Q * (sin - cos) */
+ mpfr_mul (s, s, P, MPFR_RNDN); /* P * (sin + cos) */
#endif
err = MPFR_EXP(c);
if (MPFR_EXP(s) > err)
err = MPFR_EXP(s);
#ifdef MPFR_JN
- mpfr_add (s, s, c, GMP_RNDN);
+ mpfr_add (s, s, c, MPFR_RNDN);
#else
- mpfr_sub (s, c, s, GMP_RNDN);
+ mpfr_sub (s, c, s, MPFR_RNDN);
#endif
}
if ((n & 2) != 0)
- mpfr_neg (s, s, GMP_RNDN);
+ mpfr_neg (s, s, MPFR_RNDN);
if (MPFR_EXP(s) > err)
err = MPFR_EXP(s);
/* the absolute error on s is bounded by P*err(s/c) + Q*err(s/c)
@@ -218,18 +218,18 @@ FUNCTION (mpfr_ptr res, long n, mpfr_srcptr z, mp_rnd_t r)
/* now the absolute error on s is bounded by 2^(err2 - w) */
/* multiply by sqrt(1/(Pi*z)) */
- mpfr_const_pi (c, GMP_RNDN); /* Pi, err <= 1 */
- mpfr_mul (c, c, z, GMP_RNDN); /* err <= 2 */
- mpfr_si_div (c, MPFR_IS_POS(z) ? 1 : -1, c, GMP_RNDN); /* err <= 3 */
- mpfr_sqrt (c, c, GMP_RNDN); /* err<=5/2, thus the absolute error is
+ mpfr_const_pi (c, MPFR_RNDN); /* Pi, err <= 1 */
+ mpfr_mul (c, c, z, MPFR_RNDN); /* err <= 2 */
+ mpfr_si_div (c, MPFR_IS_POS(z) ? 1 : -1, c, MPFR_RNDN); /* err <= 3 */
+ mpfr_sqrt (c, c, MPFR_RNDN); /* err<=5/2, thus the absolute error is
bounded by 3*u*|c| for |u| <= 0.25 */
- mpfr_mul (err_t, c, s, MPFR_SIGN(c)==MPFR_SIGN(s) ? GMP_RNDU : GMP_RNDD);
- mpfr_abs (err_t, err_t, GMP_RNDU);
- mpfr_mul_ui (err_t, err_t, 3, GMP_RNDU);
+ mpfr_mul (err_t, c, s, MPFR_SIGN(c)==MPFR_SIGN(s) ? MPFR_RNDU : MPFR_RNDD);
+ mpfr_abs (err_t, err_t, MPFR_RNDU);
+ mpfr_mul_ui (err_t, err_t, 3, MPFR_RNDU);
/* 3*2^(-w)*|old_c|*|s| [see below] is bounded by err_t * 2^(-w) */
err2 += MPFR_EXP(c);
/* |old_c| * 2^(err2 - w) [see below] is bounded by 2^(err2-w) */
- mpfr_mul (c, c, s, GMP_RNDN); /* the absolute error on c is bounded by
+ mpfr_mul (c, c, s, MPFR_RNDN); /* the absolute error on c is bounded by
1/2 ulp(c) + 3*2^(-w)*|old_c|*|s|
+ |old_c| * 2^(err2 - w) */
/* compute err_t * 2^(-w) + 1/2 ulp(c) = (err_t + 2^EXP(c)) * 2^(-w) */
diff --git a/li2.c b/li2.c
index 52c96ff79..9f05aaf08 100644
--- a/li2.c
+++ b/li2.c
@@ -116,9 +116,9 @@ li2_series (mpfr_t sum, mpfr_srcptr z, mpfr_rnd_t rnd_mode)
MPFR_ZIV_INIT (loop, p);
for (;;)
{
- mpfr_sqr (u, z, GMP_RNDU);
- mpfr_set (v, z, GMP_RNDU);
- mpfr_set (s, z, GMP_RNDU);
+ mpfr_sqr (u, z, MPFR_RNDU);
+ mpfr_set (v, z, MPFR_RNDU);
+ mpfr_set (s, z, MPFR_RNDU);
se = MPFR_GET_EXP (s);
err = 0;
@@ -127,18 +127,18 @@ li2_series (mpfr_t sum, mpfr_srcptr z, mpfr_rnd_t rnd_mode)
if (i >= Bmax)
B = bernoulli (B, Bmax++); /* B_2i * (2i+1)!, exact */
- mpfr_mul (v, u, v, GMP_RNDU);
- mpfr_div_ui (v, v, 2 * i, GMP_RNDU);
- mpfr_div_ui (v, v, 2 * i, GMP_RNDU);
- mpfr_div_ui (v, v, 2 * i + 1, GMP_RNDU);
- mpfr_div_ui (v, v, 2 * i + 1, GMP_RNDU);
+ mpfr_mul (v, u, v, MPFR_RNDU);
+ mpfr_div_ui (v, v, 2 * i, MPFR_RNDU);
+ mpfr_div_ui (v, v, 2 * i, MPFR_RNDU);
+ mpfr_div_ui (v, v, 2 * i + 1, MPFR_RNDU);
+ mpfr_div_ui (v, v, 2 * i + 1, MPFR_RNDU);
/* here, v_2i = v_{2i-2} / (2i * (2i+1))^2 */
- mpfr_mul_z (w, v, B[i], GMP_RNDN);
+ mpfr_mul_z (w, v, B[i], MPFR_RNDN);
/* here, w_2i = v_2i * B_2i * (2i+1)! with
error(w_2i) < 2^(5 * i + 8) ulp(w_2i) (see algorithms.tex) */
- mpfr_add (s, s, w, GMP_RNDN);
+ mpfr_add (s, s, w, MPFR_RNDN);
err = MAX (err + se, 5 * i + 8 + MPFR_GET_EXP (w))
- MPFR_GET_EXP (s);
@@ -199,18 +199,18 @@ mpfr_li2_asympt_pos (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
mpfr_init2 (g, w);
mpfr_init2 (h, w);
- mpfr_log (g, x, GMP_RNDN); /* rel. error <= |(1 + theta) - 1| */
- mpfr_sqr (g, g, GMP_RNDN); /* rel. error <= |(1 + theta)^3 - 1| <= 2^(2-w) */
- mpfr_div_2ui (g, g, 1, GMP_RNDN); /* rel. error <= 2^(2-w) */
- mpfr_const_pi (h, GMP_RNDN); /* error <= 2^(1-w) */
- mpfr_sqr (h, h, GMP_RNDN); /* rel. error <= 2^(2-w) */
- mpfr_div_ui (h, h, 3, GMP_RNDN); /* rel. error <= |(1 + theta)^4 - 1|
+ mpfr_log (g, x, MPFR_RNDN); /* rel. error <= |(1 + theta) - 1| */
+ mpfr_sqr (g, g, MPFR_RNDN); /* rel. error <= |(1 + theta)^3 - 1| <= 2^(2-w) */
+ mpfr_div_2ui (g, g, 1, MPFR_RNDN); /* rel. error <= 2^(2-w) */
+ mpfr_const_pi (h, MPFR_RNDN); /* error <= 2^(1-w) */
+ mpfr_sqr (h, h, MPFR_RNDN); /* rel. error <= 2^(2-w) */
+ mpfr_div_ui (h, h, 3, MPFR_RNDN); /* rel. error <= |(1 + theta)^4 - 1|
<= 5 * 2^(-w) */
/* since x is chosen such that log(x)^2/2 >= 2 * (Pi^2/3), we should have
g >= 2*h, thus |g-h| >= |h|, and the relative error on g is at most
multiplied by 2 in the difference, and that by h is unchanged. */
MPFR_ASSERTN (MPFR_EXP (g) > MPFR_EXP (h));
- mpfr_sub (g, h, g, GMP_RNDN); /* err <= ulp(g)/2 + g*2^(3-w) + g*5*2^(-w)
+ mpfr_sub (g, h, g, MPFR_RNDN); /* err <= ulp(g)/2 + g*2^(3-w) + g*5*2^(-w)
<= ulp(g) * (1/2 + 8 + 5) < 14 ulp(g).
If in addition 2/x <= 2 ulp(g), i.e.,
@@ -245,16 +245,16 @@ mpfr_li2_asympt_neg (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
mpfr_init2 (g, w);
mpfr_init2 (h, w);
- mpfr_neg (g, x, GMP_RNDN);
- mpfr_log (g, g, GMP_RNDN); /* rel. error <= |(1 + theta) - 1| */
- mpfr_sqr (g, g, GMP_RNDN); /* rel. error <= |(1 + theta)^3 - 1| <= 2^(2-w) */
- mpfr_div_2ui (g, g, 1, GMP_RNDN); /* rel. error <= 2^(2-w) */
- mpfr_const_pi (h, GMP_RNDN); /* error <= 2^(1-w) */
- mpfr_sqr (h, h, GMP_RNDN); /* rel. error <= 2^(2-w) */
- mpfr_div_ui (h, h, 6, GMP_RNDN); /* rel. error <= |(1 + theta)^4 - 1|
+ mpfr_neg (g, x, MPFR_RNDN);
+ mpfr_log (g, g, MPFR_RNDN); /* rel. error <= |(1 + theta) - 1| */
+ mpfr_sqr (g, g, MPFR_RNDN); /* rel. error <= |(1 + theta)^3 - 1| <= 2^(2-w) */
+ mpfr_div_2ui (g, g, 1, MPFR_RNDN); /* rel. error <= 2^(2-w) */
+ mpfr_const_pi (h, MPFR_RNDN); /* error <= 2^(1-w) */
+ mpfr_sqr (h, h, MPFR_RNDN); /* rel. error <= 2^(2-w) */
+ mpfr_div_ui (h, h, 6, MPFR_RNDN); /* rel. error <= |(1 + theta)^4 - 1|
<= 5 * 2^(-w) */
MPFR_ASSERTN (MPFR_EXP (g) >= MPFR_EXP (h));
- mpfr_add (g, g, h, GMP_RNDN); /* err <= ulp(g)/2 + g*2^(2-w) + g*5*2^(-w)
+ mpfr_add (g, g, h, MPFR_RNDN); /* err <= ulp(g)/2 + g*2^(2-w) + g*5*2^(-w)
<= ulp(g) * (1/2 + 4 + 5) < 10 ulp(g).
If in addition |1/x| <= 4 ulp(g), then the
@@ -331,16 +331,16 @@ mpfr_li2 (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
MPFR_ZIV_INIT (loop, m);
for (;;)
{
- mpfr_ui_sub (u, 1, x, GMP_RNDN);
- mpfr_log (u, u, GMP_RNDU);
- mpfr_neg (u, u, GMP_RNDN); /* u = -log(1-x) */
+ mpfr_ui_sub (u, 1, x, MPFR_RNDN);
+ mpfr_log (u, u, MPFR_RNDU);
+ mpfr_neg (u, u, MPFR_RNDN); /* u = -log(1-x) */
expo_l = MPFR_GET_EXP (u);
- k = li2_series (s, u, GMP_RNDU);
+ k = li2_series (s, u, MPFR_RNDU);
err = 1 + MPFR_INT_CEIL_LOG2 (k + 1);
- mpfr_sqr (u, u, GMP_RNDU);
- mpfr_div_2ui (u, u, 2, GMP_RNDU); /* u = log^2(1-x) / 4 */
- mpfr_sub (s, s, u, GMP_RNDN);
+ mpfr_sqr (u, u, MPFR_RNDU);
+ mpfr_div_2ui (u, u, 2, MPFR_RNDU); /* u = log^2(1-x) / 4 */
+ mpfr_sub (s, s, u, MPFR_RNDN);
/* error(s) <= (0.5 + 2^(d-EXP(s))
+ 2^(3 + MAX(1, - expo_l) - EXP(s))) ulp(s) */
@@ -370,9 +370,9 @@ mpfr_li2 (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
MPFR_ZIV_INIT (loop, m);
for (;;)
{
- mpfr_const_pi (u, GMP_RNDU);
- mpfr_sqr (u, u, GMP_RNDN);
- mpfr_div_ui (u, u, 6, GMP_RNDN);
+ mpfr_const_pi (u, MPFR_RNDU);
+ mpfr_sqr (u, u, MPFR_RNDN);
+ mpfr_div_ui (u, u, 6, MPFR_RNDN);
err = m - 4; /* error(u) <= 19/2 ulp(u) */
if (MPFR_CAN_ROUND (u, err, yp, rnd_mode))
@@ -409,36 +409,36 @@ mpfr_li2 (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
MPFR_ZIV_INIT (loop, m);
for (;;)
{
- mpfr_ui_div (xx, 1, x, GMP_RNDN);
- mpfr_neg (xx, xx, GMP_RNDN);
- mpfr_log1p (u, xx, GMP_RNDD);
- mpfr_neg (u, u, GMP_RNDU); /* u = -log(1-1/x) */
+ mpfr_ui_div (xx, 1, x, MPFR_RNDN);
+ mpfr_neg (xx, xx, MPFR_RNDN);
+ mpfr_log1p (u, xx, MPFR_RNDD);
+ mpfr_neg (u, u, MPFR_RNDU); /* u = -log(1-1/x) */
expo_l = MPFR_GET_EXP (u);
- k = li2_series (s, u, GMP_RNDN);
- mpfr_neg (s, s, GMP_RNDN);
+ k = li2_series (s, u, MPFR_RNDN);
+ mpfr_neg (s, s, MPFR_RNDN);
err = MPFR_INT_CEIL_LOG2 (k + 1) + 1; /* error(s) <= 2^err ulp(s) */
- mpfr_sqr (u, u, GMP_RNDN);
- mpfr_div_2ui (u, u, 2, GMP_RNDN); /* u= log^2(1-1/x)/4 */
- mpfr_add (s, s, u, GMP_RNDN);
+ mpfr_sqr (u, u, MPFR_RNDN);
+ mpfr_div_2ui (u, u, 2, MPFR_RNDN); /* u= log^2(1-1/x)/4 */
+ mpfr_add (s, s, u, MPFR_RNDN);
err =
MAX (err,
3 + MAX (1, -expo_l) + MPFR_GET_EXP (u)) - MPFR_GET_EXP (s);
err = 2 + MAX (-1, err); /* error(s) <= 2^err ulp(s) */
err += MPFR_GET_EXP (s);
- mpfr_log (u, x, GMP_RNDU);
- mpfr_sqr (u, u, GMP_RNDN);
- mpfr_div_2ui (u, u, 1, GMP_RNDN); /* u = log^2(x)/2 */
- mpfr_sub (s, s, u, GMP_RNDN);
+ mpfr_log (u, x, MPFR_RNDU);
+ mpfr_sqr (u, u, MPFR_RNDN);
+ mpfr_div_2ui (u, u, 1, MPFR_RNDN); /* u = log^2(x)/2 */
+ mpfr_sub (s, s, u, MPFR_RNDN);
err = MAX (err, 3 + MPFR_GET_EXP (u)) - MPFR_GET_EXP (s);
err = 2 + MAX (-1, err); /* error(s) <= 2^err ulp(s) */
err += MPFR_GET_EXP (s);
- mpfr_const_pi (u, GMP_RNDU);
- mpfr_sqr (u, u, GMP_RNDN);
- mpfr_div_ui (u, u, 3, GMP_RNDN); /* u = pi^2/3 */
- mpfr_add (s, s, u, GMP_RNDN);
+ mpfr_const_pi (u, MPFR_RNDU);
+ mpfr_sqr (u, u, MPFR_RNDN);
+ mpfr_div_ui (u, u, 3, MPFR_RNDN); /* u = pi^2/3 */
+ mpfr_add (s, s, u, MPFR_RNDN);
err = MAX (err, 2) - MPFR_GET_EXP (s);
err = 2 + MAX (-1, err); /* error(s) <= 2^err ulp(s) */
if (MPFR_CAN_ROUND (s, (mp_exp_t) m - err, yp, rnd_mode))
@@ -471,24 +471,24 @@ mpfr_li2 (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
MPFR_ZIV_INIT (loop, m);
for (;;)
{
- mpfr_log (v, x, GMP_RNDU);
- k = li2_series (s, v, GMP_RNDN);
+ mpfr_log (v, x, MPFR_RNDU);
+ k = li2_series (s, v, MPFR_RNDN);
e1 = MPFR_GET_EXP (s);
- mpfr_sqr (u, v, GMP_RNDN);
- mpfr_div_2ui (u, u, 2, GMP_RNDN); /* u = log^2(x)/4 */
- mpfr_add (s, s, u, GMP_RNDN);
+ mpfr_sqr (u, v, MPFR_RNDN);
+ mpfr_div_2ui (u, u, 2, MPFR_RNDN); /* u = log^2(x)/4 */
+ mpfr_add (s, s, u, MPFR_RNDN);
- mpfr_sub_ui (xx, x, 1, GMP_RNDN);
- mpfr_log (u, xx, GMP_RNDU);
+ mpfr_sub_ui (xx, x, 1, MPFR_RNDN);
+ mpfr_log (u, xx, MPFR_RNDU);
e2 = MPFR_GET_EXP (u);
- mpfr_mul (u, v, u, GMP_RNDN); /* u = log(x) * log(x-1) */
- mpfr_sub (s, s, u, GMP_RNDN);
+ mpfr_mul (u, v, u, MPFR_RNDN); /* u = log(x) * log(x-1) */
+ mpfr_sub (s, s, u, MPFR_RNDN);
- mpfr_const_pi (u, GMP_RNDU);
- mpfr_sqr (u, u, GMP_RNDN);
- mpfr_div_ui (u, u, 6, GMP_RNDN); /* u = pi^2/6 */
- mpfr_add (s, s, u, GMP_RNDN);
+ mpfr_const_pi (u, MPFR_RNDU);
+ mpfr_sqr (u, u, MPFR_RNDN);
+ mpfr_div_ui (u, u, 6, MPFR_RNDN); /* u = pi^2/6 */
+ mpfr_add (s, s, u, MPFR_RNDN);
/* error(s) <= (31 + (k+1) * 2^(1-e1) + 2^(1-e2)) ulp(s)
see algorithms.tex */
err = MAX (MPFR_INT_CEIL_LOG2 (k + 1) + 1 - e1, 1 - e2);
@@ -523,29 +523,29 @@ mpfr_li2 (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
MPFR_ZIV_INIT (loop, m);
for (;;)
{
- mpfr_log (u, x, GMP_RNDD);
- mpfr_neg (u, u, GMP_RNDN);
- k = li2_series (s, u, GMP_RNDN);
- mpfr_neg (s, s, GMP_RNDN);
+ mpfr_log (u, x, MPFR_RNDD);
+ mpfr_neg (u, u, MPFR_RNDN);
+ k = li2_series (s, u, MPFR_RNDN);
+ mpfr_neg (s, s, MPFR_RNDN);
err = 1 + MPFR_INT_CEIL_LOG2 (k + 1) - MPFR_GET_EXP (s);
- mpfr_ui_sub (xx, 1, x, GMP_RNDN);
- mpfr_log (v, xx, GMP_RNDU);
- mpfr_mul (v, v, u, GMP_RNDN); /* v = - log(x) * log(1-x) */
- mpfr_add (s, s, v, GMP_RNDN);
+ mpfr_ui_sub (xx, 1, x, MPFR_RNDN);
+ mpfr_log (v, xx, MPFR_RNDU);
+ mpfr_mul (v, v, u, MPFR_RNDN); /* v = - log(x) * log(1-x) */
+ mpfr_add (s, s, v, MPFR_RNDN);
err = MAX (err, 1 - MPFR_GET_EXP (v));
err = 2 + MAX (3, err) - MPFR_GET_EXP (s);
- mpfr_sqr (u, u, GMP_RNDN);
- mpfr_div_2ui (u, u, 2, GMP_RNDN); /* u = log^2(x)/4 */
- mpfr_add (s, s, u, GMP_RNDN);
+ mpfr_sqr (u, u, MPFR_RNDN);
+ mpfr_div_2ui (u, u, 2, MPFR_RNDN); /* u = log^2(x)/4 */
+ mpfr_add (s, s, u, MPFR_RNDN);
err = MAX (err, 2 + MPFR_GET_EXP (u)) - MPFR_GET_EXP (s);
err = 2 + MAX (-1, err) + MPFR_GET_EXP (s);
- mpfr_const_pi (u, GMP_RNDU);
- mpfr_sqr (u, u, GMP_RNDN);
- mpfr_div_ui (u, u, 6, GMP_RNDN); /* u = pi^2/6 */
- mpfr_add (s, s, u, GMP_RNDN);
+ mpfr_const_pi (u, MPFR_RNDU);
+ mpfr_sqr (u, u, MPFR_RNDN);
+ mpfr_div_ui (u, u, 6, MPFR_RNDN); /* u = pi^2/6 */
+ mpfr_add (s, s, u, MPFR_RNDN);
err = MAX (err, 3) - MPFR_GET_EXP (s);
err = 2 + MAX (-1, err);
@@ -578,16 +578,16 @@ mpfr_li2 (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
MPFR_ZIV_INIT (loop, m);
for (;;)
{
- mpfr_neg (xx, x, GMP_RNDN);
- mpfr_log1p (u, xx, GMP_RNDN);
- k = li2_series (s, u, GMP_RNDN);
- mpfr_neg (s, s, GMP_RNDN);
+ mpfr_neg (xx, x, MPFR_RNDN);
+ mpfr_log1p (u, xx, MPFR_RNDN);
+ k = li2_series (s, u, MPFR_RNDN);
+ mpfr_neg (s, s, MPFR_RNDN);
expo_l = MPFR_GET_EXP (u);
err = 1 + MPFR_INT_CEIL_LOG2 (k + 1) - MPFR_GET_EXP (s);
- mpfr_sqr (u, u, GMP_RNDN);
- mpfr_div_2ui (u, u, 2, GMP_RNDN); /* u = log^2(1-x)/4 */
- mpfr_sub (s, s, u, GMP_RNDN);
+ mpfr_sqr (u, u, MPFR_RNDN);
+ mpfr_div_2ui (u, u, 2, MPFR_RNDN); /* u = log^2(1-x)/4 */
+ mpfr_sub (s, s, u, MPFR_RNDN);
err = MAX (err, - expo_l);
err = 2 + MAX (err, 3);
if (MPFR_CAN_ROUND (s, (mp_exp_t) m - err, yp, rnd_mode))
@@ -628,37 +628,37 @@ mpfr_li2 (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
MPFR_ZIV_INIT (loop, m);
for (;;)
{
- mpfr_ui_div (xx, 1, x, GMP_RNDN);
- mpfr_neg (xx, xx, GMP_RNDN);
- mpfr_log1p (u, xx, GMP_RNDN);
- k = li2_series (s, u, GMP_RNDN);
-
- mpfr_ui_sub (xx, 1, x, GMP_RNDN);
- mpfr_log (u, xx, GMP_RNDU);
- mpfr_neg (xx, x, GMP_RNDN);
- mpfr_log (v, xx, GMP_RNDU);
- mpfr_mul (w, v, u, GMP_RNDN);
- mpfr_div_2ui (w, w, 1, GMP_RNDN); /* w = log(-x) * log(1-x) / 2 */
- mpfr_sub (s, s, w, GMP_RNDN);
+ mpfr_ui_div (xx, 1, x, MPFR_RNDN);
+ mpfr_neg (xx, xx, MPFR_RNDN);
+ mpfr_log1p (u, xx, MPFR_RNDN);
+ k = li2_series (s, u, MPFR_RNDN);
+
+ mpfr_ui_sub (xx, 1, x, MPFR_RNDN);
+ mpfr_log (u, xx, MPFR_RNDU);
+ mpfr_neg (xx, x, MPFR_RNDN);
+ mpfr_log (v, xx, MPFR_RNDU);
+ mpfr_mul (w, v, u, MPFR_RNDN);
+ mpfr_div_2ui (w, w, 1, MPFR_RNDN); /* w = log(-x) * log(1-x) / 2 */
+ mpfr_sub (s, s, w, MPFR_RNDN);
err = 1 + MAX (3, MPFR_INT_CEIL_LOG2 (k+1) + 1 - MPFR_GET_EXP (s))
+ MPFR_GET_EXP (s);
- mpfr_sqr (w, v, GMP_RNDN);
- mpfr_div_2ui (w, w, 2, GMP_RNDN); /* w = log^2(-x) / 4 */
- mpfr_sub (s, s, w, GMP_RNDN);
+ mpfr_sqr (w, v, MPFR_RNDN);
+ mpfr_div_2ui (w, w, 2, MPFR_RNDN); /* w = log^2(-x) / 4 */
+ mpfr_sub (s, s, w, MPFR_RNDN);
err = MAX (err, 3 + MPFR_GET_EXP(w)) - MPFR_GET_EXP (s);
err = 2 + MAX (-1, err) + MPFR_GET_EXP (s);
- mpfr_sqr (w, u, GMP_RNDN);
- mpfr_div_2ui (w, w, 2, GMP_RNDN); /* w = log^2(1-x) / 4 */
- mpfr_add (s, s, w, GMP_RNDN);
+ mpfr_sqr (w, u, MPFR_RNDN);
+ mpfr_div_2ui (w, w, 2, MPFR_RNDN); /* w = log^2(1-x) / 4 */
+ mpfr_add (s, s, w, MPFR_RNDN);
err = MAX (err, 3 + MPFR_GET_EXP (w)) - MPFR_GET_EXP (s);
err = 2 + MAX (-1, err) + MPFR_GET_EXP (s);
- mpfr_const_pi (w, GMP_RNDU);
- mpfr_sqr (w, w, GMP_RNDN);
- mpfr_div_ui (w, w, 6, GMP_RNDN); /* w = pi^2 / 6 */
- mpfr_sub (s, s, w, GMP_RNDN);
+ mpfr_const_pi (w, MPFR_RNDU);
+ mpfr_sqr (w, w, MPFR_RNDN);
+ mpfr_div_ui (w, w, 6, MPFR_RNDN); /* w = pi^2 / 6 */
+ mpfr_sub (s, s, w, MPFR_RNDN);
err = MAX (err, 3) - MPFR_GET_EXP (s);
err = 2 + MAX (-1, err) + MPFR_GET_EXP (s);
diff --git a/lngamma.c b/lngamma.c
index bbe6042e1..caa78d306 100644
--- a/lngamma.c
+++ b/lngamma.c
@@ -173,7 +173,7 @@ GAMMA_FUNC (mpfr_ptr y, mpfr_srcptr z0, mp_rnd_t rnd)
if (compared == 0 || (compared > 0 && mpfr_cmp_ui (z0, 2) == 0))
{
MPFR_SAVE_EXPO_FREE (expo);
- return mpfr_set_ui (y, 0, GMP_RNDN); /* lngamma(1 or 2) = +0 */
+ return mpfr_set_ui (y, 0, MPFR_RNDN); /* lngamma(1 or 2) = +0 */
}
/* Deal here with tiny inputs. We have for -0.3 <= x <= 0.3:
@@ -191,31 +191,31 @@ GAMMA_FUNC (mpfr_ptr y, mpfr_srcptr z0, mp_rnd_t rnd)
mpfr_init2 (l, prec);
if (MPFR_IS_POS(z0))
{
- mpfr_log (l, z0, GMP_RNDU); /* upper bound for log(z0) */
+ mpfr_log (l, z0, MPFR_RNDU); /* upper bound for log(z0) */
mpfr_init2 (h, MPFR_PREC(l));
}
else
{
mpfr_init2 (h, MPFR_PREC(z0));
- mpfr_neg (h, z0, GMP_RNDN); /* exact */
- mpfr_log (l, h, GMP_RNDU); /* upper bound for log(-z0) */
+ mpfr_neg (h, z0, MPFR_RNDN); /* exact */
+ mpfr_log (l, h, MPFR_RNDU); /* upper bound for log(-z0) */
mpfr_set_prec (h, MPFR_PREC(l));
}
- mpfr_neg (l, l, GMP_RNDD); /* lower bound for -log(|z0|) */
- mpfr_set (h, l, GMP_RNDD); /* exact */
+ mpfr_neg (l, l, MPFR_RNDD); /* lower bound for -log(|z0|) */
+ mpfr_set (h, l, MPFR_RNDD); /* exact */
mpfr_nextabove (h); /* upper bound for -log(|z0|), avoids two calls
to mpfr_log */
mpfr_init2 (g, MPFR_PREC(l));
/* if z0>0, we need an upper approximation of Euler's constant
for the left bound */
- mpfr_const_euler (g, MPFR_IS_POS(z0) ? GMP_RNDU : GMP_RNDD);
- mpfr_mul (g, g, z0, GMP_RNDD);
- mpfr_sub (l, l, g, GMP_RNDD);
- mpfr_const_euler (g, MPFR_IS_POS(z0) ? GMP_RNDD : GMP_RNDU); /* cached */
- mpfr_mul (g, g, z0, GMP_RNDU);
- mpfr_sub (h, h, g, GMP_RNDD);
- mpfr_mul (g, z0, z0, GMP_RNDU);
- mpfr_add (h, h, g, GMP_RNDU);
+ mpfr_const_euler (g, MPFR_IS_POS(z0) ? MPFR_RNDU : MPFR_RNDD);
+ mpfr_mul (g, g, z0, MPFR_RNDD);
+ mpfr_sub (l, l, g, MPFR_RNDD);
+ mpfr_const_euler (g, MPFR_IS_POS(z0) ? MPFR_RNDD : MPFR_RNDU); /* cached */
+ mpfr_mul (g, g, z0, MPFR_RNDU);
+ mpfr_sub (h, h, g, MPFR_RNDD);
+ mpfr_mul (g, z0, z0, MPFR_RNDU);
+ mpfr_add (h, h, g, MPFR_RNDU);
inexact = mpfr_prec_round (l, MPFR_PREC(y), rnd);
inex2 = mpfr_prec_round (h, MPFR_PREC(y), rnd);
/* Caution: we not only need l = h, but both inexact flags should
@@ -275,9 +275,9 @@ GAMMA_FUNC (mpfr_ptr y, mpfr_srcptr z0, mp_rnd_t rnd)
/* In the following, we write r for a real of absolute value
at most 2^(-w). Different instances of r may represent different
values. */
- mpfr_ui_sub (s, 2, z0, GMP_RNDD); /* s = (2-z0) * (1+2r) >= 1 */
- mpfr_const_pi (t, GMP_RNDN); /* t = Pi * (1+r) */
- mpfr_lngamma (u, s, GMP_RNDN); /* lngamma(2-x) */
+ mpfr_ui_sub (s, 2, z0, MPFR_RNDD); /* s = (2-z0) * (1+2r) >= 1 */
+ mpfr_const_pi (t, MPFR_RNDN); /* t = Pi * (1+r) */
+ mpfr_lngamma (u, s, MPFR_RNDN); /* lngamma(2-x) */
/* Let s = (2-z0) + h. By construction, -(2-z0)*2^(1-w) <= h <= 0.
We have lngamma(s) = lngamma(2-z0) + h*Psi(z), z in [2-z0+h,2-z0].
Since 2-z0+h = s >= 1 and |Psi(x)| <= max(1,log(x)) for x >= 1,
@@ -289,9 +289,9 @@ GAMMA_FUNC (mpfr_ptr y, mpfr_srcptr z0, mp_rnd_t rnd)
err_u = (err_u >= 0) ? err_u + 1 : 0;
/* now the error on u is bounded by 2^err_u ulps */
- mpfr_mul (s, s, t, GMP_RNDN); /* Pi*(2-x) * (1+r)^4 */
+ mpfr_mul (s, s, t, MPFR_RNDN); /* Pi*(2-x) * (1+r)^4 */
err_s = MPFR_GET_EXP(s); /* 2-x <= 2^err_s */
- mpfr_sin (s, s, GMP_RNDN); /* sin(Pi*(2-x)) */
+ mpfr_sin (s, s, MPFR_RNDN); /* sin(Pi*(2-x)) */
/* the error on s is bounded by 1/2*ulp(s) + [(1+2^(-w))^4-1]*(2-x)
<= 1/2*ulp(s) + 5*2^(-w)*(2-x) for w >= 3
<= (1/2 + 5 * 2^(-E(s)) * (2-x)) ulp(s) */
@@ -315,14 +315,14 @@ GAMMA_FUNC (mpfr_ptr y, mpfr_srcptr z0, mp_rnd_t rnd)
*/
err_s += 2; /* exponent of relative error */
- mpfr_sub_ui (v, z0, 1, GMP_RNDN); /* v = (x-1) * (1+r) */
- mpfr_mul (v, v, t, GMP_RNDN); /* v = Pi*(x-1) * (1+r)^3 */
- mpfr_div (v, v, s, GMP_RNDN); /* Pi*(x-1)/sin(Pi*(2-x)) */
- mpfr_abs (v, v, GMP_RNDN);
+ mpfr_sub_ui (v, z0, 1, MPFR_RNDN); /* v = (x-1) * (1+r) */
+ mpfr_mul (v, v, t, MPFR_RNDN); /* v = Pi*(x-1) * (1+r)^3 */
+ mpfr_div (v, v, s, MPFR_RNDN); /* Pi*(x-1)/sin(Pi*(2-x)) */
+ mpfr_abs (v, v, MPFR_RNDN);
/* (1+r)^(3+2^err_s+1) */
err_s = (err_s <= 1) ? 3 : err_s + 1;
/* now (1+r)^M with M <= 2^err_s */
- mpfr_log (v, v, GMP_RNDN);
+ mpfr_log (v, v, MPFR_RNDN);
/* log(v*(1+e)) = log(v)+log(1+e) where |e| <= 2^(err_s-w).
Since |log(1+e)| <= 2*e for |e| <= 1/4, the error on v is
bounded by ulp(v)/2 + 2^(err_s+1-w). */
@@ -337,14 +337,14 @@ GAMMA_FUNC (mpfr_ptr y, mpfr_srcptr z0, mp_rnd_t rnd)
/* the error on v is bounded by 2^err_s ulps */
err_u += MPFR_GET_EXP(u); /* absolute error on u */
err_s += MPFR_GET_EXP(v); /* absolute error on v */
- mpfr_sub (s, v, u, GMP_RNDN);
+ mpfr_sub (s, v, u, MPFR_RNDN);
/* the total error on s is bounded by ulp(s)/2 + 2^(err_u-w)
+ 2^(err_s-w) <= ulp(s)/2 + 2^(max(err_u,err_s)+1-w) */
err_s = (err_s >= err_u) ? err_s : err_u;
err_s += 1 - MPFR_GET_EXP(s); /* error is 2^err_s ulp(s) */
err_s = (err_s >= 0) ? err_s + 1 : 0;
- if (mpfr_can_round (s, w - err_s, GMP_RNDN, GMP_RNDZ, precy
- + (rnd == GMP_RNDN)))
+ if (mpfr_can_round (s, w - err_s, MPFR_RNDN, MPFR_RNDZ, precy
+ + (rnd == MPFR_RNDN)))
goto end;
}
}
@@ -367,11 +367,11 @@ GAMMA_FUNC (mpfr_ptr y, mpfr_srcptr z0, mp_rnd_t rnd)
/* we need z >= w*log(2)/(2*Pi) to get an absolute error less than 2^(-w)
but the optimal value is about 0.155665*w */
/* FIXME: replace double by mpfr_t types. */
- mpfr_set_d (s, mpfr_gamma_alpha (precy) * (double) w, GMP_RNDU);
+ mpfr_set_d (s, mpfr_gamma_alpha (precy) * (double) w, MPFR_RNDU);
if (mpfr_cmp (z0, s) < 0)
{
- mpfr_sub (s, s, z0, GMP_RNDU);
- k = mpfr_get_ui (s, GMP_RNDU);
+ mpfr_sub (s, s, z0, MPFR_RNDU);
+ k = mpfr_get_ui (s, MPFR_RNDU);
if (k < 3)
k = 3;
}
@@ -384,35 +384,35 @@ GAMMA_FUNC (mpfr_ptr y, mpfr_srcptr z0, mp_rnd_t rnd)
mpfr_set_prec (v, w);
mpfr_set_prec (z, w);
- mpfr_add_ui (z, z0, k, GMP_RNDN);
+ mpfr_add_ui (z, z0, k, MPFR_RNDN);
/* z = (z0+k)*(1+t1) with |t1| <= 2^(-w) */
/* z >= 4 ensures the relative error on log(z) is small,
and also (z-1/2)*log(z)-z >= 0 */
MPFR_ASSERTD (mpfr_cmp_ui (z, 4) >= 0);
- mpfr_log (s, z, GMP_RNDN); /* log(z) */
+ mpfr_log (s, z, MPFR_RNDN); /* log(z) */
/* we have s = log((z0+k)*(1+t1))*(1+t2) with |t1|, |t2| <= 2^(-w).
Since w >= 2 and z0+k >= 4, we can write log((z0+k)*(1+t1))
= log(z0+k) * (1+t3) with |t3| <= 2^(-w), thus we have
s = log(z0+k) * (1+t4)^2 with |t4| <= 2^(-w) */
- mpfr_mul_2ui (t, z, 1, GMP_RNDN); /* t = 2z * (1+t5) */
- mpfr_sub_ui (t, t, 1, GMP_RNDN); /* t = 2z-1 * (1+t6)^3 */
+ mpfr_mul_2ui (t, z, 1, MPFR_RNDN); /* t = 2z * (1+t5) */
+ mpfr_sub_ui (t, t, 1, MPFR_RNDN); /* t = 2z-1 * (1+t6)^3 */
/* since we can write 2z*(1+t5) = (2z-1)*(1+t5') with
t5' = 2z/(2z-1) * t5, thus |t5'| <= 8/7 * t5 */
- mpfr_mul (s, s, t, GMP_RNDN); /* (2z-1)*log(z) * (1+t7)^6 */
- mpfr_div_2ui (s, s, 1, GMP_RNDN); /* (z-1/2)*log(z) * (1+t7)^6 */
- mpfr_sub (s, s, z, GMP_RNDN); /* (z-1/2)*log(z)-z */
+ mpfr_mul (s, s, t, MPFR_RNDN); /* (2z-1)*log(z) * (1+t7)^6 */
+ mpfr_div_2ui (s, s, 1, MPFR_RNDN); /* (z-1/2)*log(z) * (1+t7)^6 */
+ mpfr_sub (s, s, z, MPFR_RNDN); /* (z-1/2)*log(z)-z */
/* s = [(z-1/2)*log(z)-z]*(1+u)^14, s >= 1/2 */
- mpfr_ui_div (u, 1, z, GMP_RNDN); /* 1/z * (1+u), u <= 1/4 since z >= 4 */
+ mpfr_ui_div (u, 1, z, MPFR_RNDN); /* 1/z * (1+u), u <= 1/4 since z >= 4 */
/* the first term is B[2]/2/z = 1/12/z: t=1/12/z, C[2]=1 */
- mpfr_div_ui (t, u, 12, GMP_RNDN); /* 1/(12z) * (1+u)^2, t <= 3/128 */
- mpfr_set (v, t, GMP_RNDN); /* (1+u)^2, v < 2^(-5) */
- mpfr_add (s, s, v, GMP_RNDN); /* (1+u)^15 */
+ mpfr_div_ui (t, u, 12, MPFR_RNDN); /* 1/(12z) * (1+u)^2, t <= 3/128 */
+ mpfr_set (v, t, MPFR_RNDN); /* (1+u)^2, v < 2^(-5) */
+ mpfr_add (s, s, v, MPFR_RNDN); /* (1+u)^15 */
- mpfr_mul (u, u, u, GMP_RNDN); /* 1/z^2 * (1+u)^3 */
+ mpfr_mul (u, u, u, MPFR_RNDN); /* 1/z^2 * (1+u)^3 */
if (Bm == 0)
{
@@ -428,21 +428,21 @@ GAMMA_FUNC (mpfr_ptr y, mpfr_srcptr z0, mp_rnd_t rnd)
for (m = 2; MPFR_GET_EXP(v) + (mp_exp_t) w >= MPFR_GET_EXP(s); m++)
{
- mpfr_mul (t, t, u, GMP_RNDN); /* (1+u)^(10m-14) */
+ mpfr_mul (t, t, u, MPFR_RNDN); /* (1+u)^(10m-14) */
if (m <= maxm)
{
- mpfr_mul_ui (t, t, 2*(m-1)*(2*m-3), GMP_RNDN);
- mpfr_div_ui (t, t, 2*m*(2*m-1), GMP_RNDN);
- mpfr_div_ui (t, t, 2*m*(2*m+1), GMP_RNDN);
+ mpfr_mul_ui (t, t, 2*(m-1)*(2*m-3), MPFR_RNDN);
+ mpfr_div_ui (t, t, 2*m*(2*m-1), MPFR_RNDN);
+ mpfr_div_ui (t, t, 2*m*(2*m+1), MPFR_RNDN);
}
else
{
- mpfr_mul_ui (t, t, 2*(m-1), GMP_RNDN);
- mpfr_mul_ui (t, t, 2*m-3, GMP_RNDN);
- mpfr_div_ui (t, t, 2*m, GMP_RNDN);
- mpfr_div_ui (t, t, 2*m-1, GMP_RNDN);
- mpfr_div_ui (t, t, 2*m, GMP_RNDN);
- mpfr_div_ui (t, t, 2*m+1, GMP_RNDN);
+ mpfr_mul_ui (t, t, 2*(m-1), MPFR_RNDN);
+ mpfr_mul_ui (t, t, 2*m-3, MPFR_RNDN);
+ mpfr_div_ui (t, t, 2*m, MPFR_RNDN);
+ mpfr_div_ui (t, t, 2*m-1, MPFR_RNDN);
+ mpfr_div_ui (t, t, 2*m, MPFR_RNDN);
+ mpfr_div_ui (t, t, 2*m+1, MPFR_RNDN);
}
/* (1+u)^(10m-8) */
/* invariant: t=1/(2m)/(2m-1)/z^(2m-1)/(2m+1)! */
@@ -451,12 +451,12 @@ GAMMA_FUNC (mpfr_ptr y, mpfr_srcptr z0, mp_rnd_t rnd)
B = bernoulli (B, m); /* B[2m]*(2m+1)!, exact */
Bm ++;
}
- mpfr_mul_z (v, t, B[m], GMP_RNDN); /* (1+u)^(10m-7) */
+ mpfr_mul_z (v, t, B[m], MPFR_RNDN); /* (1+u)^(10m-7) */
MPFR_ASSERTD(MPFR_GET_EXP(v) <= - (2 * m + 3));
- mpfr_add (s, s, v, GMP_RNDN);
+ mpfr_add (s, s, v, MPFR_RNDN);
}
/* m <= 1/2*Pi*e*z ensures that |v[m]| < 1/2^(2m+3) */
- MPFR_ASSERTD ((double) m <= 4.26 * mpfr_get_d (z, GMP_RNDZ));
+ MPFR_ASSERTD ((double) m <= 4.26 * mpfr_get_d (z, MPFR_RNDZ));
/* We have sum([(1+u)^(10m-7)-1]*1/2^(2m+3), m=2..infinity)
<= 1.46*u for u <= 2^(-3).
@@ -473,37 +473,37 @@ GAMMA_FUNC (mpfr_ptr y, mpfr_srcptr z0, mp_rnd_t rnd)
*/
/* add 1/2*log(2*Pi) and subtract log(z0*(z0+1)*...*(z0+k-1)) */
- mpfr_const_pi (v, GMP_RNDN); /* v = Pi*(1+u) */
- mpfr_mul_2ui (v, v, 1, GMP_RNDN); /* v = 2*Pi * (1+u) */
+ mpfr_const_pi (v, MPFR_RNDN); /* v = Pi*(1+u) */
+ mpfr_mul_2ui (v, v, 1, MPFR_RNDN); /* v = 2*Pi * (1+u) */
if (k)
{
unsigned long l;
- mpfr_set (t, z0, GMP_RNDN); /* t = z0*(1+u) */
+ mpfr_set (t, z0, MPFR_RNDN); /* t = z0*(1+u) */
for (l = 1; l < k; l++)
{
- mpfr_add_ui (u, z0, l, GMP_RNDN); /* u = (z0+l)*(1+u) */
- mpfr_mul (t, t, u, GMP_RNDN); /* (1+u)^(2l+1) */
+ mpfr_add_ui (u, z0, l, MPFR_RNDN); /* u = (z0+l)*(1+u) */
+ mpfr_mul (t, t, u, MPFR_RNDN); /* (1+u)^(2l+1) */
}
/* now t: (1+u)^(2k-1) */
/* instead of computing log(sqrt(2*Pi)/t), we compute
1/2*log(2*Pi/t^2), which trades a square root for a square */
- mpfr_mul (t, t, t, GMP_RNDN); /* (z0*...*(z0+k-1))^2, (1+u)^(4k-1) */
- mpfr_div (v, v, t, GMP_RNDN);
+ mpfr_mul (t, t, t, MPFR_RNDN); /* (z0*...*(z0+k-1))^2, (1+u)^(4k-1) */
+ mpfr_div (v, v, t, MPFR_RNDN);
/* 2*Pi/(z0*...*(z0+k-1))^2 (1+u)^(4k+1) */
}
#ifdef IS_GAMMA
err_s = MPFR_GET_EXP(s);
- mpfr_exp (s, s, GMP_RNDN);
+ mpfr_exp (s, s, MPFR_RNDN);
/* before the exponential, we have s = s0 + h where
|h| <= (2m+48)*ulp(s), thus exp(s0) = exp(s) * exp(-h).
For |h| <= 1/4, we have |exp(h)-1| <= 1.2*|h| thus
|exp(s) - exp(s0)| <= 1.2 * exp(s) * (2m+48)* 2^(EXP(s)-w). */
d = 1.2 * (2.0 * (double) m + 48.0);
/* the error on s is bounded by d*2^err_s * 2^(-w) */
- mpfr_sqrt (t, v, GMP_RNDN);
+ mpfr_sqrt (t, v, MPFR_RNDN);
/* let v0 be the exact value of v. We have v = v0*(1+u)^(4k+1),
thus t = sqrt(v0)*(1+u)^(2k+3/2). */
- mpfr_mul (s, s, t, GMP_RNDN);
+ mpfr_mul (s, s, t, MPFR_RNDN);
/* the error on input s is bounded by (1+u)^(d*2^err_s),
and that on t is (1+u)^(2k+3/2), thus the
total error is (1+u)^(d*2^err_s+2k+5/2) */
@@ -511,12 +511,12 @@ GAMMA_FUNC (mpfr_ptr y, mpfr_srcptr z0, mp_rnd_t rnd)
err_t = __gmpfr_ceil_log2 (2.0 * (double) k + 2.5);
err_s = (err_s >= err_t) ? err_s + 1 : err_t + 1;
#else
- mpfr_log (t, v, GMP_RNDN);
+ mpfr_log (t, v, MPFR_RNDN);
/* let v0 be the exact value of v. We have v = v0*(1+u)^(4k+1),
thus log(v) = log(v0) + (4k+1)*log(1+u). Since |log(1+u)/u| <= 1.07
for |u| <= 2^(-3), the absolute error on log(v) is bounded by
1.07*(4k+1)*u, and the rounding error by ulp(t). */
- mpfr_div_2ui (t, t, 1, GMP_RNDN);
+ mpfr_div_2ui (t, t, 1, MPFR_RNDN);
/* the error on t is now bounded by ulp(t) + 0.54*(4k+1)*2^(-w).
We have sqrt(2*Pi)/(z0*(z0+1)*...*(z0+k-1)) <= sqrt(2*Pi)/k! <= 0.5
since k>=3, thus t <= -0.5 and ulp(t) >= 2^(-w).
@@ -525,7 +525,7 @@ GAMMA_FUNC (mpfr_ptr y, mpfr_srcptr z0, mp_rnd_t rnd)
__gmpfr_ceil_log2 (2.2 * (double) k + 1.6);
err_s = MPFR_GET_EXP(s) + (mp_exp_t)
__gmpfr_ceil_log2 (2.0 * (double) m + 48.0);
- mpfr_add (s, s, t, GMP_RNDN); /* this is a subtraction in fact */
+ mpfr_add (s, s, t, MPFR_RNDN); /* this is a subtraction in fact */
/* the final error in ulp(s) is
<= 1 + 2^(err_t-EXP(s)) + 2^(err_s-EXP(s))
<= 2^(1+max(err_t,err_s)-EXP(s)) if err_t <> err_s
@@ -653,13 +653,13 @@ mpfr_lgamma (mpfr_ptr y, int *signp, mpfr_srcptr x, mp_rnd_t rnd)
mpfr_init2 (h, w);
/* we want a lower bound on -log(-x), thus an upper bound
on log(-x), thus an upper bound on -x. */
- mpfr_neg (l, x, GMP_RNDU); /* upper bound on -x */
- mpfr_log (l, l, GMP_RNDU); /* upper bound for log(-x) */
- mpfr_neg (l, l, GMP_RNDD); /* lower bound for -log(-x) */
- mpfr_neg (h, x, GMP_RNDD); /* lower bound on -x */
- mpfr_log (h, h, GMP_RNDD); /* lower bound on log(-x) */
- mpfr_neg (h, h, GMP_RNDU); /* upper bound for -log(-x) */
- mpfr_sub (h, h, x, GMP_RNDU); /* upper bound for -log(-x) - x */
+ mpfr_neg (l, x, MPFR_RNDU); /* upper bound on -x */
+ mpfr_log (l, l, MPFR_RNDU); /* upper bound for log(-x) */
+ mpfr_neg (l, l, MPFR_RNDD); /* lower bound for -log(-x) */
+ mpfr_neg (h, x, MPFR_RNDD); /* lower bound on -x */
+ mpfr_log (h, h, MPFR_RNDD); /* lower bound on log(-x) */
+ mpfr_neg (h, h, MPFR_RNDU); /* upper bound for -log(-x) */
+ mpfr_sub (h, h, x, MPFR_RNDU); /* upper bound for -log(-x) - x */
inex = mpfr_prec_round (l, MPFR_PREC (y), rnd);
inex2 = mpfr_prec_round (h, MPFR_PREC (y), rnd);
/* Caution: we not only need l = h, but both inexact flags
diff --git a/log.c b/log.c
index dfbf4d81d..14e7fe95c 100644
--- a/log.c
+++ b/log.c
@@ -126,15 +126,15 @@ mpfr_log (mpfr_ptr r, mpfr_srcptr a, mp_rnd_t rnd_mode)
MPFR_TMP_INIT (tmp1p, tmp1, p, size);
MPFR_TMP_INIT (tmp2p, tmp2, p, size);
- mpfr_mul_2si (tmp2, a, m, GMP_RNDN); /* s=a*2^m, err<=1 ulp */
- mpfr_div (tmp1, __gmpfr_four, tmp2, GMP_RNDN);/* 4/s, err<=2 ulps */
- mpfr_agm (tmp2, __gmpfr_one, tmp1, GMP_RNDN); /* AG(1,4/s),err<=3 ulps */
- mpfr_mul_2ui (tmp2, tmp2, 1, GMP_RNDN); /* 2*AG(1,4/s), err<=3 ulps */
- mpfr_const_pi (tmp1, GMP_RNDN); /* compute pi, err<=1ulp */
- mpfr_div (tmp2, tmp1, tmp2, GMP_RNDN); /* pi/2*AG(1,4/s), err<=5ulps */
- mpfr_const_log2 (tmp1, GMP_RNDN); /* compute log(2), err<=1ulp */
- mpfr_mul_si (tmp1, tmp1, m, GMP_RNDN); /* compute m*log(2),err<=2ulps */
- mpfr_sub (tmp1, tmp2, tmp1, GMP_RNDN); /* log(a), err<=7ulps+cancel */
+ mpfr_mul_2si (tmp2, a, m, MPFR_RNDN); /* s=a*2^m, err<=1 ulp */
+ mpfr_div (tmp1, __gmpfr_four, tmp2, MPFR_RNDN);/* 4/s, err<=2 ulps */
+ mpfr_agm (tmp2, __gmpfr_one, tmp1, MPFR_RNDN); /* AG(1,4/s),err<=3 ulps */
+ mpfr_mul_2ui (tmp2, tmp2, 1, MPFR_RNDN); /* 2*AG(1,4/s), err<=3 ulps */
+ mpfr_const_pi (tmp1, MPFR_RNDN); /* compute pi, err<=1ulp */
+ mpfr_div (tmp2, tmp1, tmp2, MPFR_RNDN); /* pi/2*AG(1,4/s), err<=5ulps */
+ mpfr_const_log2 (tmp1, MPFR_RNDN); /* compute log(2), err<=1ulp */
+ mpfr_mul_si (tmp1, tmp1, m, MPFR_RNDN); /* compute m*log(2),err<=2ulps */
+ mpfr_sub (tmp1, tmp2, tmp1, MPFR_RNDN); /* log(a), err<=7ulps+cancel */
if (MPFR_LIKELY (MPFR_IS_PURE_FP (tmp1) && MPFR_IS_PURE_FP (tmp2)))
{
diff --git a/log10.c b/log10.c
index f33e87e0c..951dd82d6 100644
--- a/log10.c
+++ b/log10.c
@@ -107,10 +107,10 @@ mpfr_log10 (mpfr_ptr r, mpfr_srcptr a, mp_rnd_t rnd_mode)
for (;;)
{
/* compute log10 */
- mpfr_set_ui (t, 10, GMP_RNDN); /* 10 */
- mpfr_log (t, t, GMP_RNDD); /* log(10) */
- mpfr_log (tt, a, GMP_RNDN); /* log(a) */
- mpfr_div (t, tt, t, GMP_RNDN); /* log(a)/log(10) */
+ mpfr_set_ui (t, 10, MPFR_RNDN); /* 10 */
+ mpfr_log (t, t, MPFR_RNDD); /* log(10) */
+ mpfr_log (tt, a, MPFR_RNDN); /* log(a) */
+ mpfr_div (t, tt, t, MPFR_RNDN); /* log(a)/log(10) */
/* estimation of the error */
err = Nt - 4;
@@ -121,8 +121,8 @@ mpfr_log10 (mpfr_ptr r, mpfr_srcptr a, mp_rnd_t rnd_mode)
FIXME: Can we have 10^n exactly representable as a mpfr_t
but n can't fit an unsigned long? */
if (MPFR_IS_POS (t)
- && mpfr_integer_p (t) && mpfr_fits_ulong_p (t, GMP_RNDN)
- && !mpfr_ui_pow_ui (tt, 10, mpfr_get_ui (t, GMP_RNDN), GMP_RNDN)
+ && mpfr_integer_p (t) && mpfr_fits_ulong_p (t, MPFR_RNDN)
+ && !mpfr_ui_pow_ui (tt, 10, mpfr_get_ui (t, MPFR_RNDN), MPFR_RNDN)
&& mpfr_cmp (a, tt) == 0)
break;
diff --git a/log1p.c b/log1p.c
index 10661ba14..2af69bae5 100644
--- a/log1p.c
+++ b/log1p.c
@@ -119,14 +119,14 @@ mpfr_log1p (mpfr_ptr y, mpfr_srcptr x, mp_rnd_t rnd_mode)
for (;;)
{
/* compute log1p */
- inexact = mpfr_add_ui (t, x, 1, GMP_RNDN); /* 1+x */
+ inexact = mpfr_add_ui (t, x, 1, MPFR_RNDN); /* 1+x */
/* if inexact = 0, then t = x+1, and the result is simply log(t) */
if (inexact == 0)
{
inexact = mpfr_log (y, t, rnd_mode);
goto end;
}
- mpfr_log (t, t, GMP_RNDN); /* log(1+x) */
+ mpfr_log (t, t, MPFR_RNDN); /* log(1+x) */
/* the error is bounded by (1/2+2^(1-EXP(t))*ulp(t) (cf algorithms.tex)
if EXP(t)>=2, then error <= ulp(t)
diff --git a/log2.c b/log2.c
index 35eef2e36..c98243d2c 100644
--- a/log2.c
+++ b/log2.c
@@ -109,9 +109,9 @@ mpfr_log2 (mpfr_ptr r, mpfr_srcptr a, mp_rnd_t rnd_mode)
for (;;)
{
/* compute log2 */
- mpfr_const_log2(t,GMP_RNDD); /* log(2) */
- mpfr_log(tt,a,GMP_RNDN); /* log(a) */
- mpfr_div(t,tt,t,GMP_RNDN); /* log(a)/log(2) */
+ mpfr_const_log2(t,MPFR_RNDD); /* log(2) */
+ mpfr_log(tt,a,MPFR_RNDN); /* log(a) */
+ mpfr_div(t,tt,t,MPFR_RNDN); /* log(a)/log(2) */
/* estimation of the error */
err = Nt-3;
diff --git a/logging.c b/logging.c
index 6e7c81b63..06f293533 100644
--- a/logging.c
+++ b/logging.c
@@ -59,7 +59,7 @@ mpfr_printf_mpfr_print (FILE *stream, const struct printf_info *info,
if (info->alt)
length = fprintf (stream, "%lu", (unsigned long) MPFR_PREC (w));
else
- length = mpfr_out_str (stream, mpfr_log_base, prec, w, GMP_RNDN);
+ length = mpfr_out_str (stream, mpfr_log_base, prec, w, MPFR_RNDN);
mpfr_log_type = org_type_logging;
return length;
diff --git a/modf.c b/modf.c
index 0af7f4d16..61bbfdb9a 100644
--- a/modf.c
+++ b/modf.c
@@ -92,7 +92,7 @@ mpfr_modf (mpfr_ptr iop, mpfr_ptr fop, mpfr_srcptr op, mpfr_rnd_t rnd_mode)
mpfr_init2 (opi, ope <= MPFR_PREC_MIN ? MPFR_PREC_MIN : ope);
inexi = mpfr_trunc (opi, op);
mpfr_init2 (opf, opq - ope <= MPFR_PREC_MIN ? MPFR_PREC_MIN : opq - ope);
- inexf = mpfr_frac (opf, op, GMP_RNDZ);
+ inexf = mpfr_frac (opf, op, MPFR_RNDZ);
MPFR_ASSERTD (inexf == 0);
inexf = mpfr_set (fop, opf, rnd_mode);
diff --git a/mpfr-impl.h b/mpfr-impl.h
index aa5dfda41..81f5895bf 100644
--- a/mpfr-impl.h
+++ b/mpfr-impl.h
@@ -723,41 +723,41 @@ typedef intmax_t mpfr_eexp_t;
******************************************************/
/* We want to test this :
- * (rnd == GMP_RNDU && test) || (rnd == RNDD && !test)
+ * (rnd == MPFR_RNDU && test) || (rnd == RNDD && !test)
* ie it transforms RNDU or RNDD to Away or Zero according to the sign */
#define MPFR_IS_RNDUTEST_OR_RNDDNOTTEST(rnd, test) \
- (((rnd) + (test)) == GMP_RNDD)
+ (((rnd) + (test)) == MPFR_RNDD)
/* We want to test if rnd = Zero, or Away.
'test' is 1 if negative, and 0 if positive. */
#define MPFR_IS_LIKE_RNDZ(rnd, test) \
- ((rnd==GMP_RNDZ) || MPFR_IS_RNDUTEST_OR_RNDDNOTTEST (rnd, test))
+ ((rnd==MPFR_RNDZ) || MPFR_IS_RNDUTEST_OR_RNDDNOTTEST (rnd, test))
#define MPFR_IS_LIKE_RNDU(rnd, sign) \
- ((rnd==GMP_RNDU) || (rnd==GMP_RNDZ && sign<0) || (rnd==GMP_RNDA && sign>0))
+ ((rnd==MPFR_RNDU) || (rnd==MPFR_RNDZ && sign<0) || (rnd==MPFR_RNDA && sign>0))
#define MPFR_IS_LIKE_RNDD(rnd, sign) \
- ((rnd==GMP_RNDD) || (rnd==GMP_RNDZ && sign>0) || (rnd==GMP_RNDA && sign<0))
+ ((rnd==MPFR_RNDD) || (rnd==MPFR_RNDZ && sign>0) || (rnd==MPFR_RNDA && sign<0))
/* Invert a rounding mode, RNDZ and RNDA are unchanged */
-#define MPFR_INVERT_RND(rnd) ((rnd == GMP_RNDU) ? GMP_RNDD : \
- ((rnd == GMP_RNDD) ? GMP_RNDU : rnd))
+#define MPFR_INVERT_RND(rnd) ((rnd == MPFR_RNDU) ? MPFR_RNDD : \
+ ((rnd == MPFR_RNDD) ? MPFR_RNDU : rnd))
/* Transform RNDU and RNDD to RNDZ according to test */
#define MPFR_UPDATE_RND_MODE(rnd, test) \
do { \
if (MPFR_UNLIKELY(MPFR_IS_RNDUTEST_OR_RNDDNOTTEST(rnd, test))) \
- rnd = GMP_RNDZ; \
+ rnd = MPFR_RNDZ; \
} while (0)
/* Transform RNDU and RNDD to RNDZ or RNDA according to sign,
leave the other modes unchanged */
#define MPFR_UPDATE2_RND_MODE(rnd, sign) \
do { \
- if (rnd == GMP_RNDU) \
- rnd = (sign > 0) ? GMP_RNDA : GMP_RNDZ; \
- else if (rnd == GMP_RNDD) \
- rnd = (sign < 0) ? GMP_RNDA : GMP_RNDZ; \
+ if (rnd == MPFR_RNDU) \
+ rnd = (sign > 0) ? MPFR_RNDA : MPFR_RNDZ; \
+ else if (rnd == MPFR_RNDD) \
+ rnd = (sign < 0) ? MPFR_RNDA : MPFR_RNDZ; \
} while (0)
@@ -1158,7 +1158,7 @@ typedef struct {
_ulp = MPFR_LIMB_ONE; \
} \
/* Rounding */ \
- if (MPFR_LIKELY (rnd == GMP_RNDN)) \
+ if (MPFR_LIKELY (rnd == MPFR_RNDN)) \
{ \
if (_rb == 0) \
{ \
@@ -1245,7 +1245,7 @@ typedef struct {
error at most 'error' */
#define MPFR_CAN_ROUND(b,err,prec,rnd) \
(!MPFR_IS_SINGULAR (b) && mpfr_round_p (MPFR_MANT (b), MPFR_LIMB_SIZE (b), \
- (err), (prec) + ((rnd)==GMP_RNDN)))
+ (err), (prec) + ((rnd)==MPFR_RNDN)))
/* TODO: fix this description (see round_near_x.c). */
/* Assuming that the function has a Taylor expansion which looks like:
diff --git a/mpfr.h b/mpfr.h
index 22cb0a77b..ec29621c2 100644
--- a/mpfr.h
+++ b/mpfr.h
@@ -59,23 +59,29 @@ MPFR_VERSION_NUM(MPFR_VERSION_MAJOR,MPFR_VERSION_MINOR,MPFR_VERSION_PATCHLEVEL)
(the integer type compatible with the enumerated type can even change,
see ISO C99, 6.7.2.2#4), and in Makefile.am, AGE should be set to 0.
- GMP_RNDU must appear just before GMP_RNDD (see
+ MPFR_RNDU must appear just before MPFR_RNDD (see
MPFR_IS_RNDUTEST_OR_RNDDNOTTEST in mpfr-impl.h).
If you change the order of the rounding modes, please update the routines
in texceptions.c which assume 0=RNDN, 1=RNDZ, 2=RNDU, 3=RNDD, 4=RNDA.
*/
typedef enum {
- GMP_RNDN=0, /* round to nearest, with ties to even */
- GMP_RNDZ, /* round toward zero */
- GMP_RNDU, /* round toward +Inf */
- GMP_RNDD, /* round toward -Inf */
- GMP_RNDA, /* round away from zero */
- GMP_RND_MAX, /* gives number of supported rounding modes, those after are
+ MPFR_RNDN=0, /* round to nearest, with ties to even */
+ MPFR_RNDZ, /* round toward zero */
+ MPFR_RNDU, /* round toward +Inf */
+ MPFR_RNDD, /* round toward -Inf */
+ MPFR_RNDA, /* round away from zero */
+ MPFR_RND_MAX, /* gives number of supported rounding modes, those after are
only supported by some functions */
- GMP_RNDNA=-1 /* round to nearest, with ties away from zero (mpfr_round) */
+ MPFR_RNDNA=-1 /* round to nearest, with ties away from zero (mpfr_round) */
} mpfr_rnd_t;
+/* kept for compatibility with MPFR 2.4.x and before */
+#define GMP_RNDN MPFR_RNDN
+#define GMP_RNDZ MPFR_RNDZ
+#define GMP_RNDU MPFR_RNDU
+#define GMP_RNDD MPFR_RNDD
+
/* Define precision : 1 (short), 2 (int) or 3 (long) (DON'T USE IT!)*/
#ifndef _MPFR_PREC_FORMAT
# if __GMP_MP_SIZE_T_INT == 1
@@ -716,10 +722,10 @@ __MPFR_DECLSPEC int mpfr_custom_get_kind _MPFR_PROTO ((mpfr_srcptr));
#define mpfr_get_prec(_x) ((_x)->_mpfr_prec + 0)
#define mpfr_get_exp(_x) ((_x)->_mpfr_exp + 0)
-#define mpfr_round(a,b) mpfr_rint((a), (b), GMP_RNDNA)
-#define mpfr_trunc(a,b) mpfr_rint((a), (b), GMP_RNDZ)
-#define mpfr_ceil(a,b) mpfr_rint((a), (b), GMP_RNDU)
-#define mpfr_floor(a,b) mpfr_rint((a), (b), GMP_RNDD)
+#define mpfr_round(a,b) mpfr_rint((a), (b), MPFR_RNDNA)
+#define mpfr_trunc(a,b) mpfr_rint((a), (b), MPFR_RNDZ)
+#define mpfr_ceil(a,b) mpfr_rint((a), (b), MPFR_RNDU)
+#define mpfr_floor(a,b) mpfr_rint((a), (b), MPFR_RNDD)
#define mpfr_cmp_ui(b,i) mpfr_cmp_ui_2exp((b),(i),0)
#define mpfr_cmp_si(b,i) mpfr_cmp_si_2exp((b),(i),0)
diff --git a/mpfr.texi b/mpfr.texi
index 6d354230e..0d5ae6367 100644
--- a/mpfr.texi
+++ b/mpfr.texi
@@ -618,11 +618,11 @@ life.
The following five rounding modes are supported:
@itemize @bullet
-@item @code{GMP_RNDN}: round to nearest (roundTiesToEven in IEEE 754-2008)
-@item @code{GMP_RNDZ}: round toward zero (roundTowardZero in IEEE 754-2008)
-@item @code{GMP_RNDU}: round toward plus infinity (roundTowardPositive in IEEE 754-2008)
-@item @code{GMP_RNDD}: round toward minus infinity (roundTowardNegative in IEEE 754-2008)
-@item @code{GMP_RNDA}: round away from zero (currently experimental)
+@item @code{MPFR_RNDN}: round to nearest (roundTiesToEven in IEEE 754-2008)
+@item @code{MPFR_RNDZ}: round toward zero (roundTowardZero in IEEE 754-2008)
+@item @code{MPFR_RNDU}: round toward plus infinity (roundTowardPositive in IEEE 754-2008)
+@item @code{MPFR_RNDD}: round toward minus infinity (roundTowardNegative in IEEE 754-2008)
+@item @code{MPFR_RNDA}: round away from zero (currently experimental)
@end itemize
The @samp{round to nearest} mode works as in the IEEE 754 standard: in
@@ -656,7 +656,7 @@ If the ternary value is zero, it means that the value stored in the
destination variable is the exact result of the corresponding mathematical
function. If the ternary value is positive (resp.@: negative), it means
the value stored in the destination variable is greater (resp.@: lower)
-than the exact result. For example with the @code{GMP_RNDU} rounding mode,
+than the exact result. For example with the @code{MPFR_RNDU} rounding mode,
the ternary value is usually positive, except when the result is exact, in
which case it is zero. In the case of an infinite result, it is considered
as inexact when it was obtained by overflow, and exact otherwise. A NaN
@@ -2073,7 +2073,7 @@ mpfr_init (x);
@dots{}
mpfr_printf ("%.128Rf", x);
mpfr_printf ("%.128RNf", x);
-mpfr_printf ("%.128R*f", GMP_RNDN, x);
+mpfr_printf ("%.128R*f", MPFR_RNDN, x);
@end example
@code{mpfr_printf} also adds a new conversion specifier @samp{b} which
@@ -2304,10 +2304,10 @@ This function @strong{does not modify} its arguments.
Note: if one wants to also determine the correct ternary value when rounding
@var{b} to precision @var{prec}, a useful trick is the following:
@verbatim
- if (mpfr_can_round (b, err, rnd1, GMP_RNDZ, prec + (rnd2 == GMP_RNDN)))
+ if (mpfr_can_round (b, err, rnd1, MPFR_RNDZ, prec + (rnd2 == MPFR_RNDN)))
...
@end verbatim
-Indeed, if @var{rnd2} is @code{GMP_RNDN}, this will check if one can
+Indeed, if @var{rnd2} is @code{MPFR_RNDN}, this will check if one can
round to @var{prec}+1 bits with a directed rounding:
if so, one can surely round to nearest to @var{prec} bits,
and in addition one can determine the correct ternary value, which would not
@@ -2316,7 +2316,7 @@ be the case when @var{b} is near from a value exactly representable on
@end deftypefun
@deftypefun {const char *} mpfr_print_rnd_mode (mp_rnd_t @var{rnd})
-Return the input string (GMP_RNDD, GMP_RNDU, GMP_RNDN, GMP_RNDZ)
+Return the input string (MPFR_RNDD, MPFR_RNDU, MPFR_RNDN, MPFR_RNDZ)
corresponding to the rounding mode @var{rnd} or a null pointer if
@var{rnd} is an invalid rounding mode.
@end deftypefun
@@ -2569,12 +2569,12 @@ This is an example of how to emulate binary double IEEE 754 arithmetic
mpfr_init (xa); mpfr_init (xb);
- b = 34.3; mpfr_set_d (xb, b, GMP_RNDN);
- a = 0x1.1235P-1021; mpfr_set_d (xa, a, GMP_RNDN);
+ b = 34.3; mpfr_set_d (xb, b, MPFR_RNDN);
+ a = 0x1.1235P-1021; mpfr_set_d (xa, a, MPFR_RNDN);
a /= b;
- i = mpfr_div (xa, xa, xb, GMP_RNDN);
- i = mpfr_subnormalize (xa, i, GMP_RNDN);
+ i = mpfr_div (xa, xa, xb, MPFR_RNDN);
+ i = mpfr_subnormalize (xa, i, MPFR_RNDN);
mpfr_clear (xa); mpfr_clear (xb);
@}
diff --git a/mul.c b/mul.c
index 8ea6907e7..05d279d6e 100644
--- a/mul.c
+++ b/mul.c
@@ -146,10 +146,10 @@ mpfr_mul3 (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mp_rnd_t rnd_mode)
result (i.e. before rounding, i.e. without taking cc into account)
is < __gmpfr_emin - 1 or the exact result is a power of 2 (i.e. if
both arguments are powers of 2), then round to zero. */
- if (rnd_mode == GMP_RNDN &&
+ if (rnd_mode == MPFR_RNDN &&
(ax + (mp_exp_t) b1 < __gmpfr_emin ||
(mpfr_powerof2_raw (b) && mpfr_powerof2_raw (c))))
- rnd_mode = GMP_RNDZ;
+ rnd_mode = MPFR_RNDZ;
return mpfr_underflow (a, rnd_mode, sign_product);
}
MPFR_SET_EXP (a, ax2);
@@ -167,8 +167,8 @@ mpfr_mul (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mp_rnd_t rnd_mode)
mpfr_init2 (ta, MPFR_PREC (a));
mpfr_init2 (tb, MPFR_PREC (b));
mpfr_init2 (tc, MPFR_PREC (c));
- MPFR_ASSERTN (mpfr_set (tb, b, GMP_RNDN) == 0);
- MPFR_ASSERTN (mpfr_set (tc, c, GMP_RNDN) == 0);
+ MPFR_ASSERTN (mpfr_set (tb, b, MPFR_RNDN) == 0);
+ MPFR_ASSERTN (mpfr_set (tc, c, MPFR_RNDN) == 0);
inexact2 = mpfr_mul3 (ta, tb, tc, rnd_mode);
inexact1 = mpfr_mul2 (a, b, c, rnd_mode);
@@ -179,13 +179,13 @@ mpfr_mul (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mp_rnd_t rnd_mode)
"Prec_a = %lu, Prec_b = %lu, Prec_c = %lu\nB = ",
mpfr_print_rnd_mode (rnd_mode),
MPFR_PREC (a), MPFR_PREC (b), MPFR_PREC (c));
- mpfr_out_str (stderr, 16, 0, tb, GMP_RNDN);
+ mpfr_out_str (stderr, 16, 0, tb, MPFR_RNDN);
fprintf (stderr, "\nC = ");
- mpfr_out_str (stderr, 16, 0, tc, GMP_RNDN);
+ mpfr_out_str (stderr, 16, 0, tc, MPFR_RNDN);
fprintf (stderr, "\nOldMul: ");
- mpfr_out_str (stderr, 16, 0, ta, GMP_RNDN);
+ mpfr_out_str (stderr, 16, 0, ta, MPFR_RNDN);
fprintf (stderr, "\nNewMul: ");
- mpfr_out_str (stderr, 16, 0, a, GMP_RNDN);
+ mpfr_out_str (stderr, 16, 0, a, MPFR_RNDN);
fprintf (stderr, "\nNewInexact = %d | OldInexact = %d\n",
inexact1, inexact2);
MPFR_ASSERTN(0);
@@ -276,7 +276,7 @@ mpfr_mul (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mp_rnd_t rnd_mode)
if (MPFR_UNLIKELY (ax > __gmpfr_emax + 1))
return mpfr_overflow (a, rnd_mode, sign);
if (MPFR_UNLIKELY (ax < __gmpfr_emin - 2))
- return mpfr_underflow (a, rnd_mode == GMP_RNDN ? GMP_RNDZ : rnd_mode,
+ return mpfr_underflow (a, rnd_mode == MPFR_RNDN ? MPFR_RNDZ : rnd_mode,
sign);
#endif
@@ -466,7 +466,7 @@ mpfr_mul (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mp_rnd_t rnd_mode)
MPFR_ASSERTD (MPFR_LIMB_MSB (tmp[tn-1]) != 0);
if (MPFR_UNLIKELY (!mpfr_round_p (tmp, tn, p+b1-1, MPFR_PREC(a)
- + (rnd_mode == GMP_RNDN))))
+ + (rnd_mode == MPFR_RNDN))))
{
tmp -= k - tn; /* tmp may have changed, FIX IT!!!!! */
goto full_multiply;
@@ -503,10 +503,10 @@ mpfr_mul (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mp_rnd_t rnd_mode)
result (i.e. before rounding, i.e. without taking cc into account)
is < __gmpfr_emin - 1 or the exact result is a power of 2 (i.e. if
both arguments are powers of 2), then round to zero. */
- if (rnd_mode == GMP_RNDN
+ if (rnd_mode == MPFR_RNDN
&& (ax + (mp_exp_t) b1 < __gmpfr_emin
|| (mpfr_powerof2_raw (b) && mpfr_powerof2_raw (c))))
- rnd_mode = GMP_RNDZ;
+ rnd_mode = MPFR_RNDZ;
return mpfr_underflow (a, rnd_mode, sign);
}
MPFR_RET (inexact);
diff --git a/mul_2si.c b/mul_2si.c
index 83de888a1..1e60250f0 100644
--- a/mul_2si.c
+++ b/mul_2si.c
@@ -42,11 +42,11 @@ mpfr_mul_2si (mpfr_ptr y, mpfr_srcptr x, long int n, mp_rnd_t rnd_mode)
else if (MPFR_UNLIKELY(n < 0 && (__gmpfr_emin > MPFR_EMAX_MAX + n ||
exp < __gmpfr_emin - n)))
{
- if (rnd_mode == GMP_RNDN &&
+ if (rnd_mode == MPFR_RNDN &&
(__gmpfr_emin > MPFR_EMAX_MAX + (n + 1) ||
exp < __gmpfr_emin - (n + 1) ||
(inexact >= 0 && mpfr_powerof2_raw (y))))
- rnd_mode = GMP_RNDZ;
+ rnd_mode = MPFR_RNDZ;
return mpfr_underflow (y, rnd_mode, MPFR_SIGN(y));
}
MPFR_SET_EXP (y, exp + n);
diff --git a/pow.c b/pow.c
index 2714b15c9..7c22c5b67 100644
--- a/pow.c
+++ b/pow.c
@@ -93,9 +93,9 @@ mpfr_pow_is_exact (mpfr_ptr z, mpfr_srcptr x, mpfr_srcptr y,
mp_prec_t p;
MPFR_MPZ_SIZEINBASE2 (p, a);
mpfr_init2 (tmp, p); /* prec = 1 should not be possible */
- res = mpfr_set_z (tmp, a, GMP_RNDN);
+ res = mpfr_set_z (tmp, a, MPFR_RNDN);
MPFR_ASSERTD (res == 0);
- res = mpfr_mul_2si (tmp, tmp, b, GMP_RNDN);
+ res = mpfr_mul_2si (tmp, tmp, b, MPFR_RNDN);
MPFR_ASSERTD (res == 0);
*inexact = mpfr_pow_z (z, tmp, c, rnd_mode);
mpfr_clear (tmp);
@@ -195,17 +195,17 @@ mpfr_pow_general (mpfr_ptr z, mpfr_srcptr x, mpfr_srcptr y,
{
MPFR_BLOCK_DECL (flags1);
- /* compute exp(y*ln|x|), using GMP_RNDU to get an upper bound, so
+ /* compute exp(y*ln|x|), using MPFR_RNDU to get an upper bound, so
that we can detect underflows. */
- mpfr_log (t, absx, MPFR_IS_NEG (y) ? GMP_RNDD : GMP_RNDU); /* ln|x| */
- mpfr_mul (t, y, t, GMP_RNDU); /* y*ln|x| */
+ mpfr_log (t, absx, MPFR_IS_NEG (y) ? MPFR_RNDD : MPFR_RNDU); /* ln|x| */
+ mpfr_mul (t, y, t, MPFR_RNDU); /* y*ln|x| */
if (k_non_zero)
{
MPFR_LOG_MSG (("subtract k * ln(2)\n", 0));
- mpfr_const_log2 (u, GMP_RNDD);
- mpfr_mul (u, u, k, GMP_RNDD);
+ mpfr_const_log2 (u, MPFR_RNDD);
+ mpfr_mul (u, u, k, MPFR_RNDD);
/* Error on u = k * log(2): < k * 2^(-Nt) < 1. */
- mpfr_sub (t, t, u, GMP_RNDU);
+ mpfr_sub (t, t, u, MPFR_RNDU);
MPFR_LOG_MSG (("t = y * ln|x| - k * ln(2)\n", 0));
MPFR_LOG_VAR (t);
}
@@ -224,7 +224,7 @@ mpfr_pow_general (mpfr_ptr z, mpfr_srcptr x, mpfr_srcptr y,
err = MPFR_GET_EXP (k);
err++;
}
- MPFR_BLOCK (flags1, mpfr_exp (t, t, GMP_RNDN)); /* exp(y*ln|x|)*/
+ MPFR_BLOCK (flags1, mpfr_exp (t, t, MPFR_RNDN)); /* exp(y*ln|x|)*/
/* We need to test */
if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (t) || MPFR_UNDERFLOW (flags1)))
{
@@ -240,7 +240,7 @@ mpfr_pow_general (mpfr_ptr z, mpfr_srcptr x, mpfr_srcptr y,
/* Underflow. We computed rndn(exp(t)), where t >= y*ln|x|.
Therefore rndn(|x|^y) = 0, and we have a real underflow on
|x|^y. */
- inexact = mpfr_underflow (z, rnd_mode == GMP_RNDN ? GMP_RNDZ
+ inexact = mpfr_underflow (z, rnd_mode == MPFR_RNDN ? MPFR_RNDZ
: rnd_mode, MPFR_SIGN_POS);
if (expo != NULL)
MPFR_SAVE_EXPO_UPDATE_FLAGS (*expo, MPFR_FLAGS_INEXACT
@@ -252,9 +252,9 @@ mpfr_pow_general (mpfr_ptr z, mpfr_srcptr x, mpfr_srcptr y,
if (MPFR_IS_INF (t))
{
/* Note: we can probably use a low precision for this test. */
- mpfr_log (t, absx, MPFR_IS_NEG (y) ? GMP_RNDU : GMP_RNDD);
- mpfr_mul (t, y, t, GMP_RNDD); /* y * ln|x| */
- MPFR_BLOCK (flags2, mpfr_exp (t, t, GMP_RNDD));
+ mpfr_log (t, absx, MPFR_IS_NEG (y) ? MPFR_RNDU : MPFR_RNDD);
+ mpfr_mul (t, y, t, MPFR_RNDD); /* y * ln|x| */
+ MPFR_BLOCK (flags2, mpfr_exp (t, t, MPFR_RNDD));
/* t = lower bound on exp(y * ln|x|) */
if (MPFR_OVERFLOW (flags2))
{
@@ -278,8 +278,8 @@ mpfr_pow_general (mpfr_ptr z, mpfr_srcptr x, mpfr_srcptr y,
}
mpfr_init2 (u, Nt);
mpfr_init2 (k, Ntmin);
- mpfr_log2 (k, absx, GMP_RNDN);
- mpfr_mul (k, y, k, GMP_RNDN);
+ mpfr_log2 (k, absx, MPFR_RNDN);
+ mpfr_mul (k, y, k, MPFR_RNDN);
mpfr_round (k, k);
MPFR_LOG_VAR (k);
/* |y| < 2^Ntmin, therefore |k| < 2^Nt. */
@@ -323,8 +323,8 @@ mpfr_pow_general (mpfr_ptr z, mpfr_srcptr x, mpfr_srcptr y,
* result is > 2^(emin - 2) and we need to round to 2^(emin - 1).
*/
MPFR_ASSERTN (MPFR_EMAX_MAX <= LONG_MAX);
- lk = mpfr_get_si (k, GMP_RNDN);
- if (rnd_mode == GMP_RNDN && inexact < 0 &&
+ lk = mpfr_get_si (k, MPFR_RNDN);
+ if (rnd_mode == MPFR_RNDN && inexact < 0 &&
MPFR_GET_EXP (z) + lk == __gmpfr_emin - 1 && mpfr_powerof2_raw (z))
{
/* Rounding to nearest, real result > z * 2^k = 2^(emin - 2),
@@ -523,13 +523,13 @@ mpfr_pow (mpfr_ptr z, mpfr_srcptr x, mpfr_srcptr y, mp_rnd_t rnd_mode)
(ii) if x < 0, we first compute t = o(-x), with rounding towards 1,
and then follow as in case (1). */
if (MPFR_SIGN (x) > 0)
- mpfr_log2 (t, x, GMP_RNDZ);
+ mpfr_log2 (t, x, MPFR_RNDZ);
else
{
- mpfr_neg (t, x, (cmp_x_1 > 0) ? GMP_RNDZ : GMP_RNDU);
- mpfr_log2 (t, t, GMP_RNDZ);
+ mpfr_neg (t, x, (cmp_x_1 > 0) ? MPFR_RNDZ : MPFR_RNDU);
+ mpfr_log2 (t, t, MPFR_RNDZ);
}
- mpfr_mul (t, t, y, GMP_RNDZ);
+ mpfr_mul (t, t, y, MPFR_RNDZ);
overflow = mpfr_cmp_si (t, __gmpfr_emax) > 0;
mpfr_clear (t);
MPFR_SAVE_EXPO_FREE (expo);
@@ -557,28 +557,28 @@ mpfr_pow (mpfr_ptr z, mpfr_srcptr x, mpfr_srcptr y, mp_rnd_t rnd_mode)
/* We must restore the flags. */
MPFR_SAVE_EXPO_MARK (expo);
mpfr_init2 (tmp, sizeof (mp_exp_t) * CHAR_BIT);
- inex2 = mpfr_set_exp_t (tmp, MPFR_GET_EXP (x), GMP_RNDN);
+ inex2 = mpfr_set_exp_t (tmp, MPFR_GET_EXP (x), MPFR_RNDN);
MPFR_ASSERTN (inex2 == 0);
if (MPFR_IS_NEG (y))
{
- inex2 = mpfr_sub_ui (tmp, tmp, 1, GMP_RNDN);
+ inex2 = mpfr_sub_ui (tmp, tmp, 1, MPFR_RNDN);
MPFR_ASSERTN (inex2 == 0);
}
- mpfr_mul (tmp, tmp, y, GMP_RNDU);
+ mpfr_mul (tmp, tmp, y, MPFR_RNDU);
if (MPFR_IS_NEG (y))
mpfr_nextabove (tmp);
/* tmp doesn't necessarily fit in ebound, but that doesn't matter
since we get the minimum value in such a case. */
- ebound = mpfr_get_exp_t (tmp, GMP_RNDU);
+ ebound = mpfr_get_exp_t (tmp, MPFR_RNDU);
mpfr_clear (tmp);
MPFR_SAVE_EXPO_FREE (expo);
if (MPFR_UNLIKELY (ebound <=
- __gmpfr_emin - (rnd_mode == GMP_RNDN ? 2 : 1)))
+ __gmpfr_emin - (rnd_mode == MPFR_RNDN ? 2 : 1)))
{
- /* warning: mpfr_underflow rounds away from 0 for GMP_RNDN */
+ /* warning: mpfr_underflow rounds away from 0 for MPFR_RNDN */
MPFR_LOG_MSG (("early underflow detection\n", 0));
return mpfr_underflow (z,
- rnd_mode == GMP_RNDN ? GMP_RNDZ : rnd_mode,
+ rnd_mode == MPFR_RNDN ? MPFR_RNDZ : rnd_mode,
MPFR_SIGN (x) < 0 && is_odd (y) ? -1 : 1);
}
}
@@ -597,7 +597,7 @@ mpfr_pow (mpfr_ptr z, mpfr_srcptr x, mpfr_srcptr y, mp_rnd_t rnd_mode)
MPFR_LOG_MSG (("special code for y not too large integer\n", 0));
mpz_init (zi);
- mpfr_get_z (zi, y, GMP_RNDN);
+ mpfr_get_z (zi, y, MPFR_RNDN);
inexact = mpfr_pow_z (z, x, zi, rnd_mode);
mpz_clear (zi);
return inexact;
@@ -619,7 +619,7 @@ mpfr_pow (mpfr_ptr z, mpfr_srcptr x, mpfr_srcptr y, mp_rnd_t rnd_mode)
an integer */
MPFR_SAVE_EXPO_MARK (expo);
mpfr_init2 (tmp, MPFR_PREC (y) + sizeof (long) * CHAR_BIT);
- inexact = mpfr_mul_si (tmp, y, b, GMP_RNDN); /* exact */
+ inexact = mpfr_mul_si (tmp, y, b, MPFR_RNDN); /* exact */
MPFR_ASSERTN (inexact == 0);
/* Note: as the exponent range has been extended, an overflow is not
possible (due to basic overflow and underflow checking above, as
@@ -651,12 +651,12 @@ mpfr_pow (mpfr_ptr z, mpfr_srcptr x, mpfr_srcptr y, mp_rnd_t rnd_mode)
/* We need an upper bound on the exponent of y * log(x). */
mpfr_init2 (t, 16);
if (MPFR_IS_POS(x))
- mpfr_log (t, x, cmp_x_1 < 0 ? GMP_RNDD : GMP_RNDU); /* away from 0 */
+ mpfr_log (t, x, cmp_x_1 < 0 ? MPFR_RNDD : MPFR_RNDU); /* away from 0 */
else
{
/* if x < -1, round to +Inf, else round to zero */
- mpfr_neg (t, x, (mpfr_cmp_si (x, -1) < 0) ? GMP_RNDU : GMP_RNDD);
- mpfr_log (t, t, (mpfr_cmp_ui (t, 1) < 0) ? GMP_RNDD : GMP_RNDU);
+ mpfr_neg (t, x, (mpfr_cmp_si (x, -1) < 0) ? MPFR_RNDU : MPFR_RNDD);
+ mpfr_log (t, t, (mpfr_cmp_ui (t, 1) < 0) ? MPFR_RNDD : MPFR_RNDU);
}
MPFR_ASSERTN (MPFR_IS_PURE_FP (t));
err = MPFR_GET_EXP (y) + MPFR_GET_EXP (t);
diff --git a/pow_si.c b/pow_si.c
index 352298081..b8034a446 100644
--- a/pow_si.c
+++ b/pow_si.c
@@ -159,8 +159,8 @@ mpfr_pow_si (mpfr_ptr y, mpfr_srcptr x, long int n, mp_rnd_t rnd)
/* We will compute rnd(rnd1(1/x) ^ |n|), where rnd1 is the rounding
toward sign(x), to avoid spurious overflow or underflow, as in
mpfr_pow_z. */
- rnd1 = MPFR_EXP (x) < 1 ? GMP_RNDZ :
- (MPFR_SIGN (x) > 0 ? GMP_RNDU : GMP_RNDD);
+ rnd1 = MPFR_EXP (x) < 1 ? MPFR_RNDZ :
+ (MPFR_SIGN (x) > 0 ? MPFR_RNDU : MPFR_RNDD);
MPFR_ZIV_INIT (loop, Nt);
for (;;)
@@ -195,7 +195,7 @@ mpfr_pow_si (mpfr_ptr y, mpfr_srcptr x, long int n, mp_rnd_t rnd)
MPFR_ZIV_FREE (loop);
mpfr_clear (t);
MPFR_LOG_MSG (("underflow\n", 0));
- if (rnd == GMP_RNDN)
+ if (rnd == MPFR_RNDN)
{
mpfr_t y2, nn;
@@ -207,12 +207,12 @@ mpfr_pow_si (mpfr_ptr y, mpfr_srcptr x, long int n, mp_rnd_t rnd)
MPFR_EXP (x) - 1) != 0);
mpfr_init2 (y2, 2);
mpfr_init2 (nn, sizeof (long) * CHAR_BIT);
- inexact = mpfr_set_si (nn, n, GMP_RNDN);
+ inexact = mpfr_set_si (nn, n, MPFR_RNDN);
MPFR_ASSERTN (inexact == 0);
inexact = mpfr_pow_general (y2, x, nn, rnd, 1,
(mpfr_save_expo_t *) NULL);
mpfr_clear (nn);
- mpfr_set (y, y2, GMP_RNDN);
+ mpfr_set (y, y2, MPFR_RNDN);
mpfr_clear (y2);
MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, MPFR_FLAGS_UNDERFLOW);
goto end;
diff --git a/pow_ui.c b/pow_ui.c
index 29f8c5b24..cc10e20d6 100644
--- a/pow_ui.c
+++ b/pow_ui.c
@@ -91,7 +91,7 @@ mpfr_pow_ui (mpfr_ptr y, mpfr_srcptr x, unsigned long int n, mp_rnd_t rnd)
+ MPFR_INT_CEIL_LOG2 (MPFR_PREC (y));
mpfr_init2 (res, prec);
- rnd1 = MPFR_IS_POS (x) ? GMP_RNDU : GMP_RNDD; /* away */
+ rnd1 = MPFR_IS_POS (x) ? MPFR_RNDU : MPFR_RNDD; /* away */
MPFR_ZIV_INIT (loop, prec);
for (;;)
@@ -105,13 +105,13 @@ mpfr_pow_ui (mpfr_ptr y, mpfr_srcptr x, unsigned long int n, mp_rnd_t rnd)
err = prec - 1 - (mpfr_prec_t) i;
/* First step: compute square from x */
MPFR_BLOCK (flags,
- inexact = mpfr_mul (res, x, x, GMP_RNDU);
+ inexact = mpfr_mul (res, x, x, MPFR_RNDU);
MPFR_ASSERTD (i >= 2);
if (n & (1UL << (i-2)))
inexact |= mpfr_mul (res, res, x, rnd1);
for (i -= 3; i >= 0 && !MPFR_BLOCK_EXCEP; i--)
{
- inexact |= mpfr_mul (res, res, res, GMP_RNDU);
+ inexact |= mpfr_mul (res, res, res, MPFR_RNDU);
if (n & (1UL << i))
inexact |= mpfr_mul (res, res, x, rnd1);
});
diff --git a/pow_z.c b/pow_z.c
index 2826434fe..a242e51dc 100644
--- a/pow_z.c
+++ b/pow_z.c
@@ -55,9 +55,9 @@ mpfr_pow_pos_z (mpfr_ptr y, mpfr_srcptr x, mpz_srcptr z, mp_rnd_t rnd, int cr)
/* round towards 1 (or -1) to avoid spurious overflow or underflow,
i.e. if an overflow or underflow occurs, it is a real exception
and is not just due to the rounding error. */
- rnd1 = (MPFR_EXP(x) >= 1) ? GMP_RNDZ
- : (MPFR_IS_POS(x) ? GMP_RNDU : GMP_RNDD);
- rnd2 = (MPFR_EXP(x) >= 1) ? GMP_RNDD : GMP_RNDU;
+ rnd1 = (MPFR_EXP(x) >= 1) ? MPFR_RNDZ
+ : (MPFR_IS_POS(x) ? MPFR_RNDU : MPFR_RNDD);
+ rnd2 = (MPFR_EXP(x) >= 1) ? MPFR_RNDD : MPFR_RNDU;
if (cr != 0)
prec = MPFR_PREC (y) + 3 + size_z + MPFR_INT_CEIL_LOG2 (MPFR_PREC (y));
@@ -110,7 +110,7 @@ mpfr_pow_pos_z (mpfr_ptr y, mpfr_srcptr x, mpz_srcptr z, mp_rnd_t rnd, int cr)
else if (MPFR_UNDERFLOW (flags))
{
MPFR_LOG_MSG (("underflow\n", 0));
- if (rnd == GMP_RNDN)
+ if (rnd == MPFR_RNDN)
{
mpfr_t y2, zz;
@@ -126,12 +126,12 @@ mpfr_pow_pos_z (mpfr_ptr y, mpfr_srcptr x, mpz_srcptr z, mp_rnd_t rnd, int cr)
MPFR_EXP (x) - 1) != 0);
mpfr_init2 (y2, 2);
mpfr_init2 (zz, ABS (SIZ (z)) * BITS_PER_MP_LIMB);
- inexact = mpfr_set_z (zz, z, GMP_RNDN);
+ inexact = mpfr_set_z (zz, z, MPFR_RNDN);
MPFR_ASSERTN (inexact == 0);
inexact = mpfr_pow_general (y2, x, zz, rnd, 1,
(mpfr_save_expo_t *) NULL);
mpfr_clear (zz);
- mpfr_set (y, y2, GMP_RNDN);
+ mpfr_set (y, y2, MPFR_RNDN);
mpfr_clear (y2);
__gmpfr_flags = MPFR_FLAGS_INEXACT | MPFR_FLAGS_UNDERFLOW;
}
@@ -234,8 +234,8 @@ mpfr_pow_z (mpfr_ptr y, mpfr_srcptr x, mpz_srcptr z, mp_rnd_t rnd)
MPFR_LOG_MSG (("underflow\n", 0));
/* |y| is a power of two, thus |y| <= 2^(emin-2), and in
rounding to nearest, the value must be rounded to 0. */
- if (rnd == GMP_RNDN)
- rnd = GMP_RNDZ;
+ if (rnd == MPFR_RNDN)
+ rnd = MPFR_RNDZ;
inexact = mpfr_underflow (y, rnd, MPFR_SIGN (y));
}
else if (MPFR_UNLIKELY (mpz_cmp_si (tmp, __gmpfr_emax) > 0))
@@ -277,8 +277,8 @@ mpfr_pow_z (mpfr_ptr y, mpfr_srcptr x, mpz_srcptr z, mp_rnd_t rnd)
/* We will compute rnd(rnd1(1/x) ^ (-z)), where rnd1 is the rounding
toward sign(x), to avoid spurious overflow or underflow. */
- rnd1 = MPFR_EXP (x) < 1 ? GMP_RNDZ :
- (MPFR_SIGN (x) > 0 ? GMP_RNDU : GMP_RNDD);
+ rnd1 = MPFR_EXP (x) < 1 ? MPFR_RNDZ :
+ (MPFR_SIGN (x) > 0 ? MPFR_RNDU : MPFR_RNDD);
MPFR_ZIV_INIT (loop, Nt);
for (;;)
@@ -317,7 +317,7 @@ mpfr_pow_z (mpfr_ptr y, mpfr_srcptr x, mpz_srcptr z, mp_rnd_t rnd)
MPFR_ZIV_FREE (loop);
mpfr_clear (t);
MPFR_LOG_MSG (("underflow\n", 0));
- if (rnd == GMP_RNDN)
+ if (rnd == MPFR_RNDN)
{
mpfr_t y2, zz;
@@ -329,12 +329,12 @@ mpfr_pow_z (mpfr_ptr y, mpfr_srcptr x, mpz_srcptr z, mp_rnd_t rnd)
MPFR_EXP (x) - 1) != 0);
mpfr_init2 (y2, 2);
mpfr_init2 (zz, ABS (SIZ (z)) * BITS_PER_MP_LIMB);
- inexact = mpfr_set_z (zz, z, GMP_RNDN);
+ inexact = mpfr_set_z (zz, z, MPFR_RNDN);
MPFR_ASSERTN (inexact == 0);
inexact = mpfr_pow_general (y2, x, zz, rnd, 1,
(mpfr_save_expo_t *) NULL);
mpfr_clear (zz);
- mpfr_set (y, y2, GMP_RNDN);
+ mpfr_set (y, y2, MPFR_RNDN);
mpfr_clear (y2);
MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, MPFR_FLAGS_UNDERFLOW);
goto end;
diff --git a/print_rnd_mode.c b/print_rnd_mode.c
index 4c219c96c..5c3a7b1fb 100644
--- a/print_rnd_mode.c
+++ b/print_rnd_mode.c
@@ -27,16 +27,16 @@ mpfr_print_rnd_mode (mp_rnd_t rnd_mode)
{
switch (rnd_mode)
{
- case GMP_RNDD:
- return "GMP_RNDD";
- case GMP_RNDU:
- return "GMP_RNDU";
- case GMP_RNDN:
- return "GMP_RNDN";
- case GMP_RNDZ:
- return "GMP_RNDZ";
- case GMP_RNDA:
- return "GMP_RNDA";
+ case MPFR_RNDD:
+ return "MPFR_RNDD";
+ case MPFR_RNDU:
+ return "MPFR_RNDU";
+ case MPFR_RNDN:
+ return "MPFR_RNDN";
+ case MPFR_RNDZ:
+ return "MPFR_RNDZ";
+ case MPFR_RNDA:
+ return "MPFR_RNDA";
default:
return (const char*) 0;
}
diff --git a/rec_sqrt.c b/rec_sqrt.c
index 65b3fc03d..3dc6c5f3b 100644
--- a/rec_sqrt.c
+++ b/rec_sqrt.c
@@ -504,7 +504,7 @@ mpfr_rec_sqrt (mpfr_ptr r, mpfr_srcptr u, mp_rnd_t rnd_mode)
if the input was truncated, the error is at most two ulps
(see algorithms.tex). */
if (MPFR_LIKELY (mpfr_round_p (x, wn, wp - (wp < up),
- rp + (rnd_mode == GMP_RNDN))))
+ rp + (rnd_mode == MPFR_RNDN))))
break;
/* We detect only now the exact case where u=2^(2e), to avoid
diff --git a/reldiff.c b/reldiff.c
index bbece3790..e494a9e2a 100644
--- a/reldiff.c
+++ b/reldiff.c
@@ -60,7 +60,7 @@ mpfr_reldiff (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mp_rnd_t rnd_mode)
if (a == b)
{
mpfr_init2 (b_copy, MPFR_PREC(b));
- mpfr_set (b_copy, b, GMP_RNDN);
+ mpfr_set (b_copy, b, MPFR_RNDN);
}
mpfr_sub (a, b, c, rnd_mode);
diff --git a/rem1.c b/rem1.c
index 285afd960..1cf409d5c 100644
--- a/rem1.c
+++ b/rem1.c
@@ -30,7 +30,7 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
/*
rem1 works as follows:
The first rounding mode rnd_q indicate if we are actually computing
- a fmod (GMP_RNDZ) or a remainder/remquo (GMP_RNDN).
+ a fmod (MPFR_RNDZ) or a remainder/remquo (MPFR_RNDN).
Let q = x/y rounded to an integer in the direction rnd_q.
Put x - q*y in rem, rounded according to rnd.
@@ -60,7 +60,7 @@ mpfr_rem1 (mpfr_ptr rem, long *quo, mp_rnd_t rnd_q,
int compare, inex, q_is_odd, sign, signx = MPFR_SIGN (x);
mpz_t mx, my, r;
- MPFR_ASSERTD (rnd_q == GMP_RNDN || rnd_q == GMP_RNDZ);
+ MPFR_ASSERTD (rnd_q == MPFR_RNDN || rnd_q == MPFR_RNDZ);
if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (x) || MPFR_IS_SINGULAR (y)))
{
@@ -110,14 +110,14 @@ mpfr_rem1 (mpfr_ptr rem, long *quo, mp_rnd_t rnd_q,
{
/* q = x/y = mx/(my*2^(ey-ex)) */
mpz_mul_2exp (my, my, ey - ex); /* divide mx by my*2^(ey-ex) */
- if (rnd_q == GMP_RNDZ)
+ if (rnd_q == MPFR_RNDZ)
/* 0 <= |r| <= |my|, r has the same sign as mx */
mpz_tdiv_qr (mx, r, mx, my);
else
/* 0 <= |r| <= |my|, r has the same sign as my */
mpz_fdiv_qr (mx, r, mx, my);
- if (rnd_q == GMP_RNDN)
+ if (rnd_q == MPFR_RNDN)
q_is_odd = mpz_tstbit (mx, 0);
if (quo) /* mx is the quotient */
{
@@ -157,7 +157,7 @@ mpfr_rem1 (mpfr_ptr rem, long *quo, mp_rnd_t rnd_q,
else /* now 0 <= r < 2Y */
{
mpz_div_2exp (my, my, 1); /* back to Y */
- if (rnd_q == GMP_RNDN)
+ if (rnd_q == MPFR_RNDN)
{
/* least significant bit of q */
q_is_odd = mpz_cmpabs (r, my) >= 0;
@@ -171,14 +171,14 @@ mpfr_rem1 (mpfr_ptr rem, long *quo, mp_rnd_t rnd_q,
if (mpz_cmp_ui (r, 0) == 0)
{
- inex = mpfr_set_ui (rem, 0, GMP_RNDN);
+ inex = mpfr_set_ui (rem, 0, MPFR_RNDN);
/* take into account sign of x */
if (signx < 0)
- mpfr_neg (rem, rem, GMP_RNDN);
+ mpfr_neg (rem, rem, MPFR_RNDN);
}
else
{
- if (rnd_q == GMP_RNDN)
+ if (rnd_q == MPFR_RNDN)
{
/* FIXME: the comparison 2*r < my could be done more efficiently
at the mpn level */
@@ -186,12 +186,12 @@ mpfr_rem1 (mpfr_ptr rem, long *quo, mp_rnd_t rnd_q,
compare = mpz_cmpabs (r, my);
mpz_div_2exp (r, r, 1);
compare = ((compare > 0) ||
- ((rnd_q == GMP_RNDN) && (compare == 0) && q_is_odd));
+ ((rnd_q == MPFR_RNDN) && (compare == 0) && q_is_odd));
/* if compare != 0, we need to subtract my to r, and add 1 to quo */
if (compare)
{
mpz_sub (r, r, my);
- if (quo && (rnd_q == GMP_RNDN))
+ if (quo && (rnd_q == MPFR_RNDN))
*quo += 1;
}
}
@@ -216,18 +216,18 @@ mpfr_rem1 (mpfr_ptr rem, long *quo, mp_rnd_t rnd_q,
int
mpfr_remainder (mpfr_ptr rem, mpfr_srcptr x, mpfr_srcptr y, mp_rnd_t rnd)
{
- return mpfr_rem1 (rem, (long *) 0, GMP_RNDN, x, y, rnd);
+ return mpfr_rem1 (rem, (long *) 0, MPFR_RNDN, x, y, rnd);
}
int
mpfr_remquo (mpfr_ptr rem, long *quo,
mpfr_srcptr x, mpfr_srcptr y, mp_rnd_t rnd)
{
- return mpfr_rem1 (rem, quo, GMP_RNDN, x, y, rnd);
+ return mpfr_rem1 (rem, quo, MPFR_RNDN, x, y, rnd);
}
int
mpfr_fmod (mpfr_ptr rem, mpfr_srcptr x, mpfr_srcptr y, mp_rnd_t rnd)
{
- return mpfr_rem1 (rem, (long *) 0, GMP_RNDZ, x, y, rnd);
+ return mpfr_rem1 (rem, (long *) 0, MPFR_RNDZ, x, y, rnd);
}
diff --git a/replace_all b/replace_all
index cdf14a6f2..d77d853d5 100755
--- a/replace_all
+++ b/replace_all
@@ -1,10 +1,10 @@
#!/bin/csh
-foreach f (*.c *.h mpfr.texi)
+foreach f (*.c *.h mpfr.texi FAQ.html TODO)
sed "s/$1/$2/g" $f > /tmp/$f
mv /tmp/$f $f
end
cd tests
-foreach f (*.c)
+foreach f (*.c *.h)
sed "s/$1/$2/g" $f > /tmp/$f
mv /tmp/$f $f
end
diff --git a/rint.c b/rint.c
index 3838aaa2f..988f1c2d1 100644
--- a/rint.c
+++ b/rint.c
@@ -57,10 +57,10 @@ mpfr_rint (mpfr_ptr r, mpfr_srcptr u, mpfr_rnd_t rnd_mode)
exp = MPFR_GET_EXP (u);
rnd_away =
- rnd_mode == GMP_RNDD ? sign < 0 :
- rnd_mode == GMP_RNDU ? sign > 0 :
- rnd_mode == GMP_RNDZ ? 0 :
- rnd_mode == GMP_RNDA ? 1 :
+ rnd_mode == MPFR_RNDD ? sign < 0 :
+ rnd_mode == MPFR_RNDU ? sign > 0 :
+ rnd_mode == MPFR_RNDZ ? 0 :
+ rnd_mode == MPFR_RNDA ? 1 :
-1; /* round to nearest-even (RNDN) or nearest-away (RNDNA) */
/* rnd_away:
@@ -71,10 +71,10 @@ mpfr_rint (mpfr_ptr r, mpfr_srcptr u, mpfr_rnd_t rnd_mode)
if (MPFR_UNLIKELY (exp <= 0)) /* 0 < |u| < 1 ==> round |u| to 0 or 1 */
{
- /* Note: in the GMP_RNDN mode, 0.5 must be rounded to 0. */
+ /* Note: in the MPFR_RNDN mode, 0.5 must be rounded to 0. */
if (rnd_away != 0 &&
(rnd_away > 0 ||
- (exp == 0 && (rnd_mode == GMP_RNDNA ||
+ (exp == 0 && (rnd_mode == MPFR_RNDNA ||
!mpfr_powerof2_raw (u)))))
{
mp_limb_t *rp;
@@ -149,9 +149,9 @@ mpfr_rint (mpfr_ptr r, mpfr_srcptr u, mpfr_rnd_t rnd_mode)
MPN_COPY (rp, up + (un - rn), rn); /* r != u */
if (rnd_away < 0)
{
- /* This is a rounding to nearest mode (GMP_RNDN or GMP_RNDNA).
+ /* This is a rounding to nearest mode (MPFR_RNDN or MPFR_RNDNA).
Decide the rounding direction here. */
- if (rnd_mode == GMP_RNDN &&
+ if (rnd_mode == MPFR_RNDN &&
(rp[0] & (MPFR_LIMB_ONE << sh)) == 0)
{ /* halfway cases rounded towards zero */
mp_limb_t a, b;
@@ -236,7 +236,7 @@ mpfr_rint (mpfr_ptr r, mpfr_srcptr u, mpfr_rnd_t rnd_mode)
Decide the rounding direction here. */
if (uj == 0 && sh == 0)
rnd_away = 0; /* rounding bit = 0 (not represented in u) */
- else if (rnd_mode == GMP_RNDN &&
+ else if (rnd_mode == MPFR_RNDN &&
(rp[0] & (MPFR_LIMB_ONE << sh)) == 0)
{ /* halfway cases rounded towards zero */
mp_limb_t a, b;
@@ -304,7 +304,7 @@ mpfr_rint (mpfr_ptr r, mpfr_srcptr u, mpfr_rnd_t rnd_mode)
int
mpfr_round (mpfr_ptr r, mpfr_srcptr u)
{
- return mpfr_rint (r, u, GMP_RNDNA);
+ return mpfr_rint (r, u, MPFR_RNDNA);
}
#undef mpfr_trunc
@@ -312,7 +312,7 @@ mpfr_round (mpfr_ptr r, mpfr_srcptr u)
int
mpfr_trunc (mpfr_ptr r, mpfr_srcptr u)
{
- return mpfr_rint (r, u, GMP_RNDZ);
+ return mpfr_rint (r, u, MPFR_RNDZ);
}
#undef mpfr_ceil
@@ -320,7 +320,7 @@ mpfr_trunc (mpfr_ptr r, mpfr_srcptr u)
int
mpfr_ceil (mpfr_ptr r, mpfr_srcptr u)
{
- return mpfr_rint (r, u, GMP_RNDU);
+ return mpfr_rint (r, u, MPFR_RNDU);
}
#undef mpfr_floor
@@ -328,7 +328,7 @@ mpfr_ceil (mpfr_ptr r, mpfr_srcptr u)
int
mpfr_floor (mpfr_ptr r, mpfr_srcptr u)
{
- return mpfr_rint (r, u, GMP_RNDD);
+ return mpfr_rint (r, u, MPFR_RNDD);
}
#undef mpfr_rint_round
diff --git a/root.c b/root.c
index 198344772..31d2b94af 100644
--- a/root.c
+++ b/root.c
@@ -134,7 +134,7 @@ mpfr_root (mpfr_ptr y, mpfr_srcptr x, unsigned long k, mp_rnd_t rnd_mode)
MPFR_MPZ_SIZEINBASE2 (size_m, m);
/* for rounding to nearest, we want the round bit to be in the root */
- n = MPFR_PREC (y) + (rnd_mode == GMP_RNDN);
+ n = MPFR_PREC (y) + (rnd_mode == MPFR_RNDN);
/* we now multiply m by 2^(r+k*sh) so that root(m,k) will give
exactly n bits: we want k*(n-1)+1 <= size_m + k*sh + r <= k*n
@@ -174,8 +174,8 @@ mpfr_root (mpfr_ptr y, mpfr_srcptr x, unsigned long k, mp_rnd_t rnd_mode)
{
if (negative)
rnd_mode = MPFR_INVERT_RND (rnd_mode);
- if (rnd_mode == GMP_RNDU || rnd_mode == GMP_RNDA
- || (rnd_mode == GMP_RNDN && mpz_tstbit (m, 0)))
+ if (rnd_mode == MPFR_RNDU || rnd_mode == MPFR_RNDA
+ || (rnd_mode == MPFR_RNDN && mpz_tstbit (m, 0)))
inexact = 1, mpz_add_ui (m, m, 1);
else
inexact = -1;
@@ -183,8 +183,8 @@ mpfr_root (mpfr_ptr y, mpfr_srcptr x, unsigned long k, mp_rnd_t rnd_mode)
/* either inexact is not zero, and the conversion is exact, i.e. inexact
is not changed; or inexact=0, and inexact is set only when
- rnd_mode=GMP_RNDN and bit (n+1) from m is 1 */
- inexact += mpfr_set_z (y, m, GMP_RNDN);
+ rnd_mode=MPFR_RNDN and bit (n+1) from m is 1 */
+ inexact += mpfr_set_z (y, m, MPFR_RNDN);
MPFR_SET_EXP (y, MPFR_GET_EXP (y) + e / (mp_exp_t) k);
if (negative)
diff --git a/round_near_x.c b/round_near_x.c
index fdca45f26..78bc83656 100644
--- a/round_near_x.c
+++ b/round_near_x.c
@@ -170,7 +170,7 @@ mpfr_round_near_x (mpfr_ptr y, mpfr_srcptr v, mpfr_uexp_t err, int dir,
&& (err > MPFR_PREC (v)
|| mpfr_round_p (MPFR_MANT (v), MPFR_LIMB_SIZE (v),
(mp_exp_t) err,
- MPFR_PREC (y) + (rnd == GMP_RNDN)))))
+ MPFR_PREC (y) + (rnd == MPFR_RNDN)))))
/* If we assume we can not round, return 0, and y is not modified */
return 0;
@@ -214,7 +214,7 @@ mpfr_round_near_x (mpfr_ptr y, mpfr_srcptr v, mpfr_uexp_t err, int dir,
{
inexact = -sign;
/* Round Away */
- if (rnd != GMP_RNDN && !MPFR_IS_LIKE_RNDZ (rnd, MPFR_IS_NEG_SIGN(sign)))
+ if (rnd != MPFR_RNDN && !MPFR_IS_LIKE_RNDZ (rnd, MPFR_IS_NEG_SIGN(sign)))
{
/* case nexttoinf */
/* The overflow flag should be set if the result is infinity */
diff --git a/round_p.c b/round_p.c
index 2f3de8321..0c4e88fd4 100644
--- a/round_p.c
+++ b/round_p.c
@@ -33,7 +33,7 @@ mpfr_round_p (mp_limb_t *bp, mp_size_t bn, mp_exp_t err0, mp_prec_t prec)
i1 = mpfr_round_p_2 (bp, bn, err0, prec);
i2 = mpfr_can_round_raw (bp, bn, MPFR_SIGN_POS, err0,
- GMP_RNDN, GMP_RNDZ, prec);
+ MPFR_RNDN, MPFR_RNDZ, prec);
if (i1 != i2)
{
fprintf (stderr, "mpfr_round_p(%d) != mpfr_can_round(%d)!\n"
diff --git a/round_prec.c b/round_prec.c
index 8b00a3468..a1e6b2273 100644
--- a/round_prec.c
+++ b/round_prec.c
@@ -143,7 +143,7 @@ mpfr_can_round_raw (const mp_limb_t *bp, mp_size_t bn, int neg, mp_exp_t err0,
return 0; /* can't round */
else if (MPFR_UNLIKELY (prec > (mp_prec_t) bn * BITS_PER_MP_LIMB))
{ /* then ulp(b) < precision < error */
- return rnd2 == GMP_RNDN && (mp_exp_unsigned_t) err0 - 2 >= prec;
+ return rnd2 == MPFR_RNDN && (mp_exp_unsigned_t) err0 - 2 >= prec;
/* can round only in rounding to the nearest and err0 >= prec + 2 */
}
@@ -185,18 +185,18 @@ mpfr_can_round_raw (const mp_limb_t *bp, mp_size_t bn, int neg, mp_exp_t err0,
/* Transform RNDD and RNDU to Zero / Away */
MPFR_ASSERTD((neg == 0) || (neg ==1));
if (MPFR_IS_RNDUTEST_OR_RNDDNOTTEST(rnd1, neg))
- rnd1 = GMP_RNDZ;
+ rnd1 = MPFR_RNDZ;
switch (rnd1)
{
- case GMP_RNDZ:
+ case MPFR_RNDZ:
/* Round to Zero */
cc = (bp[bn - 1] >> s1) & 1;
cc ^= mpfr_round_raw2(bp, bn, neg, rnd2, prec);
/* now round b +/- 2^(MPFR_EXP(b)-err) */
cc2 = mpn_add_1 (tmp + bn - k, bp + bn - k, k, MPFR_LIMB_ONE << s);
break;
- case GMP_RNDN:
+ case MPFR_RNDN:
/* Round to nearest */
/* first round b+2^(MPFR_EXP(b)-err) */
cc = mpn_add_1 (tmp + bn - k, bp + bn - k, k, MPFR_LIMB_ONE << s);
diff --git a/round_raw_generic.c b/round_raw_generic.c
index 4772ad4f9..cfacd6d3d 100644
--- a/round_raw_generic.c
+++ b/round_raw_generic.c
@@ -39,7 +39,7 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
* is a power of two.
*
* If inexp != NULL, put in *inexp the inexact flag of the rounding (0, 1, -1).
- * In case of even rounding when rnd = GMP_RNDN, put MPFR_EVEN_INEX (2) or
+ * In case of even rounding when rnd = MPFR_RNDN, put MPFR_EVEN_INEX (2) or
* -MPFR_EVEN_INEX (-2) in *inexp.
*
* If flag = 1, just returns whether one should add 1 or not for rounding.
@@ -118,7 +118,7 @@ mpfr_round_raw_generic(
MPFR_ASSERTD(k >= 0);
sb = xp[k] & lomask; /* First non-significant bits */
/* Rounding to nearest ? */
- if (MPFR_LIKELY( rnd_mode == GMP_RNDN) )
+ if (MPFR_LIKELY( rnd_mode == MPFR_RNDN) )
{
/* Rounding to nearest */
mp_limb_t rbmask = MPFR_LIMB_ONE << (BITS_PER_MP_LIMB - 1 - rw);
@@ -134,7 +134,7 @@ mpfr_round_raw_generic(
/* rounding to nearest, with rounding bit = 1 */
if (MPFR_UNLIKELY(sb == 0)) /* Even rounding. */
{
- /* sb == 0 && rnd_mode == GMP_RNDN */
+ /* sb == 0 && rnd_mode == MPFR_RNDN */
sb = xp[xsize - nw] & (himask ^ (himask << 1));
if (sb == 0)
{
@@ -143,7 +143,7 @@ mpfr_round_raw_generic(
/* ((neg!=0)^(sb!=0)) ? MPFR_EVEN_INEX : -MPFR_EVEN_INEX;*/
/* Since neg = 0 or 1 and sb=0*/
#if flag == 1
- return 0 /*sb != 0 && rnd_mode != GMP_RNDZ */;
+ return 0 /*sb != 0 && rnd_mode != MPFR_RNDZ */;
#else
MPN_COPY_INCR(yp, xp + xsize - nw, nw);
yp[0] &= himask;
@@ -152,7 +152,7 @@ mpfr_round_raw_generic(
}
else
{
- /* sb != 0 && rnd_mode == GMP_RNDN */
+ /* sb != 0 && rnd_mode == MPFR_RNDN */
if (use_inexp)
*inexp = MPFR_EVEN_INEX-2*MPFR_EVEN_INEX*neg;
/*((neg!=0)^(sb!=0))? MPFR_EVEN_INEX : -MPFR_EVEN_INEX; */
@@ -160,14 +160,14 @@ mpfr_round_raw_generic(
goto rnd_RNDN_add_one_ulp;
}
}
- else /* sb != 0 && rnd_mode == GMP_RNDN*/
+ else /* sb != 0 && rnd_mode == MPFR_RNDN*/
{
if (use_inexp)
/* *inexp = (neg == 0) ? 1 : -1; but since neg = 0 or 1 */
*inexp = 1-2*neg;
rnd_RNDN_add_one_ulp:
#if flag == 1
- return 1; /*sb != 0 && rnd_mode != GMP_RNDZ;*/
+ return 1; /*sb != 0 && rnd_mode != MPFR_RNDZ;*/
#else
carry = mpn_add_1 (yp, xp + xsize - nw, nw,
rw ?
@@ -181,16 +181,16 @@ mpfr_round_raw_generic(
/* Rounding to Zero ? */
else if (MPFR_IS_LIKE_RNDZ(rnd_mode, neg))
{
- /* rnd_mode == GMP_RNDZ */
+ /* rnd_mode == MPFR_RNDZ */
rnd_RNDZ:
while (MPFR_UNLIKELY(sb == 0) && k > 0)
sb = xp[--k];
if (use_inexp)
- /* rnd_mode == GMP_RNDZ and neg = 0 or 1 */
- /* (neg != 0) ^ (rnd_mode != GMP_RNDZ)) ? 1 : -1);*/
+ /* rnd_mode == MPFR_RNDZ and neg = 0 or 1 */
+ /* (neg != 0) ^ (rnd_mode != MPFR_RNDZ)) ? 1 : -1);*/
*inexp = MPFR_UNLIKELY(sb == 0) ? 0 : (2*neg-1);
#if flag == 1
- return 0; /*sb != 0 && rnd_mode != GMP_RNDZ;*/
+ return 0; /*sb != 0 && rnd_mode != MPFR_RNDZ;*/
#else
MPN_COPY_INCR(yp, xp + xsize - nw, nw);
yp[0] &= himask;
@@ -204,9 +204,9 @@ mpfr_round_raw_generic(
sb = xp[--k];
if (MPFR_UNLIKELY(sb == 0))
{
- /* sb = 0 && rnd_mode != GMP_RNDZ */
+ /* sb = 0 && rnd_mode != MPFR_RNDZ */
if (use_inexp)
- /* (neg != 0) ^ (rnd_mode != GMP_RNDZ)) ? 1 : -1);*/
+ /* (neg != 0) ^ (rnd_mode != MPFR_RNDZ)) ? 1 : -1);*/
*inexp = 0;
#if flag == 1
return 0;
@@ -218,9 +218,9 @@ mpfr_round_raw_generic(
}
else
{
- /* sb != 0 && rnd_mode != GMP_RNDZ */
+ /* sb != 0 && rnd_mode != MPFR_RNDZ */
if (use_inexp)
- /* (neg != 0) ^ (rnd_mode != GMP_RNDZ)) ? 1 : -1);*/
+ /* (neg != 0) ^ (rnd_mode != MPFR_RNDZ)) ? 1 : -1);*/
*inexp = 1-2*neg;
#if flag == 1
return 1;
@@ -238,7 +238,7 @@ mpfr_round_raw_generic(
{
/* Roundind mode = Zero / No inexact flag */
#if flag == 1
- return 0 /*sb != 0 && rnd_mode != GMP_RNDZ*/;
+ return 0 /*sb != 0 && rnd_mode != MPFR_RNDZ*/;
#else
if (MPFR_LIKELY(rw))
{
diff --git a/sech.c b/sech.c
index b73cf55b0..a2818b706 100644
--- a/sech.c
+++ b/sech.c
@@ -29,7 +29,7 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
#define FUNCTION mpfr_sech
#define INVERSE mpfr_cosh
#define ACTION_NAN(y) do { MPFR_SET_NAN(y); MPFR_RET_NAN; } while (1)
-#define ACTION_INF(y) return mpfr_set_ui (y, 0, GMP_RNDN)
+#define ACTION_INF(y) return mpfr_set_ui (y, 0, MPFR_RNDN)
#define ACTION_ZERO(y,x) return mpfr_set_ui (y, 1, rnd_mode)
/* for x near 0, sech(x) = 1 - x^2/2 + ..., more precisely |sech(x)-1| <= x^2/2
for |x| <= 1. The tiny action is the same as for cos(x). */
diff --git a/set_ld.c b/set_ld.c
index 77ac4e193..b224f063f 100644
--- a/set_ld.c
+++ b/set_ld.c
@@ -173,9 +173,9 @@ mpfr_set_ld (mpfr_ptr r, long double d, mp_rnd_t rnd_mode)
}
else
{
- inexact = mpfr_set_d (u, (double) x, GMP_RNDZ);
+ inexact = mpfr_set_d (u, (double) x, MPFR_RNDZ);
MPFR_ASSERTD (inexact == 0);
- if (mpfr_add (t, t, u, GMP_RNDZ) != 0)
+ if (mpfr_add (t, t, u, MPFR_RNDZ) != 0)
{
if (!mpfr_number_p (t))
break;
@@ -200,9 +200,9 @@ mpfr_set_ld (mpfr_ptr r, long double d, mp_rnd_t rnd_mode)
rb_mask = MPFR_LIMB_ONE <<
(BITS_PER_MP_LIMB - 1 -
(MPFR_PREC (r) & (BITS_PER_MP_LIMB - 1)));
- if (rnd_mode == GMP_RNDN)
+ if (rnd_mode == MPFR_RNDN)
rnd_mode = (*tp & rb_mask) ^ MPFR_IS_NEG (t) ?
- GMP_RNDU : GMP_RNDD;
+ MPFR_RNDU : MPFR_RNDD;
*tp |= rb_mask;
break;
}
diff --git a/set_q.c b/set_q.c
index b9c0a33e9..2cb0d688d 100644
--- a/set_q.c
+++ b/set_q.c
@@ -109,8 +109,8 @@ mpfr_set_q (mpfr_ptr f, mpq_srcptr q, mp_rnd_t rnd)
}
if (MPFR_UNLIKELY (sn < MPFR_EMIN_MIN / BITS_PER_MP_LIMB -1))
{
- if (rnd == GMP_RNDN)
- rnd = GMP_RNDZ;
+ if (rnd == MPFR_RNDN)
+ rnd = MPFR_RNDZ;
inexact = mpfr_underflow (f, rnd, MPFR_SIGN (f));
goto end;
}
diff --git a/set_rnd.c b/set_rnd.c
index 32e3ff248..d2e4640a3 100644
--- a/set_rnd.c
+++ b/set_rnd.c
@@ -23,12 +23,12 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
#include "mpfr-impl.h"
-mp_rnd_t MPFR_THREAD_ATTR __gmpfr_default_rounding_mode = GMP_RNDN;
+mp_rnd_t MPFR_THREAD_ATTR __gmpfr_default_rounding_mode = MPFR_RNDN;
void
mpfr_set_default_rounding_mode (mp_rnd_t rnd_mode)
{
- if (rnd_mode >= GMP_RNDN && rnd_mode < GMP_RND_MAX)
+ if (rnd_mode >= MPFR_RNDN && rnd_mode < MPFR_RND_MAX)
__gmpfr_default_rounding_mode = rnd_mode;
}
diff --git a/set_str_raw.c b/set_str_raw.c
index a9a8f40b9..0543cd63b 100644
--- a/set_str_raw.c
+++ b/set_str_raw.c
@@ -50,6 +50,6 @@ mpfr_set_str_binary (mpfr_ptr x, const char *str)
return;
}
- res = mpfr_strtofr (x, str, 0, 2, GMP_RNDZ);
+ res = mpfr_strtofr (x, str, 0, 2, MPFR_RNDZ);
MPFR_ASSERTN (res == 0);
}
diff --git a/set_uj.c b/set_uj.c
index e6ff097a9..238b41a45 100644
--- a/set_uj.c
+++ b/set_uj.c
@@ -122,8 +122,8 @@ mpfr_set_uj_2exp (mpfr_t x, uintmax_t j, intmax_t e, mp_rnd_t rnd)
* _ |x| < 2^(emin-2), or
* _ |x| = 2^(emin-2) and the absolute value of the exact
* result is <= 2^(emin-2). */
- if (rnd == GMP_RNDN && (e+1 < __gmpfr_emin || mpfr_powerof2_raw(y)))
- rnd = GMP_RNDZ;
+ if (rnd == MPFR_RNDN && (e+1 < __gmpfr_emin || mpfr_powerof2_raw(y)))
+ rnd = MPFR_RNDZ;
return mpfr_underflow (x, rnd, MPFR_SIGN_POS);
}
if (MPFR_UNLIKELY(e > __gmpfr_emax))
diff --git a/set_z.c b/set_z.c
index 7bbdb9ebc..90158941a 100644
--- a/set_z.c
+++ b/set_z.c
@@ -64,7 +64,7 @@ mpfr_set_z (mpfr_ptr f, mpz_srcptr z, mp_rnd_t rnd_mode)
if (MPFR_UNLIKELY (exp > __gmpfr_emax))
return mpfr_overflow (f, rnd_mode, sign_z);
if (MPFR_UNLIKELY (exp + 1 < __gmpfr_emin))
- return mpfr_underflow (f, rnd_mode == GMP_RNDN ? GMP_RNDZ : rnd_mode,
+ return mpfr_underflow (f, rnd_mode == MPFR_RNDN ? MPFR_RNDZ : rnd_mode,
sign_z);
if (MPFR_LIKELY (dif >= 0))
@@ -118,7 +118,7 @@ mpfr_set_z (mpfr_ptr f, mpz_srcptr z, mp_rnd_t rnd_mode)
}
/* Rounding */
- if (MPFR_LIKELY (rnd_mode == GMP_RNDN))
+ if (MPFR_LIKELY (rnd_mode == MPFR_RNDN))
{
if (rb == 0 || MPFR_UNLIKELY (sb == 0 && (fp[0] & ulp) == 0))
goto trunc;
@@ -164,8 +164,8 @@ mpfr_set_z (mpfr_ptr f, mpz_srcptr z, mp_rnd_t rnd_mode)
if (MPFR_UNLIKELY (exp < __gmpfr_emin))
{
- if (rnd_mode == GMP_RNDN && inex == 0 && mpfr_powerof2_raw (f))
- rnd_mode = GMP_RNDZ;
+ if (rnd_mode == MPFR_RNDN && inex == 0 && mpfr_powerof2_raw (f))
+ rnd_mode = MPFR_RNDZ;
return mpfr_underflow (f, rnd_mode, sign_z);
}
diff --git a/sin.c b/sin.c
index 1b39386b0..d048a62d6 100644
--- a/sin.c
+++ b/sin.c
@@ -80,20 +80,20 @@ mpfr_sin (mpfr_ptr y, mpfr_srcptr x, mp_rnd_t rnd_mode)
reduce = 1;
mpfr_set_prec (c, expx + m - 1);
mpfr_set_prec (xr, m);
- mpfr_const_pi (c, GMP_RNDN);
- mpfr_mul_2ui (c, c, 1, GMP_RNDN);
- mpfr_remainder (xr, x, c, GMP_RNDN);
+ mpfr_const_pi (c, MPFR_RNDN);
+ mpfr_mul_2ui (c, c, 1, MPFR_RNDN);
+ mpfr_remainder (xr, x, c, MPFR_RNDN);
/* The analysis is similar to that of cos.c:
|xr - x - 2kPi| <= 2^(2-m). Thus we can decide the sign
of sin(x) if xr is at distance at least 2^(2-m) of both
0 and +/-Pi. */
- mpfr_div_2ui (c, c, 1, GMP_RNDN);
+ mpfr_div_2ui (c, c, 1, MPFR_RNDN);
/* Since c approximates Pi with an error <= 2^(2-expx-m) <= 2^(-m),
it suffices to check that c - |xr| >= 2^(2-m). */
if (MPFR_SIGN (xr) > 0)
- mpfr_sub (c, c, xr, GMP_RNDZ);
+ mpfr_sub (c, c, xr, MPFR_RNDZ);
else
- mpfr_add (c, c, xr, GMP_RNDZ);
+ mpfr_add (c, c, xr, MPFR_RNDZ);
if (MPFR_IS_ZERO(xr) || MPFR_EXP(xr) < (mp_exp_t) 3 - (mp_exp_t) m
|| MPFR_EXP(c) < (mp_exp_t) 3 - (mp_exp_t) m)
goto ziv_next;
@@ -110,11 +110,11 @@ mpfr_sin (mpfr_ptr y, mpfr_srcptr x, mp_rnd_t rnd_mode)
sign = MPFR_SIGN(xx);
/* now that the argument is reduced, precision m is enough */
mpfr_set_prec (c, m);
- mpfr_cos (c, xx, GMP_RNDZ); /* can't be exact */
+ mpfr_cos (c, xx, MPFR_RNDZ); /* can't be exact */
mpfr_nexttoinf (c); /* now c = cos(x) rounded away */
- mpfr_mul (c, c, c, GMP_RNDU); /* away */
- mpfr_ui_sub (c, 1, c, GMP_RNDZ);
- mpfr_sqrt (c, c, GMP_RNDZ);
+ mpfr_mul (c, c, c, MPFR_RNDU); /* away */
+ mpfr_ui_sub (c, 1, c, MPFR_RNDZ);
+ mpfr_sqrt (c, c, MPFR_RNDZ);
if (MPFR_IS_NEG_SIGN(sign))
MPFR_CHANGE_SIGN(c);
diff --git a/sin_cos.c b/sin_cos.c
index 1feb73d74..c58d9bd71 100644
--- a/sin_cos.c
+++ b/sin_cos.c
@@ -130,14 +130,14 @@ mpfr_sin_cos (mpfr_ptr y, mpfr_ptr z, mpfr_srcptr x, mp_rnd_t rnd_mode)
reduce = 1;
mpfr_set_prec (c, expx + m - 1);
mpfr_set_prec (xr, m);
- mpfr_const_pi (c, GMP_RNDN);
- mpfr_mul_2ui (c, c, 1, GMP_RNDN);
- mpfr_remainder (xr, x, c, GMP_RNDN);
- mpfr_div_2ui (c, c, 1, GMP_RNDN);
+ mpfr_const_pi (c, MPFR_RNDN);
+ mpfr_mul_2ui (c, c, 1, MPFR_RNDN);
+ mpfr_remainder (xr, x, c, MPFR_RNDN);
+ mpfr_div_2ui (c, c, 1, MPFR_RNDN);
if (MPFR_SIGN (xr) > 0)
- mpfr_sub (c, c, xr, GMP_RNDZ);
+ mpfr_sub (c, c, xr, MPFR_RNDZ);
else
- mpfr_add (c, c, xr, GMP_RNDZ);
+ mpfr_add (c, c, xr, MPFR_RNDZ);
if (MPFR_IS_ZERO(xr) || MPFR_EXP(xr) < (mp_exp_t) 3 - (mp_exp_t) m
|| MPFR_EXP(c) < (mp_exp_t) 3 - (mp_exp_t) m)
goto next_step;
@@ -151,7 +151,7 @@ mpfr_sin_cos (mpfr_ptr y, mpfr_ptr z, mpfr_srcptr x, mp_rnd_t rnd_mode)
neg = MPFR_IS_NEG (xx); /* gives sign of sin(x) */
mpfr_set_prec (c, m);
- mpfr_cos (c, xx, GMP_RNDZ);
+ mpfr_cos (c, xx, MPFR_RNDZ);
/* If no argument reduction was performed, the error is at most ulp(c),
otherwise it is at most ulp(c) + 2^(2-m). Since |c| < 1, we have
ulp(c) <= 2^(-m), thus the error is bounded by 2^(3-m) in that later
@@ -160,18 +160,18 @@ mpfr_sin_cos (mpfr_ptr y, mpfr_ptr z, mpfr_srcptr x, mp_rnd_t rnd_mode)
err = m;
else
err = MPFR_GET_EXP (c) + (mp_exp_t) (m - 3);
- if (!mpfr_can_round (c, err, GMP_RNDN, rnd_mode,
- MPFR_PREC (z) + (rnd_mode == GMP_RNDN)))
+ if (!mpfr_can_round (c, err, MPFR_RNDN, rnd_mode,
+ MPFR_PREC (z) + (rnd_mode == MPFR_RNDN)))
goto next_step;
/* we can't set z now, because in case z = x, and the mpfr_can_round()
call below fails, we will have clobbered the input */
mpfr_set_prec (xr, MPFR_PREC(c));
mpfr_swap (xr, c); /* save the approximation of the cosine in xr */
- mpfr_sqr (c, xr, GMP_RNDU);
- mpfr_ui_sub (c, 1, c, GMP_RNDN);
+ mpfr_sqr (c, xr, MPFR_RNDU);
+ mpfr_ui_sub (c, 1, c, MPFR_RNDN);
err = 2 + (- MPFR_GET_EXP (c)) / 2;
- mpfr_sqrt (c, c, GMP_RNDN);
+ mpfr_sqrt (c, c, MPFR_RNDN);
if (neg)
MPFR_CHANGE_SIGN (c);
@@ -180,8 +180,8 @@ mpfr_sin_cos (mpfr_ptr y, mpfr_ptr z, mpfr_srcptr x, mp_rnd_t rnd_mode)
we need to add 2^(2-m); since err >= 2, the error is bounded by
2^(err+1-m) in that case. */
err = MPFR_GET_EXP (c) + (mp_exp_t) m - (err + reduce);
- if (mpfr_can_round (c, err, GMP_RNDN, rnd_mode,
- MPFR_PREC (y) + (rnd_mode == GMP_RNDN)))
+ if (mpfr_can_round (c, err, MPFR_RNDN, rnd_mode,
+ MPFR_PREC (y) + (rnd_mode == MPFR_RNDN)))
break;
/* check for huge cancellation */
if (err < (mp_exp_t) MPFR_PREC (y))
diff --git a/sinh.c b/sinh.c
index e69f41efd..021f4a602 100644
--- a/sinh.c
+++ b/sinh.c
@@ -92,15 +92,15 @@ mpfr_sinh (mpfr_ptr y, mpfr_srcptr xt, mp_rnd_t rnd_mode)
MPFR_BLOCK_DECL (flags);
/* compute sinh */
- MPFR_BLOCK (flags, mpfr_exp (t, x, GMP_RNDD));
+ MPFR_BLOCK (flags, mpfr_exp (t, x, MPFR_RNDD));
if (MPFR_OVERFLOW (flags))
/* exp(x) does overflow */
{
/* sinh(x) = 2 * sinh(x/2) * cosh(x/2) */
- mpfr_div_2ui (ti, x, 1, GMP_RNDD); /* exact */
+ mpfr_div_2ui (ti, x, 1, MPFR_RNDD); /* exact */
/* t <- cosh(x/2): error(t) <= 1 ulp(t) */
- MPFR_BLOCK (flags, mpfr_cosh (t, ti, GMP_RNDD));
+ MPFR_BLOCK (flags, mpfr_cosh (t, ti, MPFR_RNDD));
if (MPFR_OVERFLOW (flags))
/* when x>1 we have |sinh(x)| >= cosh(x/2), so sinh(x)
overflows too */
@@ -112,10 +112,10 @@ mpfr_sinh (mpfr_ptr y, mpfr_srcptr xt, mp_rnd_t rnd_mode)
/* ti <- sinh(x/2): , error(ti) <= 1 ulp(ti)
cannot overflow because 0 < sinh(x) < cosh(x) when x > 0 */
- mpfr_sinh (ti, ti, GMP_RNDD);
+ mpfr_sinh (ti, ti, MPFR_RNDD);
/* multiplication below, error(t) <= 5 ulp(t) */
- MPFR_BLOCK (flags, mpfr_mul (t, t, ti, GMP_RNDD));
+ MPFR_BLOCK (flags, mpfr_mul (t, t, ti, MPFR_RNDD));
if (MPFR_OVERFLOW (flags))
{
inexact = mpfr_overflow (y, rnd_mode, MPFR_SIGN (xt));
@@ -124,7 +124,7 @@ mpfr_sinh (mpfr_ptr y, mpfr_srcptr xt, mp_rnd_t rnd_mode)
}
/* doubling below, exact */
- MPFR_BLOCK (flags, mpfr_mul_2ui (t, t, 1, GMP_RNDN));
+ MPFR_BLOCK (flags, mpfr_mul_2ui (t, t, 1, MPFR_RNDN));
if (MPFR_OVERFLOW (flags))
{
inexact = mpfr_overflow (y, rnd_mode, MPFR_SIGN (xt));
@@ -145,9 +145,9 @@ mpfr_sinh (mpfr_ptr y, mpfr_srcptr xt, mp_rnd_t rnd_mode)
else
{
d = MPFR_GET_EXP (t);
- mpfr_ui_div (ti, 1, t, GMP_RNDU); /* 1/exp(x) */
- mpfr_sub (t, t, ti, GMP_RNDN); /* exp(x) - 1/exp(x) */
- mpfr_div_2ui (t, t, 1, GMP_RNDN); /* 1/2(exp(x) - 1/exp(x)) */
+ mpfr_ui_div (ti, 1, t, MPFR_RNDU); /* 1/exp(x) */
+ mpfr_sub (t, t, ti, MPFR_RNDN); /* exp(x) - 1/exp(x) */
+ mpfr_div_2ui (t, t, 1, MPFR_RNDN); /* 1/2(exp(x) - 1/exp(x)) */
/* it may be that t is zero (in fact, it can only occur when te=1,
and thus ti=1 too) */
diff --git a/sinh_cosh.c b/sinh_cosh.c
index d2ab1c687..559dd35ae 100644
--- a/sinh_cosh.c
+++ b/sinh_cosh.c
@@ -97,7 +97,7 @@ mpfr_sinh_cosh (mpfr_ptr sh, mpfr_ptr ch, mpfr_srcptr xt, mp_rnd_t rnd_mode)
MPFR_BLOCK_DECL (flags);
/* compute sinh_cosh */
- MPFR_BLOCK (flags, mpfr_exp (s, x, GMP_RNDD));
+ MPFR_BLOCK (flags, mpfr_exp (s, x, MPFR_RNDD));
if (MPFR_OVERFLOW (flags))
/* exp(x) does overflow */
{
@@ -109,11 +109,11 @@ mpfr_sinh_cosh (mpfr_ptr sh, mpfr_ptr ch, mpfr_srcptr xt, mp_rnd_t rnd_mode)
break;
}
d = MPFR_GET_EXP (s);
- mpfr_ui_div (ti, 1, s, GMP_RNDU); /* 1/exp(x) */
- mpfr_add (c, s, ti, GMP_RNDU); /* exp(x) + 1/exp(x) */
- mpfr_sub (s, s, ti, GMP_RNDN); /* exp(x) - 1/exp(x) */
- mpfr_div_2ui (c, c, 1, GMP_RNDN); /* 1/2(exp(x) + 1/exp(x)) */
- mpfr_div_2ui (s, s, 1, GMP_RNDN); /* 1/2(exp(x) - 1/exp(x)) */
+ mpfr_ui_div (ti, 1, s, MPFR_RNDU); /* 1/exp(x) */
+ mpfr_add (c, s, ti, MPFR_RNDU); /* exp(x) + 1/exp(x) */
+ mpfr_sub (s, s, ti, MPFR_RNDN); /* exp(x) - 1/exp(x) */
+ mpfr_div_2ui (c, c, 1, MPFR_RNDN); /* 1/2(exp(x) + 1/exp(x)) */
+ mpfr_div_2ui (s, s, 1, MPFR_RNDN); /* 1/2(exp(x) - 1/exp(x)) */
/* it may be that s is zero (in fact, it can only occur when exp(x)=1,
and thus ti=1 too) */
diff --git a/speed.c b/speed.c
index 5597e8a22..2864c182e 100644
--- a/speed.c
+++ b/speed.c
@@ -71,7 +71,7 @@ int verbose;
speed_starttime (); \
i = s->reps; \
do \
- mean_fun (w, x, GMP_RNDN); \
+ mean_fun (w, x, MPFR_RNDN); \
while (--i != 0); \
t = speed_endtime (); \
\
@@ -109,7 +109,7 @@ int verbose;
speed_starttime (); \
i = s->reps; \
do \
- mean_fun (w, x, y, GMP_RNDN); \
+ mean_fun (w, x, y, MPFR_RNDN); \
while (--i != 0); \
t = speed_endtime (); \
\
diff --git a/sqr.c b/sqr.c
index 97a3976ce..2a5a46c1f 100644
--- a/sqr.c
+++ b/sqr.c
@@ -96,9 +96,9 @@ mpfr_sqr (mpfr_ptr a, mpfr_srcptr b, mp_rnd_t rnd_mode)
result (i.e. before rounding, i.e. without taking cc into account)
is < __gmpfr_emin - 1 or the exact result is a power of 2 (i.e. if
both arguments are powers of 2), then round to zero. */
- if (rnd_mode == GMP_RNDN &&
+ if (rnd_mode == MPFR_RNDN &&
(ax + (mp_exp_t) b1 < __gmpfr_emin || mpfr_powerof2_raw (b)))
- rnd_mode = GMP_RNDZ;
+ rnd_mode = MPFR_RNDZ;
return mpfr_underflow (a, rnd_mode, MPFR_SIGN_POS);
}
MPFR_SET_EXP (a, ax2);
diff --git a/sqrt.c b/sqrt.c
index f61fd15b5..aa4a31fec 100644
--- a/sqrt.c
+++ b/sqrt.c
@@ -143,12 +143,12 @@ mpfr_sqrt (mpfr_ptr r, mpfr_srcptr u, mp_rnd_t rnd_mode)
expr = (MPFR_GET_EXP(u) + odd_exp) / 2; /* exact */
- if (rnd_mode == GMP_RNDZ || rnd_mode == GMP_RNDD || sticky == MPFR_LIMB_ZERO)
+ if (rnd_mode == MPFR_RNDZ || rnd_mode == MPFR_RNDD || sticky == MPFR_LIMB_ZERO)
{
inexact = (sticky == MPFR_LIMB_ZERO) ? 0 : -1;
goto truncate;
}
- else if (rnd_mode == GMP_RNDN)
+ else if (rnd_mode == MPFR_RNDN)
{
/* if sh>0, the round bit is bit (sh-1) of sticky1
and the sticky bit is formed by the low sh-1 bits from
diff --git a/strtofr.c b/strtofr.c
index 577a67d53..610fdce6c 100644
--- a/strtofr.c
+++ b/strtofr.c
@@ -127,16 +127,16 @@ int main ()
for (base = 2 ; base < 63 ; base ++)
{
- mpfr_set_ui (x, base, GMP_RNDN);
- mpfr_log2 (x, x, GMP_RNDN);
- mpfr_ui_div (x, 1, x, GMP_RNDN);
+ mpfr_set_ui (x, base, MPFR_RNDN);
+ mpfr_log2 (x, x, MPFR_RNDN);
+ mpfr_ui_div (x, 1, x, MPFR_RNDN);
printf ("Base: %d x=%e ", base, mpfr_get_d1 (x));
for (i = 0 ; i < N ; i++)
{
mpfr_floor (y, x);
- tab[i] = mpfr_get_ui (y, GMP_RNDN);
- mpfr_sub (x, x, y, GMP_RNDN);
- mpfr_ui_div (x, 1, x, GMP_RNDN);
+ tab[i] = mpfr_get_ui (y, MPFR_RNDN);
+ mpfr_sub (x, x, y, MPFR_RNDN);
+ mpfr_ui_div (x, 1, x, MPFR_RNDN);
}
for (i = N-1 ; i >= 0 ; i--)
if (tab[i] != 0)
@@ -719,7 +719,7 @@ parsed_string_to_mpfr (mpfr_t x, struct parsed_string *pstr, mp_rnd_t rnd)
if (exact || mpfr_can_round_raw (result, ysize,
(pstr->negative) ? -1 : 1,
ysize_bits - err - 1,
- GMP_RNDN, rnd, MPFR_PREC(x)))
+ MPFR_RNDN, rnd, MPFR_PREC(x)))
break;
/* update the prec for next loop */
@@ -760,8 +760,8 @@ parsed_string_to_mpfr (mpfr_t x, struct parsed_string *pstr, mp_rnd_t rnd)
underflow:
/* This is called when there is a huge overflow
(Real expo < MPFR_EXP_MIN << __gmpfr_emin */
- if (rnd == GMP_RNDN)
- rnd = GMP_RNDZ;
+ if (rnd == MPFR_RNDN)
+ rnd = MPFR_RNDZ;
res = mpfr_underflow (x, rnd, (pstr->negative) ? -1 : 1);
goto end;
@@ -812,8 +812,8 @@ mpfr_strtofr (mpfr_t x, const char *string, char **end, int base,
{
/* This is called when there is a huge overflow
(Real expo < MPFR_EXP_MIN << __gmpfr_emin */
- if (rnd == GMP_RNDN)
- rnd = GMP_RNDZ;
+ if (rnd == MPFR_RNDN)
+ rnd = MPFR_RNDZ;
res = mpfr_underflow (x, rnd, (pstr.negative) ? -1 : 1);
}
#endif
diff --git a/sub.c b/sub.c
index 31c387863..07c12dd62 100644
--- a/sub.c
+++ b/sub.c
@@ -59,7 +59,7 @@ mpfr_sub (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mp_rnd_t rnd_mode)
{
if (MPFR_IS_ZERO (c))
{
- int sign = rnd_mode != GMP_RNDD
+ int sign = rnd_mode != MPFR_RNDD
? ((MPFR_IS_NEG(b) && MPFR_IS_POS(c)) ? -1 : 1)
: ((MPFR_IS_POS(b) && MPFR_IS_NEG(c)) ? 1 : -1);
MPFR_SET_SIGN (a, sign);
diff --git a/sub1.c b/sub1.c
index 7c1695f41..7859751c4 100644
--- a/sub1.c
+++ b/sub1.c
@@ -48,7 +48,7 @@ mpfr_sub1 (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mp_rnd_t rnd_mode)
sign = mpfr_cmp2 (b, c, &cancel);
if (MPFR_UNLIKELY(sign == 0))
{
- if (rnd_mode == GMP_RNDD)
+ if (rnd_mode == MPFR_RNDD)
MPFR_SET_NEG (a);
else
MPFR_SET_POS (a);
@@ -82,7 +82,7 @@ mpfr_sub1 (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mp_rnd_t rnd_mode)
/* Check if c is too small.
A more precise test is to replace 2 by
- (rnd == GMP_RNDN) + mpfr_power2_raw (b)
+ (rnd == MPFR_RNDN) + mpfr_power2_raw (b)
but it is more expensive and not very useful */
if (MPFR_UNLIKELY (MPFR_GET_EXP (c) <= MPFR_GET_EXP (b)
- (mp_exp_t) MAX (MPFR_PREC (a), MPFR_PREC (b)) - 2))
@@ -303,7 +303,7 @@ mpfr_sub1 (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mp_rnd_t rnd_mode)
carry = ap[0] & MPFR_LIMB_MASK (sh);
ap[0] -= carry;
- if (MPFR_LIKELY(rnd_mode == GMP_RNDN))
+ if (MPFR_LIKELY(rnd_mode == MPFR_RNDN))
{
if (MPFR_LIKELY(sh))
{
@@ -323,11 +323,11 @@ mpfr_sub1 (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mp_rnd_t rnd_mode)
else /* directed rounding: set rnd_mode to RNDZ iff towards zero */
{
if (MPFR_IS_RNDUTEST_OR_RNDDNOTTEST(rnd_mode, MPFR_IS_NEG(a)))
- rnd_mode = GMP_RNDZ;
+ rnd_mode = MPFR_RNDZ;
if (carry)
{
- if (rnd_mode == GMP_RNDZ)
+ if (rnd_mode == MPFR_RNDZ)
{
inexact = -1;
goto truncate;
@@ -363,7 +363,7 @@ mpfr_sub1 (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mp_rnd_t rnd_mode)
/* the case rounding to nearest with sh=0 is special since one couldn't
subtract above 1/2 ulp in the trailing limb of the result */
- if ((rnd_mode == GMP_RNDN) && sh == 0 && k == 0)
+ if ((rnd_mode == MPFR_RNDN) && sh == 0 && k == 0)
{
mp_limb_t half = MPFR_LIMB_HIGHBIT;
@@ -396,9 +396,9 @@ mpfr_sub1 (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mp_rnd_t rnd_mode)
#endif
if (bb < cc)
{
- if (rnd_mode == GMP_RNDZ)
+ if (rnd_mode == MPFR_RNDZ)
goto sub_one_ulp;
- else if (rnd_mode != GMP_RNDN) /* round away */
+ else if (rnd_mode != MPFR_RNDN) /* round away */
{
inexact = 1;
goto truncate;
@@ -428,12 +428,12 @@ mpfr_sub1 (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mp_rnd_t rnd_mode)
}
else if (bb > cc)
{
- if (rnd_mode == GMP_RNDZ)
+ if (rnd_mode == MPFR_RNDZ)
{
inexact = -1;
goto truncate;
}
- else if (rnd_mode != GMP_RNDN) /* round away */
+ else if (rnd_mode != MPFR_RNDN) /* round away */
goto add_one_ulp;
else /* round to nearest */
{
@@ -453,7 +453,7 @@ mpfr_sub1 (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mp_rnd_t rnd_mode)
}
}
- if ((rnd_mode == GMP_RNDN) && !is_exact)
+ if ((rnd_mode == MPFR_RNDN) && !is_exact)
{
/* even rounding rule */
if ((ap[0] >> sh) & 1)
@@ -505,10 +505,10 @@ mpfr_sub1 (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mp_rnd_t rnd_mode)
if (MPFR_UNLIKELY(exp_a < __gmpfr_emin))
{
MPFR_TMP_FREE(marker);
- if (rnd_mode == GMP_RNDN &&
+ if (rnd_mode == MPFR_RNDN &&
(exp_a < __gmpfr_emin - 1 ||
(inexact >= 0 && mpfr_powerof2_raw (a))))
- rnd_mode = GMP_RNDZ;
+ rnd_mode = MPFR_RNDZ;
return mpfr_underflow (a, rnd_mode, MPFR_SIGN(a));
}
MPFR_SET_EXP (a, exp_a);
diff --git a/sub1sp.c b/sub1sp.c
index 8a54ab31a..69aef6b30 100644
--- a/sub1sp.c
+++ b/sub1sp.c
@@ -38,10 +38,10 @@ int mpfr_sub1sp (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mp_rnd_t rnd_mode)
mpfr_init2 (tmpb, MPFR_PREC (b));
mpfr_init2 (tmpc, MPFR_PREC (c));
- inexb = mpfr_set (tmpb, b, GMP_RNDN);
+ inexb = mpfr_set (tmpb, b, MPFR_RNDN);
MPFR_ASSERTN (inexb == 0);
- inexc = mpfr_set (tmpc, c, GMP_RNDN);
+ inexc = mpfr_set (tmpc, c, MPFR_RNDN);
MPFR_ASSERTN (inexc == 0);
inexact2 = mpfr_sub1 (tmpa, tmpb, tmpc, rnd_mode);
@@ -98,17 +98,17 @@ int mpfr_sub1sp (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mp_rnd_t rnd_mode)
*
* Can't have Cp=-1 and C'p+1=1*/
-/* RND = GMP_RNDZ:
+/* RND = MPFR_RNDZ:
* + if Cp=0 and C'p+1=0,1, Truncate.
* + if Cp=0 and C'p+1=-1, SubOneUlp
* + if Cp=-1, SubOneUlp
* + if Cp=1, AddOneUlp
- * RND = GMP_RNDA (Away)
+ * RND = MPFR_RNDA (Away)
* + if Cp=0 and C'p+1=0,-1, Truncate
* + if Cp=0 and C'p+1=1, AddOneUlp
* + if Cp=1, AddOneUlp
* + if Cp=-1, Truncate
- * RND = GMP_RNDN
+ * RND = MPFR_RNDN
* + if Cp=0, Truncate
* + if Cp=1 and C'p+1=1, AddOneUlp
* + if Cp=1 and C'p+1=-1, Truncate
@@ -172,7 +172,7 @@ mpfr_sub1sp (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mp_rnd_t rnd_mode)
/* b == c ! */
{
/* Return exact number 0 */
- if (rnd_mode == GMP_RNDD)
+ if (rnd_mode == MPFR_RNDD)
MPFR_SET_NEG(a);
else
MPFR_SET_POS(a);
@@ -268,10 +268,10 @@ mpfr_sub1sp (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mp_rnd_t rnd_mode)
MPFR_TMP_FREE(marker);
/* inexact=0 */
DEBUG( printf("(D==0 Underflow)\n") );
- if (rnd_mode == GMP_RNDN &&
+ if (rnd_mode == MPFR_RNDN &&
(bx < __gmpfr_emin - 1 ||
(/*inexact >= 0 &&*/ mpfr_powerof2_raw (a))))
- rnd_mode = GMP_RNDZ;
+ rnd_mode = MPFR_RNDZ;
return mpfr_underflow (a, rnd_mode, MPFR_SIGN(a));
}
MPFR_SET_EXP (a, bx);
@@ -324,7 +324,7 @@ mpfr_sub1sp (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mp_rnd_t rnd_mode)
/* Rounding is necessary since c0 = 1*/
/* Cp =-1 and C'p+1=0 */
bcp = 1; bcp1 = 0;
- if (MPFR_LIKELY(rnd_mode == GMP_RNDN))
+ if (MPFR_LIKELY(rnd_mode == MPFR_RNDN))
{
/* Even Rule apply: Check Ap-1 */
if (MPFR_LIKELY( (ap[0] & (MPFR_LIMB_ONE<<sh)) == 0) )
@@ -333,7 +333,7 @@ mpfr_sub1sp (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mp_rnd_t rnd_mode)
goto sub_one_ulp;
}
MPFR_UPDATE_RND_MODE(rnd_mode, MPFR_IS_NEG(a));
- if (rnd_mode == GMP_RNDZ)
+ if (rnd_mode == MPFR_RNDZ)
goto sub_one_ulp;
else
goto truncate;
@@ -428,7 +428,7 @@ mpfr_sub1sp (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mp_rnd_t rnd_mode)
bp = MPFR_MANT (b);
/* Even if src and dest overlap, it is ok using MPN_COPY */
- if (MPFR_LIKELY(rnd_mode == GMP_RNDN))
+ if (MPFR_LIKELY(rnd_mode == MPFR_RNDN))
{
if (MPFR_UNLIKELY( bcp && bcp1==0 ))
/* Cp=-1 and C'p+1=0: Even rule Apply! */
@@ -442,7 +442,7 @@ mpfr_sub1sp (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mp_rnd_t rnd_mode)
goto sub_one_ulp;
}
MPFR_UPDATE_RND_MODE(rnd_mode, MPFR_IS_NEG(a));
- if (rnd_mode == GMP_RNDZ)
+ if (rnd_mode == MPFR_RNDZ)
{
MPN_COPY(ap, bp, n);
goto sub_one_ulp;
@@ -460,7 +460,7 @@ mpfr_sub1sp (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mp_rnd_t rnd_mode)
DEBUG( printf("(D>P) Cp=%d Cp+1=%d C'p+1=%d\n", bcp!=0,bbcp!=0,bcp1!=0) );
/* Need to compute C'p+2 if d==p+1 and if rnd_mode=NEAREST
(Because of a very improbable case) */
- if (MPFR_UNLIKELY(d==p+1 && rnd_mode==GMP_RNDN))
+ if (MPFR_UNLIKELY(d==p+1 && rnd_mode==MPFR_RNDN))
{
cp = MPFR_MANT(c);
if (MPFR_UNLIKELY(cp[n-1] == MPFR_LIMB_HIGHBIT))
@@ -478,10 +478,10 @@ mpfr_sub1sp (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mp_rnd_t rnd_mode)
/* Copy mantissa B in A */
MPN_COPY(ap, MPFR_MANT(b), n);
/* Round */
- if (MPFR_LIKELY(rnd_mode == GMP_RNDN))
+ if (MPFR_LIKELY(rnd_mode == MPFR_RNDN))
goto truncate;
MPFR_UPDATE_RND_MODE(rnd_mode, MPFR_IS_NEG(a));
- if (rnd_mode == GMP_RNDZ)
+ if (rnd_mode == MPFR_RNDZ)
goto sub_one_ulp;
else /* rnd_mode = AWAY */
goto truncate;
@@ -665,7 +665,7 @@ mpfr_sub1sp (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mp_rnd_t rnd_mode)
MPFR_ASSERTD( !(ap[0] & ~mask) );
/* Rounding */
- if (MPFR_LIKELY(rnd_mode == GMP_RNDN))
+ if (MPFR_LIKELY(rnd_mode == MPFR_RNDN))
{
if (MPFR_LIKELY(bcp==0))
goto truncate;
@@ -677,7 +677,7 @@ mpfr_sub1sp (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mp_rnd_t rnd_mode)
/* Update rounding mode */
MPFR_UPDATE_RND_MODE(rnd_mode, MPFR_IS_NEG(a));
- if (rnd_mode == GMP_RNDZ && (MPFR_LIKELY(bcp || bcp1)))
+ if (rnd_mode == MPFR_RNDZ && (MPFR_LIKELY(bcp || bcp1)))
goto sub_one_ulp;
goto truncate;
}
@@ -704,19 +704,19 @@ mpfr_sub1sp (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mp_rnd_t rnd_mode)
/* Compute the last bit (Since we have shifted the mantissa)
we need one more bit!*/
MPFR_ASSERTN(bbcp != (mp_limb_t) -1);
- if ( (rnd_mode == GMP_RNDZ && bcp==0)
- || (rnd_mode==GMP_RNDN && bbcp==0)
+ if ( (rnd_mode == MPFR_RNDZ && bcp==0)
+ || (rnd_mode==MPFR_RNDN && bbcp==0)
|| (bcp && bcp1==0) ) /*Exact result*/
{
ap[0] |= MPFR_LIMB_ONE<<sh;
- if (rnd_mode == GMP_RNDN)
+ if (rnd_mode == MPFR_RNDN)
inexact = 1;
DEBUG( printf("(SubOneUlp) Last bit set\n") );
}
/* Result could be exact if C'p+1 = 0 and rnd == Zero
since we have had one more bit to the result */
- /* Fixme: rnd_mode == GMP_RNDZ needed ? */
- if (bcp1==0 && rnd_mode==GMP_RNDZ)
+ /* Fixme: rnd_mode == MPFR_RNDZ needed ? */
+ if (bcp1==0 && rnd_mode==MPFR_RNDZ)
{
DEBUG( printf("(SubOneUlp) Exact result\n") );
inexact = 0;
@@ -754,10 +754,10 @@ mpfr_sub1sp (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mp_rnd_t rnd_mode)
DEBUG( printf("(Truncate) Cp=%d, Cp+1=%d C'p+1=%d C'p+2=%d\n", \
bcp!=0, bbcp!=0, bcp1!=0, bbcp1!=0) );
MPFR_ASSERTN(bbcp != (mp_limb_t) -1);
- MPFR_ASSERTN((rnd_mode != GMP_RNDN) || (bcp != 0) || (bbcp == 0) || (bbcp1 != (mp_limb_t) -1));
- if (((rnd_mode != GMP_RNDZ) && bcp)
+ MPFR_ASSERTN((rnd_mode != MPFR_RNDN) || (bcp != 0) || (bbcp == 0) || (bbcp1 != (mp_limb_t) -1));
+ if (((rnd_mode != MPFR_RNDZ) && bcp)
||
- ((rnd_mode == GMP_RNDN) && (bcp == 0) && (bbcp) && (bbcp1)))
+ ((rnd_mode == MPFR_RNDN) && (bcp == 0) && (bbcp) && (bbcp1)))
{
DEBUG( printf("(Truncate) Do sub\n") );
mpn_sub_1 (ap, ap, n, MPFR_LIMB_ONE << sh);
@@ -765,7 +765,7 @@ mpfr_sub1sp (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mp_rnd_t rnd_mode)
ap[0] |= MPFR_LIMB_ONE<<sh;
bx--;
/* FIXME: Explain why it works (or why not)... */
- inexact = (bcp1 == 0) ? 0 : (rnd_mode==GMP_RNDN) ? -1 : 1;
+ inexact = (bcp1 == 0) ? 0 : (rnd_mode==MPFR_RNDN) ? -1 : 1;
goto end_of_sub;
}
}
@@ -792,10 +792,10 @@ mpfr_sub1sp (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mp_rnd_t rnd_mode)
if (MPFR_UNLIKELY(bx < __gmpfr_emin))
{
DEBUG( printf("(Final Underflow)\n") );
- if (rnd_mode == GMP_RNDN &&
+ if (rnd_mode == MPFR_RNDN &&
(bx < __gmpfr_emin - 1 ||
(inexact >= 0 && mpfr_powerof2_raw (a))))
- rnd_mode = GMP_RNDZ;
+ rnd_mode = MPFR_RNDZ;
MPFR_TMP_FREE(marker);
return mpfr_underflow (a, rnd_mode, MPFR_SIGN(a));
}
diff --git a/subnormal.c b/subnormal.c
index 516b905d1..e20b57343 100644
--- a/subnormal.c
+++ b/subnormal.c
@@ -23,7 +23,7 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
#include "mpfr-impl.h"
-/* For GMP_RNDN, we can have a problem of double rounding.
+/* For MPFR_RNDN, we can have a problem of double rounding.
In such a case, this table helps to conclude what to do (y positive):
Rounding Bit | Sticky Bit | inexact | Action | new inexact
0 | ? | ? | Trunc | sticky
@@ -59,7 +59,7 @@ mpfr_subnormalize (mpfr_ptr y, int old_inexact, mp_rnd_t rnd)
Assuming Y is the real value and y the approximation
and since y is not a power of 2: 0.5*2^emin < Y < 1*2^emin
We also know the direction of the error thanks to inexact flag */
- else if (rnd == GMP_RNDN)
+ else if (rnd == MPFR_RNDN)
{
mp_limb_t *mant, rb ,sb;
mp_size_t s;
@@ -120,7 +120,7 @@ mpfr_subnormalize (mpfr_ptr y, int old_inexact, mp_rnd_t rnd)
MPFR_SET_EXP (dest, MPFR_GET_EXP (dest)+1));
if (MPFR_LIKELY (old_inexact != 0))
{
- if (MPFR_UNLIKELY(rnd == GMP_RNDN && (inexact == MPFR_EVEN_INEX
+ if (MPFR_UNLIKELY(rnd == MPFR_RNDN && (inexact == MPFR_EVEN_INEX
|| inexact == -MPFR_EVEN_INEX)))
{
/* if both roundings are in the same direction, we have to go
diff --git a/sum.c b/sum.c
index 67474eec5..58612e3fa 100644
--- a/sum.c
+++ b/sum.c
@@ -221,13 +221,13 @@ sum_once (mpfr_ptr ret, mpfr_srcptr *const tab, unsigned long n, mp_prec_t F)
MPFR_ASSERTD (n >= 2);
mpfr_init2 (sum, F);
- error_trap = mpfr_set (sum, tab[0], GMP_RNDN);
+ error_trap = mpfr_set (sum, tab[0], MPFR_RNDN);
for (i = 1; i < n - 1; i++)
{
MPFR_ASSERTD (!MPFR_IS_NAN (sum) && !MPFR_IS_INF (sum));
- error_trap |= mpfr_add (sum, sum, tab[i], GMP_RNDN);
+ error_trap |= mpfr_add (sum, sum, tab[i], MPFR_RNDN);
}
- error_trap |= mpfr_add (ret, sum, tab[n - 1], GMP_RNDN);
+ error_trap |= mpfr_add (ret, sum, tab[n - 1], MPFR_RNDN);
mpfr_clear (sum);
return error_trap;
}
@@ -293,7 +293,7 @@ mpfr_sum (mpfr_ptr ret, mpfr_ptr *const tab_p, unsigned long n, mp_rnd_t rnd)
(!MPFR_IS_ZERO (cur_sum) &&
mpfr_can_round (cur_sum,
MPFR_GET_EXP (cur_sum) - prec + 2,
- GMP_RNDN, rnd, MPFR_PREC (ret)))))
+ MPFR_RNDN, rnd, MPFR_PREC (ret)))))
break;
MPFR_ZIV_NEXT (loop, prec);
mpfr_set_prec (cur_sum, prec);
diff --git a/tan.c b/tan.c
index 68c2ec560..6a3255896 100644
--- a/tan.c
+++ b/tan.c
@@ -70,8 +70,8 @@ mpfr_tan (mpfr_ptr y, mpfr_srcptr x, mp_rnd_t rnd_mode)
{
/* The only way to get an overflow is to get ~ Pi/2
But the result will be ~ 2^Prec(y). */
- mpfr_sin_cos (s, c, x, GMP_RNDN); /* err <= 1/2 ulp on s and c */
- mpfr_div (c, s, c, GMP_RNDN); /* err <= 4 ulps */
+ mpfr_sin_cos (s, c, x, MPFR_RNDN); /* err <= 1/2 ulp on s and c */
+ mpfr_div (c, s, c, MPFR_RNDN); /* err <= 4 ulps */
MPFR_ASSERTD (!MPFR_IS_SINGULAR (c));
if (MPFR_LIKELY (MPFR_CAN_ROUND (c, m - 2, precy, rnd_mode)))
break;
diff --git a/tanh.c b/tanh.c
index e19ff8560..124574c4c 100644
--- a/tanh.c
+++ b/tanh.c
@@ -102,13 +102,13 @@ mpfr_tanh (mpfr_ptr y, mpfr_srcptr xt , mp_rnd_t rnd_mode)
MPFR_ZIV_INIT (loop, Nt);
for (;;) {
/* tanh = (exp(2x)-1)/(exp(2x)+1) */
- mpfr_mul_2ui (te, x, 1, GMP_RNDN); /* 2x */
+ mpfr_mul_2ui (te, x, 1, MPFR_RNDN); /* 2x */
/* since x > 0, we can only have an overflow */
- mpfr_exp (te, te, GMP_RNDN); /* exp(2x) */
+ mpfr_exp (te, te, MPFR_RNDN); /* exp(2x) */
if (MPFR_UNLIKELY (MPFR_IS_INF (te))) {
set_one:
inexact = MPFR_FROM_SIGN_TO_INT (sign);
- mpfr_set4 (y, __gmpfr_one, GMP_RNDN, sign);
+ mpfr_set4 (y, __gmpfr_one, MPFR_RNDN, sign);
if (MPFR_IS_LIKE_RNDZ (rnd_mode, MPFR_IS_NEG_SIGN (sign)))
{
inexact = -inexact;
@@ -117,10 +117,10 @@ mpfr_tanh (mpfr_ptr y, mpfr_srcptr xt , mp_rnd_t rnd_mode)
break;
}
d = MPFR_GET_EXP (te); /* For Error calculation */
- mpfr_add_ui (t, te, 1, GMP_RNDD); /* exp(2x) + 1*/
- mpfr_sub_ui (te, te, 1, GMP_RNDU); /* exp(2x) - 1*/
+ mpfr_add_ui (t, te, 1, MPFR_RNDD); /* exp(2x) + 1*/
+ mpfr_sub_ui (te, te, 1, MPFR_RNDU); /* exp(2x) - 1*/
d = d - MPFR_GET_EXP (te);
- mpfr_div (t, te, t, GMP_RNDN); /* (exp(2x)-1)/(exp(2x)+1)*/
+ mpfr_div (t, te, t, MPFR_RNDN); /* (exp(2x)-1)/(exp(2x)+1)*/
/* Calculation of the error */
d = MAX(3, d + 1);
diff --git a/tests/mpfr-test.h b/tests/mpfr-test.h
index 2bf24499c..e01804368 100644
--- a/tests/mpfr-test.h
+++ b/tests/mpfr-test.h
@@ -35,13 +35,13 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
#define MAXNORM 1.7976931348623157081e308 /* 2^(1023)*(2-2^(-52)) */
/* Generates a random rounding mode */
-#define RND_RAND() ((mp_rnd_t) (randlimb() % GMP_RND_MAX))
+#define RND_RAND() ((mp_rnd_t) (randlimb() % MPFR_RND_MAX))
/* Generates a random sign */
#define SIGN_RAND() ( (randlimb()%2) ? MPFR_SIGN_POS : MPFR_SIGN_NEG)
/* Loop for all rounding modes */
-#define RND_LOOP(_r) for((_r) = 0 ; (_r) < GMP_RND_MAX ; (_r)++)
+#define RND_LOOP(_r) for((_r) = 0 ; (_r) < MPFR_RND_MAX ; (_r)++)
/* The MAX, MIN and ABS macros may already be defined if gmp-impl.h has
been included. They have the same semantics as in gmp-impl.h, but the
@@ -89,8 +89,8 @@ void bad_cases _MPFR_PROTO ((int (*)(FLIST), int (*)(FLIST),
mp_prec_t, mp_prec_t, mp_prec_t, int));
int mpfr_cmp_str _MPFR_PROTO ((mpfr_srcptr x, const char *, int, mp_rnd_t));
-#define mpfr_cmp_str1(x,s) mpfr_cmp_str(x,s,10,GMP_RNDN)
-#define mpfr_set_str1(x,s) mpfr_set_str(x,s,10,GMP_RNDN)
+#define mpfr_cmp_str1(x,s) mpfr_cmp_str(x,s,10,MPFR_RNDN)
+#define mpfr_set_str1(x,s) mpfr_set_str(x,s,10,MPFR_RNDN)
#define mpfr_cmp0(x,y) (MPFR_ASSERTN (!MPFR_IS_NAN (x) && !MPFR_IS_NAN (y)), mpfr_cmp (x,y))
diff --git a/tests/reuse.c b/tests/reuse.c
index e3bf16465..8b41fb46e 100644
--- a/tests/reuse.c
+++ b/tests/reuse.c
@@ -25,7 +25,7 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
#include "mpfr-test.h"
-#define DISP(s, t) {printf(s); mpfr_out_str(stdout, 2, 0, t, GMP_RNDN); }
+#define DISP(s, t) {printf(s); mpfr_out_str(stdout, 2, 0, t, MPFR_RNDN); }
#define DISP2(s,t) {DISP(s,t); putchar('\n');}
#define SPECIAL_MAX 12
@@ -68,10 +68,10 @@ set_special (mpfr_ptr x, unsigned int select)
mpfr_set_str_binary (x, "1e+1");
break;
case 9:
- mpfr_const_pi (x, GMP_RNDN);
+ mpfr_const_pi (x, MPFR_RNDN);
break;
case 10:
- mpfr_const_pi (x, GMP_RNDN);
+ mpfr_const_pi (x, MPFR_RNDN);
MPFR_SET_EXP (x, MPFR_GET_EXP (x)-1);
break;
default:
@@ -435,7 +435,7 @@ test2a (int (*testfunc)(mpfr_ptr, mpfr_srcptr),
testfunc (ref1, ref2);
/* foo(a, a) */
- mpfr_set (res1, ref2, GMP_RNDN); /* exact operation */
+ mpfr_set (res1, ref2, MPFR_RNDN); /* exact operation */
testfunc (res1, res1);
if (mpfr_compare (res1, ref1))
{
diff --git a/tests/rnd_mode.c b/tests/rnd_mode.c
index 7b30bc55a..178e12226 100644
--- a/tests/rnd_mode.c
+++ b/tests/rnd_mode.c
@@ -32,7 +32,7 @@ mpfr_set_machine_rnd_mode (mp_rnd_t rnd_mode)
{
switch (rnd_mode)
{
- case GMP_RNDN:
+ case MPFR_RNDN:
return
#if defined (MPFR_HAVE_FESETROUND) && defined (FE_TONEAREST)
fesetround(FE_TONEAREST)
@@ -40,7 +40,7 @@ mpfr_set_machine_rnd_mode (mp_rnd_t rnd_mode)
-1
#endif
;
- case GMP_RNDZ:
+ case MPFR_RNDZ:
return
#if defined (MPFR_HAVE_FESETROUND) && defined (FE_TOWARDZERO)
fesetround(FE_TOWARDZERO)
@@ -48,7 +48,7 @@ mpfr_set_machine_rnd_mode (mp_rnd_t rnd_mode)
-1
#endif
;
- case GMP_RNDU:
+ case MPFR_RNDU:
return
#if defined (MPFR_HAVE_FESETROUND) && defined (FE_UPWARD)
fesetround(FE_UPWARD)
@@ -56,7 +56,7 @@ mpfr_set_machine_rnd_mode (mp_rnd_t rnd_mode)
-1
#endif
;
- case GMP_RNDD:
+ case MPFR_RNDD:
return
#if defined (MPFR_HAVE_FESETROUND) && defined (FE_DOWNWARD)
fesetround(FE_DOWNWARD)
diff --git a/tests/tabs.c b/tests/tabs.c
index a36e9d8ef..8af0216fc 100644
--- a/tests/tabs.c
+++ b/tests/tabs.c
@@ -45,11 +45,11 @@ check_inexact (void)
mpfr_urandomb (x, RANDS);
if (randlimb () % 2)
{
- mpfr_set (absx, x, GMP_RNDN);
- mpfr_neg (x, x, GMP_RNDN);
+ mpfr_set (absx, x, MPFR_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN);
}
else
- mpfr_set (absx, x, GMP_RNDN);
+ mpfr_set (absx, x, MPFR_RNDN);
for (q=2; q<2*p; q++)
{
mpfr_set_prec (y, q);
@@ -85,24 +85,24 @@ check_cmp (int argc, char *argv[])
mpfr_inits2 (53, x, y, (mpfr_ptr) 0);
- mpfr_set_ui(x, 1, GMP_RNDN);
- (mpfr_abs) (x, x, GMP_RNDN);
+ mpfr_set_ui(x, 1, MPFR_RNDN);
+ (mpfr_abs) (x, x, MPFR_RNDN);
if (mpfr_cmp_ui (x, 1))
{
printf ("Error in mpfr_abs(1.0)\n");
exit (1);
}
- mpfr_set_si(x, -1, GMP_RNDN);
- mpfr_abs(x, x, GMP_RNDN);
+ mpfr_set_si(x, -1, MPFR_RNDN);
+ mpfr_abs(x, x, MPFR_RNDN);
if (mpfr_cmp_ui (x, 1))
{
printf ("Error in mpfr_abs(1.0)\n");
exit (1);
}
- mpfr_set_si(x, -1, GMP_RNDN);
- mpfr_abs(x, x, GMP_RNDN);
+ mpfr_set_si(x, -1, MPFR_RNDN);
+ mpfr_abs(x, x, MPFR_RNDN);
if (mpfr_cmp_ui (x, 1))
{
printf ("Error in mpfr_abs(-1.0)\n");
@@ -110,14 +110,14 @@ check_cmp (int argc, char *argv[])
}
mpfr_set_inf (x, 1);
- mpfr_abs (x, x, GMP_RNDN);
+ mpfr_abs (x, x, MPFR_RNDN);
if (!mpfr_inf_p(x) || (mpfr_sgn(x) <= 0))
{
printf ("Error in mpfr_abs(Inf).\n");
exit (1);
}
mpfr_set_inf (x, -1);
- mpfr_abs (x, x, GMP_RNDN);
+ mpfr_abs (x, x, MPFR_RNDN);
if (!mpfr_inf_p(x) || (mpfr_sgn(x) <= 0))
{
printf ("Error in mpfr_abs(-Inf).\n");
@@ -125,7 +125,7 @@ check_cmp (int argc, char *argv[])
}
MPFR_SET_NAN(x);
- mpfr_abs (x, x, GMP_RNDN);
+ mpfr_abs (x, x, MPFR_RNDN);
if (!MPFR_IS_NAN(x))
{
printf ("Error in mpfr_abs(NAN).\n");
diff --git a/tests/tacos.c b/tests/tacos.c
index 95f8fd0b1..2eb99e742 100644
--- a/tests/tacos.c
+++ b/tests/tacos.c
@@ -38,7 +38,7 @@ special (void)
mpfr_init2 (y, 32);
mpfr_set_str_binary (x, "0.10001000001001011000100001E-6");
- mpfr_acos (y, x, GMP_RNDN);
+ mpfr_acos (y, x, MPFR_RNDN);
mpfr_set_str_binary (x, "1.10001111111111110001110110001");
if (mpfr_cmp (x, y))
{
@@ -47,7 +47,7 @@ special (void)
}
mpfr_set_str_binary (x, "-0.01101011110111100111010011001011");
- mpfr_acos (y, x, GMP_RNDZ);
+ mpfr_acos (y, x, MPFR_RNDZ);
mpfr_set_str_binary (x, "10.0000000101111000011101000101");
if (mpfr_cmp (x, y))
{
@@ -57,9 +57,9 @@ special (void)
}
mpfr_set_prec (x, 2);
- mpfr_set_ui (x, 0, GMP_RNDN);
- inex1 = mpfr_acos (x, x, GMP_RNDN); /* Pi/2 */
- inex2 = mpfr_const_pi (x, GMP_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ inex1 = mpfr_acos (x, x, MPFR_RNDN); /* Pi/2 */
+ inex2 = mpfr_const_pi (x, MPFR_RNDN);
if (inex1 != inex2)
{
printf ("Error in mpfr_acos (3) for prec=2\n");
@@ -84,9 +84,9 @@ special_overflow (void)
mpfr_init2 (x, 24);
mpfr_init2 (y, 48);
mpfr_set_str_binary (x, "0.101100100000000000110100E0");
- mpfr_acos (y, x, GMP_RNDN);
+ mpfr_acos (y, x, MPFR_RNDN);
if (mpfr_cmp_str (y, "0.110011010100101111000100111010111011010000001001E0",
- 2, GMP_RNDN))
+ 2, MPFR_RNDN))
{
printf("Special Overflow error.\n");
mpfr_dump (y);
@@ -113,23 +113,23 @@ main (void)
mpfr_init (y);
MPFR_SET_NAN(x);
- mpfr_acos (y, x, GMP_RNDN);
+ mpfr_acos (y, x, MPFR_RNDN);
if (mpfr_nan_p(y) == 0)
{
printf ("Error: acos(NaN) != NaN\n");
exit (1);
}
- mpfr_set_ui (x, 2, GMP_RNDN);
- mpfr_acos (y, x, GMP_RNDN);
+ mpfr_set_ui (x, 2, MPFR_RNDN);
+ mpfr_acos (y, x, MPFR_RNDN);
if (mpfr_nan_p(y) == 0)
{
printf ("Error: acos(2) != NaN\n");
exit (1);
}
- mpfr_set_si (x, -2, GMP_RNDN);
- mpfr_acos (y, x, GMP_RNDN);
+ mpfr_set_si (x, -2, MPFR_RNDN);
+ mpfr_acos (y, x, MPFR_RNDN);
if (mpfr_nan_p(y) == 0)
{
printf ("Error: acos(-2) != NaN\n");
@@ -137,8 +137,8 @@ main (void)
}
/* acos (1) = 0 */
- mpfr_set_ui (x, 1, GMP_RNDN);
- mpfr_acos (y, x, GMP_RNDN);
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_acos (y, x, MPFR_RNDN);
if (mpfr_cmp_ui (y, 0) || mpfr_sgn (y) < 0)
{
printf ("Error: acos(1) != +0.0\n");
@@ -146,12 +146,12 @@ main (void)
}
/* acos (0) = Pi/2 */
- for (r = 0; r < GMP_RND_MAX; r++)
+ for (r = 0; r < MPFR_RND_MAX; r++)
{
- mpfr_set_ui (x, 0, GMP_RNDN); /* exact */
+ mpfr_set_ui (x, 0, MPFR_RNDN); /* exact */
mpfr_acos (y, x, (mp_rnd_t) r);
mpfr_const_pi (x, (mp_rnd_t) r);
- mpfr_div_2exp (x, x, 1, GMP_RNDN); /* exact */
+ mpfr_div_2exp (x, x, 1, MPFR_RNDN); /* exact */
if (mpfr_cmp (x, y))
{
printf ("Error: acos(0) != Pi/2 for rnd=%s\n",
@@ -161,9 +161,9 @@ main (void)
}
/* acos (-1) = Pi */
- for (r = 0; r < GMP_RND_MAX; r++)
+ for (r = 0; r < MPFR_RND_MAX; r++)
{
- mpfr_set_si (x, -1, GMP_RNDN); /* exact */
+ mpfr_set_si (x, -1, MPFR_RNDN); /* exact */
mpfr_acos (y, x, (mp_rnd_t) r);
mpfr_const_pi (x, (mp_rnd_t) r);
if (mpfr_cmp (x, y))
diff --git a/tests/tacosh.c b/tests/tacosh.c
index bf9a0e5bc..31f8905a9 100644
--- a/tests/tacosh.c
+++ b/tests/tacosh.c
@@ -46,8 +46,8 @@ special (void)
mpfr_init (y);
MPFR_SET_INF(x);
- mpfr_set_ui (y, 1, GMP_RNDN);
- mpfr_acosh (x, y, GMP_RNDN);
+ mpfr_set_ui (y, 1, MPFR_RNDN);
+ mpfr_acosh (x, y, MPFR_RNDN);
if (MPFR_IS_INF(x) || MPFR_IS_NAN(x) )
{
printf ("Inf flag not clears in acosh!\n");
@@ -60,23 +60,23 @@ special (void)
}
MPFR_SET_NAN(x);
- mpfr_acosh (x, y, GMP_RNDN);
+ mpfr_acosh (x, y, MPFR_RNDN);
if (MPFR_IS_NAN(x) || MPFR_IS_INF(x) )
{
printf ("NAN flag not clears in acosh!\n");
exit (1);
}
- mpfr_set_ui (x, 0, GMP_RNDN);
- mpfr_acosh (y, x, GMP_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_acosh (y, x, MPFR_RNDN);
if (!mpfr_nan_p (y))
{
printf ("Error: mpfr_acosh(0) <> NaN\n");
exit (1);
}
- mpfr_set_si (x, -1, GMP_RNDN);
- mpfr_acosh (y, x, GMP_RNDN);
+ mpfr_set_si (x, -1, MPFR_RNDN);
+ mpfr_acosh (y, x, MPFR_RNDN);
if (!mpfr_nan_p (y))
{
printf ("Error: mpfr_acosh(-1) <> NaN\n");
@@ -84,7 +84,7 @@ special (void)
}
MPFR_SET_NAN(x);
- mpfr_acosh (y, x, GMP_RNDN);
+ mpfr_acosh (y, x, MPFR_RNDN);
if (!mpfr_nan_p (y))
{
printf ("Error: mpfr_acosh(NaN) <> NaN\n");
@@ -92,7 +92,7 @@ special (void)
}
mpfr_set_inf (x, 1);
- mpfr_acosh (y, x, GMP_RNDN);
+ mpfr_acosh (y, x, MPFR_RNDN);
if (!mpfr_inf_p (y) || mpfr_sgn (y) < 0)
{
printf ("Error: mpfr_acosh(+Inf) <> +Inf\n");
@@ -100,16 +100,16 @@ special (void)
}
mpfr_set_inf (x, -1);
- mpfr_acosh (y, x, GMP_RNDN);
+ mpfr_acosh (y, x, MPFR_RNDN);
if (!mpfr_nan_p (y))
{
printf ("Error: mpfr_acosh(-Inf) <> NaN\n");
exit (1);
}
- mpfr_set_ui (x, 1, GMP_RNDN);
- mpfr_div_2exp (x, x, 1, GMP_RNDN);
- mpfr_acosh (y, x, GMP_RNDN);
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_div_2exp (x, x, 1, MPFR_RNDN);
+ mpfr_acosh (y, x, MPFR_RNDN);
if (!mpfr_nan_p (y))
{
printf ("Error: mpfr_acosh(1/2) <> NaN\n");
@@ -119,7 +119,7 @@ special (void)
mpfr_set_prec (x, 32);
mpfr_set_prec (y, 32);
mpfr_set_str_binary (x, "1.000001101011101111001011");
- mpfr_acosh (y, x, GMP_RNDN);
+ mpfr_acosh (y, x, MPFR_RNDN);
mpfr_set_str_binary (x, "0.111010100101101001010001101001E-2");
if (mpfr_cmp (x, y))
{
@@ -142,10 +142,10 @@ bug20070831 (void)
mpfr_init2 (y, 32);
mpfr_init2 (z, 32);
- mpfr_set_ui (x, 1, GMP_RNDN);
+ mpfr_set_ui (x, 1, MPFR_RNDN);
mpfr_nextabove (x);
- inex = mpfr_acosh (y, x, GMP_RNDZ);
- mpfr_set_ui_2exp (z, 1, -127, GMP_RNDN);
+ inex = mpfr_acosh (y, x, MPFR_RNDZ);
+ mpfr_set_ui_2exp (z, 1, -127, MPFR_RNDN);
mpfr_nextbelow (z);
if (!mpfr_equal_p (y, z))
{
@@ -159,7 +159,7 @@ bug20070831 (void)
mpfr_nextabove (x);
mpfr_set_prec (y, 29);
- inex = mpfr_acosh (y, x, GMP_RNDN);
+ inex = mpfr_acosh (y, x, MPFR_RNDN);
mpfr_set_str_binary (z, "1.011010100000100111100110011E-127");
if (!mpfr_equal_p (y, z))
{
@@ -182,8 +182,8 @@ huge (void)
/* TODO: extend the exponent range and use mpfr_get_emax (). */
mpfr_inits2 (32, x, y, z, (mpfr_ptr) 0);
- mpfr_set_ui_2exp (x, 1, 1073741822, GMP_RNDN);
- inex = mpfr_acosh (y, x, GMP_RNDN);
+ mpfr_set_ui_2exp (x, 1, 1073741822, MPFR_RNDN);
+ inex = mpfr_acosh (y, x, MPFR_RNDN);
mpfr_set_str_binary (z, "0.10110001011100100001011111110101E30");
if (!mpfr_equal_p (y, z))
{
diff --git a/tests/tadd.c b/tests/tadd.c
index fee6eebe4..f1efb7a9a 100644
--- a/tests/tadd.c
+++ b/tests/tadd.c
@@ -38,7 +38,7 @@ test_add (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mp_rnd_t rnd_mode)
{
int res;
#ifdef CHECK_EXTERNAL
- int ok = rnd_mode == GMP_RNDN && mpfr_number_p (b) && mpfr_number_p (c);
+ int ok = rnd_mode == MPFR_RNDN && mpfr_number_p (b) && mpfr_number_p (c);
if (ok)
{
mpfr_print_raw (b);
@@ -94,7 +94,7 @@ pcheck (const char *xs, const char *ys, const char *zs, mp_rnd_t rnd_mode,
if (mpfr_cmp_str1 (zz, zs) )
{
printf ("expected sum is %s, got ", zs);
- mpfr_out_str(stdout, 10, 0, zz, GMP_RNDN);
+ mpfr_out_str(stdout, 10, 0, zz, MPFR_RNDN);
printf ("mpfr_add failed for x=%s y=%s with rnd_mode=%s\n",
xs, ys, mpfr_print_rnd_mode (rnd_mode));
exit (1);
@@ -114,12 +114,12 @@ check2b (const char *xs, int px,
mpfr_set_str_binary (xx, xs);
mpfr_set_str_binary (yy, ys);
test_add (zz, xx, yy, rnd_mode);
- if (mpfr_cmp_str (zz, rs, 2, GMP_RNDN))
+ if (mpfr_cmp_str (zz, rs, 2, MPFR_RNDN))
{
printf ("(2) x=%s,%d y=%s,%d pz=%d,rnd=%s\n",
xs, px, ys, py, pz, mpfr_print_rnd_mode (rnd_mode));
printf ("got "); mpfr_print_binary(zz); puts ("");
- mpfr_set_str(zz, rs, 2, GMP_RNDN);
+ mpfr_set_str(zz, rs, 2, MPFR_RNDN);
printf ("instead of "); mpfr_print_binary(zz); puts ("");
exit (1);
}
@@ -140,14 +140,14 @@ check64 (void)
mpfr_set_prec (t, 58);
mpfr_set_str_binary (t, "0.11100010011111001001100110010111110110011000000100101E-1");
mpfr_set_prec (u, 29);
- test_add (u, x, t, GMP_RNDD);
+ test_add (u, x, t, MPFR_RNDD);
mpfr_set_str_binary (t, "1.0101011100001000011100111110e-1");
if (mpfr_cmp (u, t))
{
printf ("mpfr_add(u, x, t) failed for prec(x)=29, prec(t)=58\n");
- printf ("expected "); mpfr_out_str (stdout, 2, 29, t, GMP_RNDN);
+ printf ("expected "); mpfr_out_str (stdout, 2, 29, t, MPFR_RNDN);
puts ("");
- printf ("got "); mpfr_out_str (stdout, 2, 29, u, GMP_RNDN);
+ printf ("got "); mpfr_out_str (stdout, 2, 29, u, MPFR_RNDN);
puts ("");
exit(1);
}
@@ -157,7 +157,7 @@ check64 (void)
mpfr_set_prec (t, 2);
mpfr_set_str_binary (t, "-1.1e-2");
mpfr_set_prec (u, 2);
- test_add (u, x, t, GMP_RNDN);
+ test_add (u, x, t, MPFR_RNDN);
if (MPFR_MANT(u)[0] << 2)
{
printf ("result not normalized for prec=2\n");
@@ -169,7 +169,7 @@ check64 (void)
{
printf ("mpfr_add(u, x, t) failed for prec(x)=4, prec(t)=2\n");
printf ("expected -1.0e-1\n");
- printf ("got "); mpfr_out_str (stdout, 2, 4, u, GMP_RNDN);
+ printf ("got "); mpfr_out_str (stdout, 2, 4, u, MPFR_RNDN);
puts ("");
exit (1);
}
@@ -179,12 +179,12 @@ check64 (void)
mpfr_set_prec (t, 4);
mpfr_set_str_binary (t, "-1.110e-5"); /* -7/128 */
mpfr_set_prec (u, 4);
- test_add (u, x, t, GMP_RNDN); /* should give -5/8 */
+ test_add (u, x, t, MPFR_RNDN); /* should give -5/8 */
mpfr_set_str_binary (t, "-1.010e-1");
if (mpfr_cmp (u, t)) {
printf ("mpfr_add(u, x, t) failed for prec(x)=8, prec(t)=4\n");
printf ("expected -1.010e-1\n");
- printf ("got "); mpfr_out_str (stdout, 2, 4, u, GMP_RNDN);
+ printf ("got "); mpfr_out_str (stdout, 2, 4, u, MPFR_RNDN);
puts ("");
exit (1);
}
@@ -192,7 +192,7 @@ check64 (void)
mpfr_set_prec (x, 112); mpfr_set_prec (t, 98); mpfr_set_prec (u, 54);
mpfr_set_str_binary (x, "-0.11111100100000000011000011100000101101010001000111E-401");
mpfr_set_str_binary (t, "0.10110000100100000101101100011111111011101000111000101E-464");
- test_add (u, x, t, GMP_RNDN);
+ test_add (u, x, t, MPFR_RNDN);
if (mpfr_cmp (u, x))
{
printf ("mpfr_add(u, x, t) failed for prec(x)=112, prec(t)=98\n");
@@ -200,9 +200,9 @@ check64 (void)
}
mpfr_set_prec (x, 92); mpfr_set_prec (t, 86); mpfr_set_prec (u, 53);
- mpfr_set_str (x, "-5.03525136761487735093e-74", 10, GMP_RNDN);
- mpfr_set_str (t, "8.51539046314262304109e-91", 10, GMP_RNDN);
- test_add (u, x, t, GMP_RNDN);
+ mpfr_set_str (x, "-5.03525136761487735093e-74", 10, MPFR_RNDN);
+ mpfr_set_str (t, "8.51539046314262304109e-91", 10, MPFR_RNDN);
+ test_add (u, x, t, MPFR_RNDN);
if (mpfr_cmp_str1 (u, "-5.0352513676148773509283672e-74") )
{
printf ("mpfr_add(u, x, t) failed for prec(x)=92, prec(t)=86\n");
@@ -212,7 +212,7 @@ check64 (void)
mpfr_set_prec(x, 53); mpfr_set_prec(t, 76); mpfr_set_prec(u, 76);
mpfr_set_str_binary(x, "-0.10010010001001011011110000000000001010011011011110001E-32");
mpfr_set_str_binary(t, "-0.1011000101110010000101111111011111010001110011110111100110101011110010011111");
- mpfr_sub(u, x, t, GMP_RNDU);
+ mpfr_sub(u, x, t, MPFR_RNDU);
mpfr_set_str_binary(t, "0.1011000101110010000101111111011100111111101010011011110110101011101000000100");
if (mpfr_cmp(u,t))
{
@@ -223,7 +223,7 @@ check64 (void)
mpfr_set_prec(x, 53); mpfr_set_prec(t, 108); mpfr_set_prec(u, 108);
mpfr_set_str_binary(x, "-0.10010010001001011011110000000000001010011011011110001E-32");
mpfr_set_str_binary(t, "-0.101100010111001000010111111101111101000111001111011110011010101111001001111000111011001110011000000000111111");
- mpfr_sub(u, x, t, GMP_RNDU);
+ mpfr_sub(u, x, t, MPFR_RNDU);
mpfr_set_str_binary(t, "0.101100010111001000010111111101110011111110101001101111011010101110100000001011000010101110011000000000111111");
if (mpfr_cmp(u,t))
{
@@ -233,8 +233,8 @@ check64 (void)
}
mpfr_set_prec(x, 97); mpfr_set_prec(t, 97); mpfr_set_prec(u, 97);
mpfr_set_str_binary(x, "0.1111101100001000000001011000110111101000001011111000100001000101010100011111110010000000000000000E-39");
- mpfr_set_ui(t, 1, GMP_RNDN);
- test_add (u, x, t, GMP_RNDN);
+ mpfr_set_ui(t, 1, MPFR_RNDN);
+ test_add (u, x, t, MPFR_RNDN);
mpfr_set_str_binary(x, "0.1000000000000000000000000000000000000000111110110000100000000101100011011110100000101111100010001E1");
if (mpfr_cmp(u,x))
{
@@ -243,17 +243,17 @@ check64 (void)
}
mpfr_set_prec(x, 128); mpfr_set_prec(t, 128); mpfr_set_prec(u, 128);
mpfr_set_str_binary(x, "0.10101011111001001010111011001000101100111101000000111111111011010100001100011101010001010111111101111010100110111111100101100010E-4");
- mpfr_set(t, x, GMP_RNDN);
- mpfr_sub(u, x, t, GMP_RNDN);
+ mpfr_set(t, x, MPFR_RNDN);
+ mpfr_sub(u, x, t, MPFR_RNDN);
mpfr_set_prec(x, 96); mpfr_set_prec(t, 96); mpfr_set_prec(u, 96);
mpfr_set_str_binary(x, "0.111000000001110100111100110101101001001010010011010011100111100011010100011001010011011011000010E-4");
- mpfr_set(t, x, GMP_RNDN);
- mpfr_sub(u, x, t, GMP_RNDN);
+ mpfr_set(t, x, MPFR_RNDN);
+ mpfr_sub(u, x, t, MPFR_RNDN);
mpfr_set_prec(x, 85); mpfr_set_prec(t, 85); mpfr_set_prec(u, 85);
mpfr_set_str_binary(x, "0.1111101110100110110110100010101011101001100010100011110110110010010011101100101111100E-4");
mpfr_set_str_binary(t, "0.1111101110100110110110100010101001001000011000111000011101100101110100001110101010110E-4");
- mpfr_sub(u, x, t, GMP_RNDU);
- mpfr_sub(x, x, t, GMP_RNDU);
+ mpfr_sub(u, x, t, MPFR_RNDU);
+ mpfr_sub(x, x, t, MPFR_RNDU);
if (mpfr_cmp(x, u) != 0)
{
printf ("Error in mpfr_sub: u=x-t and x=x-t give different results\n");
@@ -268,7 +268,7 @@ check64 (void)
mpfr_set_prec(x, 65); mpfr_set_prec(t, 65); mpfr_set_prec(u, 65);
mpfr_set_str_binary(x, "0.10011010101000110101010000000011001001001110001011101011111011101E623");
mpfr_set_str_binary(t, "0.10011010101000110101010000000011001001001110001011101011111011100E623");
- mpfr_sub(u, x, t, GMP_RNDU);
+ mpfr_sub(u, x, t, MPFR_RNDU);
if (mpfr_cmp_ui_2exp(u, 1, 558))
{ /* 2^558 */
printf ("Error (1) in mpfr_sub\n");
@@ -278,10 +278,10 @@ check64 (void)
mpfr_set_prec(x, 64); mpfr_set_prec(t, 64); mpfr_set_prec(u, 64);
mpfr_set_str_binary(x, "0.1000011110101111011110111111000011101011101111101101101100000100E-220");
mpfr_set_str_binary(t, "0.1000011110101111011110111111000011101011101111101101010011111101E-220");
- test_add (u, x, t, GMP_RNDU);
+ test_add (u, x, t, MPFR_RNDU);
if ((MPFR_MANT(u)[0] & 1) != 1)
{
- printf ("error in mpfr_add with rnd_mode=GMP_RNDU\n");
+ printf ("error in mpfr_add with rnd_mode=MPFR_RNDU\n");
printf ("b= "); mpfr_print_binary(x); puts ("");
printf ("c= "); mpfr_print_binary(t); puts ("");
printf ("b+c="); mpfr_print_binary(u); puts ("");
@@ -292,31 +292,31 @@ check64 (void)
mpfr_set_prec(x, 56); mpfr_set_prec(t, 83); mpfr_set_prec(u, 10);
mpfr_set_str_binary(x, "0.10001001011011001111101100110100000101111010010111010111E-7");
mpfr_set_str_binary(t, "0.10001001011011001111101100110100000101111010010111010111000000000111110110110000100E-7");
- mpfr_sub(u, x, t, GMP_RNDU);
+ mpfr_sub(u, x, t, MPFR_RNDU);
/* array bound write found by Norbert Mueller, 26 Sep 2000 */
mpfr_set_prec(x, 109); mpfr_set_prec(t, 153); mpfr_set_prec(u, 95);
mpfr_set_str_binary(x,"0.1001010000101011101100111000110001111111111111111111111111111111111111111111111111111111111111100000000000000E33");
mpfr_set_str_binary(t,"-0.100101000010101110110011100011000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011100101101000000100100001100110111E33");
- test_add (u, x, t, GMP_RNDN);
+ test_add (u, x, t, MPFR_RNDN);
/* array bound writes found by Norbert Mueller, 27 Sep 2000 */
mpfr_set_prec(x, 106); mpfr_set_prec(t, 53); mpfr_set_prec(u, 23);
mpfr_set_str_binary(x, "-0.1000011110101111111001010001000100001011000000000000000000000000000000000000000000000000000000000000000000E-59");
mpfr_set_str_binary(t, "-0.10000111101011111110010100010001101100011100110100000E-59");
- mpfr_sub(u, x, t, GMP_RNDN);
+ mpfr_sub(u, x, t, MPFR_RNDN);
mpfr_set_prec(x, 177); mpfr_set_prec(t, 217); mpfr_set_prec(u, 160);
mpfr_set_str_binary(x, "-0.111010001011010000111001001010010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000E35");
mpfr_set_str_binary(t, "0.1110100010110100001110010010100100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111011010011100001111001E35");
- test_add (u, x, t, GMP_RNDN);
+ test_add (u, x, t, MPFR_RNDN);
mpfr_set_prec(x, 214); mpfr_set_prec(t, 278); mpfr_set_prec(u, 207);
mpfr_set_str_binary(x, "0.1000100110100110101101101101000000010000100111000001001110001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000E66");
mpfr_set_str_binary(t, "-0.10001001101001101011011011010000000100001001110000010011100010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001111011111001001100011E66");
- test_add (u, x, t, GMP_RNDN);
+ test_add (u, x, t, MPFR_RNDN);
mpfr_set_prec(x, 32); mpfr_set_prec(t, 247); mpfr_set_prec(u, 223);
mpfr_set_str_binary(x, "0.10000000000000000000000000000000E1");
mpfr_set_str_binary(t, "0.1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111100000110001110100000100011110000101110110011101110100110110111111011010111100100000000000000000000000000E0");
- mpfr_sub(u, x, t, GMP_RNDN);
+ mpfr_sub(u, x, t, MPFR_RNDN);
if ((MPFR_MANT(u)[(MPFR_PREC(u)-1)/mp_bits_per_limb] &
((mp_limb_t)1<<(mp_bits_per_limb-1)))==0)
{
@@ -330,7 +330,7 @@ check64 (void)
mpfr_set_prec (u, 65);
mpfr_set_str_binary (x, "0.11100100101101001100111011111111110001101001000011101001001010010E-35");
mpfr_set_str_binary (t, "0.10000000000000000000000000000000000001110010010110100110011110000E1");
- mpfr_sub (u, t, x, GMP_RNDU);
+ mpfr_sub (u, t, x, MPFR_RNDU);
if ((MPFR_MANT(u)[(MPFR_PREC(u)-1)/mp_bits_per_limb] &
((mp_limb_t)1<<(mp_bits_per_limb-1)))==0)
{
@@ -344,7 +344,7 @@ check64 (void)
mpfr_set_prec (u, 107);
mpfr_set_str_binary (x, "0.10111001001111010010001000000010111111011011011101000001001000101000000000000000000000000000000000000000000E315");
mpfr_set_str_binary (t, "0.10000000000000000000000000000000000101110100100101110110000001100101011111001000011101111100100100111011000E350");
- mpfr_sub (u, x, t, GMP_RNDU);
+ mpfr_sub (u, x, t, MPFR_RNDU);
if ((MPFR_MANT(u)[(MPFR_PREC(u)-1)/mp_bits_per_limb] &
((mp_limb_t)1<<(mp_bits_per_limb-1)))==0)
{
@@ -353,14 +353,14 @@ check64 (void)
}
/* checks that NaN flag is correctly reset */
- mpfr_set_ui (t, 1, GMP_RNDN);
- mpfr_set_ui (u, 1, GMP_RNDN);
+ mpfr_set_ui (t, 1, MPFR_RNDN);
+ mpfr_set_ui (u, 1, MPFR_RNDN);
mpfr_set_nan (x);
- test_add (x, t, u, GMP_RNDN);
+ test_add (x, t, u, MPFR_RNDN);
if (mpfr_cmp_ui (x, 2))
{
printf ("Error in mpfr_add: 1+1 gives ");
- mpfr_out_str(stdout, 10, 0, x, GMP_RNDN);
+ mpfr_out_str(stdout, 10, 0, x, MPFR_RNDN);
exit (1);
}
@@ -387,20 +387,20 @@ check_case_1b (void)
dif = prec_b - prec_a;
mpfr_set_prec (b, prec_b);
/* b = 1 - 2^(-prec_a) + 2^(-prec_b) */
- mpfr_set_ui (b, 1, GMP_RNDN);
- mpfr_div_2exp (b, b, dif, GMP_RNDN);
- mpfr_sub_ui (b, b, 1, GMP_RNDN);
- mpfr_div_2exp (b, b, prec_a, GMP_RNDN);
- mpfr_add_ui (b, b, 1, GMP_RNDN);
+ mpfr_set_ui (b, 1, MPFR_RNDN);
+ mpfr_div_2exp (b, b, dif, MPFR_RNDN);
+ mpfr_sub_ui (b, b, 1, MPFR_RNDN);
+ mpfr_div_2exp (b, b, prec_a, MPFR_RNDN);
+ mpfr_add_ui (b, b, 1, MPFR_RNDN);
for (prec_c = dif; prec_c <= 64; prec_c++)
{
/* c = 2^(-prec_a) - 2^(-prec_b) */
mpfr_set_prec (c, prec_c);
- mpfr_set_si (c, -1, GMP_RNDN);
- mpfr_div_2exp (c, c, dif, GMP_RNDN);
- mpfr_add_ui (c, c, 1, GMP_RNDN);
- mpfr_div_2exp (c, c, prec_a, GMP_RNDN);
- test_add (a, b, c, GMP_RNDN);
+ mpfr_set_si (c, -1, MPFR_RNDN);
+ mpfr_div_2exp (c, c, dif, MPFR_RNDN);
+ mpfr_add_ui (c, c, 1, MPFR_RNDN);
+ mpfr_div_2exp (c, c, prec_a, MPFR_RNDN);
+ test_add (a, b, c, MPFR_RNDN);
if (mpfr_cmp_ui (a, 1) != 0)
{
printf ("case (1b) failed for prec_a=%u, prec_b=%u,"
@@ -433,15 +433,15 @@ check_case_2 (void)
mpfr_set_str_binary(a, "1E110"); /* a = 2^110 */
mpfr_set_str_binary(b, "1E900"); /* b = 2^900 */
mpfr_set_str_binary(c, "1E500"); /* c = 2^500 */
- test_add (c, c, a, GMP_RNDZ); /* c = 2^500 + 2^110 */
- mpfr_sub (d, b, c, GMP_RNDZ); /* d = 2^900 - 2^500 - 2^110 */
- test_add (b, b, c, GMP_RNDZ); /* b = 2^900 + 2^500 + 2^110 */
- test_add (a, b, d, GMP_RNDZ); /* a = 2^901 */
+ test_add (c, c, a, MPFR_RNDZ); /* c = 2^500 + 2^110 */
+ mpfr_sub (d, b, c, MPFR_RNDZ); /* d = 2^900 - 2^500 - 2^110 */
+ test_add (b, b, c, MPFR_RNDZ); /* b = 2^900 + 2^500 + 2^110 */
+ test_add (a, b, d, MPFR_RNDZ); /* a = 2^901 */
if (mpfr_cmp_ui_2exp (a, 1, 901))
{
printf ("b + d fails for b=2^900+2^500+2^110, d=2^900-2^500-2^110\n");
printf ("expected 1.0e901, got ");
- mpfr_out_str (stdout, 2, 0, a, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, a, MPFR_RNDN);
printf ("\n");
exit (1);
}
@@ -458,8 +458,8 @@ check_same (void)
{
mpfr_t x;
- mpfr_init(x); mpfr_set_ui(x, 1, GMP_RNDZ);
- test_add (x, x, x, GMP_RNDZ);
+ mpfr_init(x); mpfr_set_ui(x, 1, MPFR_RNDZ);
+ test_add (x, x, x, MPFR_RNDZ);
if (mpfr_cmp_ui (x, 2))
{
printf ("Error when all 3 operands are equal\n");
@@ -490,7 +490,7 @@ check_inexact (void)
mpfr_set_prec (u, 33);
mpfr_set_str_binary (u, "0.101110100101101100000000111100000E-1");
mpfr_set_prec (y, 31);
- if ((inexact = test_add (y, x, u, GMP_RNDN)))
+ if ((inexact = test_add (y, x, u, MPFR_RNDN)))
{
printf ("Wrong inexact flag (2): expected 0, got %d\n", inexact);
exit (1);
@@ -501,7 +501,7 @@ check_inexact (void)
mpfr_set_prec (u, 33);
mpfr_set_str_binary (u, "0.101110100101101100000000111100000E-1");
mpfr_set_prec (y, 28);
- if ((inexact = test_add (y, x, u, GMP_RNDN)))
+ if ((inexact = test_add (y, x, u, MPFR_RNDN)))
{
printf ("Wrong inexact flag (1): expected 0, got %d\n", inexact);
exit (1);
@@ -581,34 +581,34 @@ check_nans (void)
/* +inf + -inf == nan */
mpfr_set_inf (x, 1);
mpfr_set_inf (y, -1);
- test_add (s, x, y, GMP_RNDN);
+ test_add (s, x, y, MPFR_RNDN);
MPFR_ASSERTN (mpfr_nan_p (s));
/* +inf + 1 == +inf */
mpfr_set_inf (x, 1);
- mpfr_set_ui (y, 1L, GMP_RNDN);
- test_add (s, x, y, GMP_RNDN);
+ mpfr_set_ui (y, 1L, MPFR_RNDN);
+ test_add (s, x, y, MPFR_RNDN);
MPFR_ASSERTN (mpfr_inf_p (s));
MPFR_ASSERTN (mpfr_sgn (s) > 0);
/* -inf + 1 == -inf */
mpfr_set_inf (x, -1);
- mpfr_set_ui (y, 1L, GMP_RNDN);
- test_add (s, x, y, GMP_RNDN);
+ mpfr_set_ui (y, 1L, MPFR_RNDN);
+ test_add (s, x, y, MPFR_RNDN);
MPFR_ASSERTN (mpfr_inf_p (s));
MPFR_ASSERTN (mpfr_sgn (s) < 0);
/* 1 + +inf == +inf */
- mpfr_set_ui (x, 1L, GMP_RNDN);
+ mpfr_set_ui (x, 1L, MPFR_RNDN);
mpfr_set_inf (y, 1);
- test_add (s, x, y, GMP_RNDN);
+ test_add (s, x, y, MPFR_RNDN);
MPFR_ASSERTN (mpfr_inf_p (s));
MPFR_ASSERTN (mpfr_sgn (s) > 0);
/* 1 + -inf == -inf */
- mpfr_set_ui (x, 1L, GMP_RNDN);
+ mpfr_set_ui (x, 1L, MPFR_RNDN);
mpfr_set_inf (y, -1);
- test_add (s, x, y, GMP_RNDN);
+ test_add (s, x, y, MPFR_RNDN);
MPFR_ASSERTN (mpfr_inf_p (s));
MPFR_ASSERTN (mpfr_sgn (s) < 0);
@@ -624,11 +624,11 @@ check_alloc (void)
mpfr_init2 (a, 10000);
mpfr_set_prec (a, 53);
- mpfr_set_ui (a, 15236, GMP_RNDN);
- test_add (a, a, a, GMP_RNDN);
- mpfr_mul (a, a, a, GMP_RNDN);
- mpfr_div (a, a, a, GMP_RNDN);
- mpfr_sub (a, a, a, GMP_RNDN);
+ mpfr_set_ui (a, 15236, MPFR_RNDN);
+ test_add (a, a, a, MPFR_RNDN);
+ mpfr_mul (a, a, a, MPFR_RNDN);
+ mpfr_div (a, a, a, MPFR_RNDN);
+ mpfr_sub (a, a, a, MPFR_RNDN);
mpfr_clear (a);
}
@@ -643,9 +643,9 @@ check_overflow (void)
mpfr_init2 (b, 256);
mpfr_init2 (c, 256);
- mpfr_set_ui (b, 1, GMP_RNDN);
+ mpfr_set_ui (b, 1, MPFR_RNDN);
mpfr_setmax (b, mpfr_get_emax ());
- mpfr_set_ui (c, 1, GMP_RNDN);
+ mpfr_set_ui (c, 1, MPFR_RNDN);
mpfr_set_exp (c, mpfr_get_emax () - 192);
RND_LOOP(r)
for (prec_a = 128; prec_a < 512; prec_a += 64)
@@ -663,7 +663,7 @@ check_overflow (void)
mpfr_set_exp (c, mpfr_get_emax () - 512);
mpfr_set_prec (a, 256);
mpfr_clear_overflow ();
- test_add (a, b, c, GMP_RNDU);
+ test_add (a, b, c, MPFR_RNDU);
if (!mpfr_overflow_p ())
{
printf ("No overflow in check_overflow\n");
@@ -682,7 +682,7 @@ check_1111 (void)
long n;
mpfr_init2 (one, MPFR_PREC_MIN);
- mpfr_set_ui (one, 1, GMP_RNDN);
+ mpfr_set_ui (one, 1, MPFR_RNDN);
for (n = 0; n < NUM; n++)
{
mp_prec_t prec_a, prec_b, prec_c;
@@ -703,25 +703,25 @@ check_1111 (void)
if (sb != 0)
{
tb = 1 + (randlimb () % (prec_b - (sb != 2)));
- mpfr_div_2ui (b, one, tb, GMP_RNDN);
+ mpfr_div_2ui (b, one, tb, MPFR_RNDN);
if (sb == 2)
- mpfr_neg (b, b, GMP_RNDN);
- test_add (b, b, one, GMP_RNDN);
+ mpfr_neg (b, b, MPFR_RNDN);
+ test_add (b, b, one, MPFR_RNDN);
}
else
- mpfr_set (b, one, GMP_RNDN);
+ mpfr_set (b, one, MPFR_RNDN);
tc = 1 + (randlimb () % (prec_c - 1));
- mpfr_div_2ui (c, one, tc, GMP_RNDN);
+ mpfr_div_2ui (c, one, tc, MPFR_RNDN);
sc = randlimb () % 2;
if (sc)
- mpfr_neg (c, c, GMP_RNDN);
- test_add (c, c, one, GMP_RNDN);
+ mpfr_neg (c, c, MPFR_RNDN);
+ test_add (c, c, one, MPFR_RNDN);
diff = (randlimb () % (2*m)) - m;
- mpfr_mul_2si (c, c, diff, GMP_RNDN);
+ mpfr_mul_2si (c, c, diff, MPFR_RNDN);
rnd_mode = RND_RAND ();
inex_a = test_add (a, b, c, rnd_mode);
mpfr_init2 (s, MPFR_PREC_MIN + 2*m);
- inex_s = test_add (s, b, c, GMP_RNDN); /* exact */
+ inex_s = test_add (s, b, c, MPFR_RNDN); /* exact */
if (inex_s)
{
printf ("check_1111: result should have been exact.\n");
@@ -778,21 +778,21 @@ check_1minuseps (void)
mpfr_init2 (a, prec_a[ia]);
mpfr_init2 (b, prec_b);
- mpfr_set_ui (c, 1, GMP_RNDN);
- mpfr_div_ui (b, c, prec_a[ia], GMP_RNDN);
- mpfr_sub (b, c, b, GMP_RNDN); /* b = 1 - 2^(-prec_a) */
+ mpfr_set_ui (c, 1, MPFR_RNDN);
+ mpfr_div_ui (b, c, prec_a[ia], MPFR_RNDN);
+ mpfr_sub (b, c, b, MPFR_RNDN); /* b = 1 - 2^(-prec_a) */
for (ic = 0; ic < numberof(supp_b); ic++)
- for (rnd_mode = 0; rnd_mode < GMP_RND_MAX; rnd_mode++)
+ for (rnd_mode = 0; rnd_mode < MPFR_RND_MAX; rnd_mode++)
{
mpfr_t s;
int inex_a, inex_s;
- mpfr_set_ui (c, 1, GMP_RNDN);
- mpfr_div_ui (c, c, prec_a[ia] + supp_b[ic], GMP_RNDN);
+ mpfr_set_ui (c, 1, MPFR_RNDN);
+ mpfr_div_ui (c, c, prec_a[ia] + supp_b[ic], MPFR_RNDN);
inex_a = test_add (a, b, c, (mp_rnd_t) rnd_mode);
mpfr_init2 (s, 256);
- inex_s = test_add (s, b, c, GMP_RNDN); /* exact */
+ inex_s = test_add (s, b, c, MPFR_RNDN); /* exact */
if (inex_s)
{
printf ("check_1minuseps: result should have been exact "
@@ -829,239 +829,239 @@ tests (void)
check_case_2 ();
check64();
- check("293607738.0", "1.9967571564050541e-5", GMP_RNDU, 64, 53, 53,
+ check("293607738.0", "1.9967571564050541e-5", MPFR_RNDU, 64, 53, 53,
"2.9360773800002003e8");
- check("880524.0", "-2.0769715792901673e-5", GMP_RNDN, 64, 53, 53,
+ check("880524.0", "-2.0769715792901673e-5", MPFR_RNDN, 64, 53, 53,
"8.8052399997923023e5");
- check("1196426492.0", "-1.4218093058435347e-3", GMP_RNDN, 64, 53, 53,
+ check("1196426492.0", "-1.4218093058435347e-3", MPFR_RNDN, 64, 53, 53,
"1.1964264919985781e9");
- check("982013018.0", "-8.941829477291838e-7", GMP_RNDN, 64, 53, 53,
+ check("982013018.0", "-8.941829477291838e-7", MPFR_RNDN, 64, 53, 53,
"9.8201301799999905e8");
- check("1092583421.0", "1.0880649218158844e9", GMP_RNDN, 64, 53, 53,
+ check("1092583421.0", "1.0880649218158844e9", MPFR_RNDN, 64, 53, 53,
"2.1806483428158846e9");
- check("1.8476886419022969e-6", "961494401.0", GMP_RNDN, 53, 64, 53,
+ check("1.8476886419022969e-6", "961494401.0", MPFR_RNDN, 53, 64, 53,
"9.6149440100000179e8");
- check("-2.3222118418069868e5", "1229318102.0", GMP_RNDN, 53, 64, 53,
+ check("-2.3222118418069868e5", "1229318102.0", MPFR_RNDN, 53, 64, 53,
"1.2290858808158193e9");
- check("-3.0399171300395734e-6", "874924868.0", GMP_RNDN, 53, 64, 53,
+ check("-3.0399171300395734e-6", "874924868.0", MPFR_RNDN, 53, 64, 53,
"8.749248679999969e8");
- check("9.064246624706179e1", "663787413.0", GMP_RNDN, 53, 64, 53,
+ check("9.064246624706179e1", "663787413.0", MPFR_RNDN, 53, 64, 53,
"6.6378750364246619e8");
- check("-1.0954322421551264e2", "281806592.0", GMP_RNDD, 53, 64, 53,
+ check("-1.0954322421551264e2", "281806592.0", MPFR_RNDD, 53, 64, 53,
"2.8180648245677572e8");
- check("5.9836930386056659e-8", "1016217213.0", GMP_RNDN, 53, 64, 53,
+ check("5.9836930386056659e-8", "1016217213.0", MPFR_RNDN, 53, 64, 53,
"1.0162172130000001e9");
- check("-1.2772161928500301e-7", "1237734238.0", GMP_RNDN, 53, 64, 53,
+ check("-1.2772161928500301e-7", "1237734238.0", MPFR_RNDN, 53, 64, 53,
"1.2377342379999998e9");
- check("-4.567291988483277e8", "1262857194.0", GMP_RNDN, 53, 64, 53,
+ check("-4.567291988483277e8", "1262857194.0", MPFR_RNDN, 53, 64, 53,
"8.0612799515167236e8");
- check("4.7719471752925262e7", "196089880.0", GMP_RNDN, 53, 53, 53,
+ check("4.7719471752925262e7", "196089880.0", MPFR_RNDN, 53, 53, 53,
"2.4380935175292528e8");
- check("4.7719471752925262e7", "196089880.0", GMP_RNDN, 53, 64, 53,
+ check("4.7719471752925262e7", "196089880.0", MPFR_RNDN, 53, 64, 53,
"2.4380935175292528e8");
- check("-1.716113812768534e-140", "1271212614.0", GMP_RNDZ, 53, 64, 53,
+ check("-1.716113812768534e-140", "1271212614.0", MPFR_RNDZ, 53, 64, 53,
"1.2712126139999998e9");
- check("-1.2927455200185474e-50", "1675676122.0", GMP_RNDD, 53, 64, 53,
+ check("-1.2927455200185474e-50", "1675676122.0", MPFR_RNDD, 53, 64, 53,
"1.6756761219999998e9");
- check53("1.22191250737771397120e+20", "948002822.0", GMP_RNDN,
+ check53("1.22191250737771397120e+20", "948002822.0", MPFR_RNDN,
"122191250738719408128.0");
- check53("9966027674114492.0", "1780341389094537.0", GMP_RNDN,
+ check53("9966027674114492.0", "1780341389094537.0", MPFR_RNDN,
"11746369063209028.0");
check53("2.99280481918991653800e+272", "5.34637717585790933424e+271",
- GMP_RNDN, "3.5274425367757071711e272");
+ MPFR_RNDN, "3.5274425367757071711e272");
check_same();
check53("6.14384195492641560499e-02", "-6.14384195401037683237e-02",
- GMP_RNDU, "9.1603877261370314499e-12");
+ MPFR_RNDU, "9.1603877261370314499e-12");
check53("1.16809465359248765399e+196", "7.92883212101990665259e+196",
- GMP_RNDU, "9.0969267746123943065e196");
- check53("3.14553393112021279444e-67", "3.14553401015952024126e-67", GMP_RNDU,
+ MPFR_RNDU, "9.0969267746123943065e196");
+ check53("3.14553393112021279444e-67", "3.14553401015952024126e-67", MPFR_RNDU,
"6.2910679412797336946e-67");
- check53("5.43885304644369509058e+185","-1.87427265794105342763e-57",GMP_RNDN,
+ check53("5.43885304644369509058e+185","-1.87427265794105342763e-57",MPFR_RNDN,
"5.4388530464436950905e185");
- check53("5.43885304644369509058e+185","-1.87427265794105342763e-57",GMP_RNDZ,
+ check53("5.43885304644369509058e+185","-1.87427265794105342763e-57",MPFR_RNDZ,
"5.4388530464436944867e185");
- check53("5.43885304644369509058e+185","-1.87427265794105342763e-57",GMP_RNDU,
+ check53("5.43885304644369509058e+185","-1.87427265794105342763e-57",MPFR_RNDU,
"5.4388530464436950905e185");
- check53("5.43885304644369509058e+185","-1.87427265794105342763e-57",GMP_RNDD,
+ check53("5.43885304644369509058e+185","-1.87427265794105342763e-57",MPFR_RNDD,
"5.4388530464436944867e185");
check2b("1.001010101110011000000010100101110010111001010000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e358",187,
"-1.11100111001101100010001111111110101101110001000000000000000000000000000000000000000000e160",87,
"1.001010101110011000000010100101110010111001010000000111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111e358",178,
- GMP_RNDD);
+ MPFR_RNDD);
check2b("-1.111100100011100111010101010101001010100100000111001000000000000000000e481",70,
"1.1111000110100011110101111110110010010000000110101000000000000000e481",65,
"-1.001010111111101011010000001100011101100101000000000000000000e472",61,
- GMP_RNDD);
+ MPFR_RNDD);
check2b("1.0100010111010000100101000000111110011100011001011010000000000000000000000000000000e516",83,
"-1.1001111000100001011100000001001100110011110010111111000000e541",59,
"-1.1001111000100001011011110111000001001011100000011110100000110001110011010011000000000000000000000000000000000000000000000000e541",125,
- GMP_RNDZ);
+ MPFR_RNDZ);
check2b("-1.0010111100000100110001011011010000000011000111101000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e261",155,
"-1.00111110100011e239",15,
"-1.00101111000001001100101010101110001100110001111010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e261",159,
- GMP_RNDD);
+ MPFR_RNDD);
check2b("-1.110111000011111011000000001001111101101001010100111000000000000000000000000e880",76,
"-1.1010010e-634",8,
"-1.11011100001111101100000000100111110110100101010011100000000000000000000000e880",75,
- GMP_RNDZ);
+ MPFR_RNDZ);
check2b("1.00100100110110101001010010101111000001011100100101010000000000000000000000000000e-530",81,
"-1.101101111100000111000011001010110011001011101001110100000e-908",58,
"1.00100100110110101001010010101111000001011100100101010e-530",54,
- GMP_RNDN);
+ MPFR_RNDN);
check2b("1.0101100010010111101000000001000010010010011000111011000000000000000000000000000000000000000000000000000000000000000000e374",119,
"1.11100101100101e358",15,
"1.01011000100110011000010110100100100100100110001110110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e374",150,
- GMP_RNDZ);
+ MPFR_RNDZ);
check2b("-1.10011001000010100000010100100110110010011111101111000000000000000000000000000000000000000000000000000000000000000000e-172",117,
"1.111011100000101010110000100100110100100001001000011100000000e-173",61,
"-1.0100010000001001010110011011101001001011101011110001000000000000000e-173",68,
- GMP_RNDZ);
+ MPFR_RNDZ);
check2b("-1.011110000111101011100001100110100011100101000011011000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e-189",175,
"1.1e631",2,
"1.011111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111e631",115,
- GMP_RNDZ);
+ MPFR_RNDZ);
check2b("-1.101011101001011101100011001000001100010100001101011000000000000000000000000000000000000000000e-449",94,
"-1.01111101010111000011000110011101000111001100110111100000000000000e-429",66,
"-1.01111101010111000100110010000110100100101111111111101100010100001101011000000000000000000000000000000000000000e-429",111,
- GMP_RNDU);
+ MPFR_RNDU);
check2b("-1.101011101001011101100011001000001100010100001101011000000000000000000000000000000000000000000e-449",94,
"-1.01111101010111000011000110011101000111001100110111100000000000000e-429",66,
"-1.01111101010111000100110010000110100100101111111111101100010100001101011000000000000000000000000000000000000000e-429",111,
- GMP_RNDD);
+ MPFR_RNDD);
check2b("-1.1001000011101000110000111110010100100101110101111100000000000000000000000000000000000000000000000000000000e-72",107,
"-1.001100011101100100010101101010101011010010111111010000000000000000000000000000e521",79,
"-1.00110001110110010001010110101010101101001011111101000000000000000000000000000000000000000000000001e521",99,
- GMP_RNDD);
+ MPFR_RNDD);
check2b("-1.01010001111000000101010100100100110101011011100001110000000000e498",63,
"1.010000011010101111000100111100011100010101011110010100000000000e243",64,
"-1.010100011110000001010101001001001101010110111000011100000000000e498",64,
- GMP_RNDN);
+ MPFR_RNDN);
check2b("1.00101100010101000011010000011000111111011110010111000000000000000000000000000000000000000000000000000000000e178",108,
"-1.10101101010101000110011011111001001101111111110000100000000e160",60,
"1.00101100010100111100100011000011111001000010011101110010000000001111100000000000000000000000000000000000e178",105,
- GMP_RNDN);
+ MPFR_RNDN);
check2b("1.00110011010100111110011010110100111101110101100100110000000000000000000000000000000000000000000000e559",99,
"-1.011010110100111011100110100110011100000000111010011000000000000000e559",67,
"-1.101111111101011111111111001001100100011100001001100000000000000000000000000000000000000000000e556",94,
- GMP_RNDU);
+ MPFR_RNDU);
check2b("-1.100000111100101001100111011100011011000001101001111100000000000000000000000000e843",79,
"-1.1101101010110000001001000100001100110011000110110111000000000000000000000000000000000000000000e414",95,
"-1.1000001111001010011001110111000110110000011010100000e843",53,
- GMP_RNDD);
+ MPFR_RNDD);
check2b("-1.110110010110100010100011000110111001010000010111110000000000e-415",61,
"-1.0000100101100001111100110011111111110100011101101011000000000000000000e751",71,
"-1.00001001011000011111001100111111111101000111011010110e751",54,
- GMP_RNDN);
+ MPFR_RNDN);
check2b("-1.1011011011110001001101010101001000010100010110111101000000000000000000000e258",74,
"-1.00011100010110110101001011000100100000100010101000010000000000000000000000000000000000000000000000e268",99,
"-1.0001110011001001000011110001000111010110101011110010011011110100000000000000000000000000000000000000e268",101,
- GMP_RNDD);
+ MPFR_RNDD);
check2b("-1.1011101010011101011000000100100110101101101110000001000000000e629",62,
"1.111111100000011100100011100000011101100110111110111000000000000000000000000000000000000000000e525",94,
"-1.101110101001110101100000010010011010110110111000000011111111111111111111111111111111111111111111111111101e629",106,
- GMP_RNDD);
+ MPFR_RNDD);
check2b("1.111001000010001100010000001100000110001011110111011000000000000000000000000000000000000e152",88,
"1.111110111001100100000100111111010111000100111111001000000000000000e152",67,
"1.1110111111011110000010101001011011101010000110110100e153",53,
- GMP_RNDN);
+ MPFR_RNDN);
check2b("1.000001100011110010110000110100001010101101111011110100e696",55,
"-1.1011001111011100100001011110100101010101110111010101000000000000000000000000000000000000000000000000000000000000e730",113,
"-1.1011001111011100100001011110100100010100010011100010e730",53,
- GMP_RNDN);
+ MPFR_RNDN);
check2b("-1.11010111100001001111000001110101010010001111111001100000000000000000000000000000000000000000000000000000000000e530",111,
"1.01110100010010000000010110111101011101000001111101100000000000000000000000000000000000000000000000e530",99,
"-1.1000110011110011101010101101111101010011011111000000000000000e528",62,
- GMP_RNDD);
+ MPFR_RNDD);
check2b("-1.0001100010010100111101101011101000100100010011100011000000000000000000000000000000000000000000000000000000000e733",110,
"-1.001000000111110010100101010100110111001111011011001000000000000000000000000000000000000000000000000000000000e710",109,
"-1.000110001001010011111000111110110001110110011000110110e733",55,
- GMP_RNDN);
+ MPFR_RNDN);
check2b("-1.1101011110000100111100000111010101001000111111100110000000000000000000000e530",74,
"1.01110100010010000000010110111101011101000001111101100000000000000000000000000000000000000000000000000000000000e530",111,
"-1.10001100111100111010101011011111010100110111110000000000000000000000000000e528",75,
- GMP_RNDU);
+ MPFR_RNDU);
check2b("1.00110011010100111110011010110100111101110101100100110000000000000000000000000000000000000000000000e559",99,
"-1.011010110100111011100110100110011100000000111010011000000000000000e559",67,
"-1.101111111101011111111111001001100100011100001001100000000000000000000000000000000000000000000e556",94,
- GMP_RNDU);
+ MPFR_RNDU);
check2b("-1.100101111110110000000110111111011010011101101111100100000000000000e-624",67,
"1.10111010101110100000010110101000000000010011100000100000000e-587",60,
"1.1011101010111010000001011010011111110100011110001011111111001000000100101100010010000011100000000000000000000e-587",110,
- GMP_RNDU);
+ MPFR_RNDU);
check2b("-1.10011001000010100000010100100110110010011111101111000000000000000000000000000000000000000000000000000000000000000000e-172",117,
"1.111011100000101010110000100100110100100001001000011100000000e-173",61,
"-1.0100010000001001010110011011101001001011101011110001000000000000000e-173",68,
- GMP_RNDZ);
+ MPFR_RNDZ);
check2b("1.1000111000110010101001010011010011101100010110001001000000000000000000000000000000000000000000000000e167",101,
"1.0011110010000110000000101100100111000001110110110000000000000000000000000e167",74,
"1.01100101010111000101001111111111010101110001100111001000000000000000000000000000000000000000000000000000e168",105,
- GMP_RNDZ);
+ MPFR_RNDZ);
check2b("1.100101111111110010100101110111100001110000100001010000000000000000000000000000000000000000000000e808",97,
"-1.1110011001100000100000111111110000110010100111001011000000000000000000000000000000e807",83,
"1.01001001100110001100011111000000000001011010010111010000000000000000000000000000000000000000000e807",96,
- GMP_RNDN);
+ MPFR_RNDN);
check2b("1e128",128,
"1e0",128,
"100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001e0",256,
- GMP_RNDN);
+ MPFR_RNDN);
/* Checking double precision (53 bits) */
- check53("-8.22183238641455905806e-19", "7.42227178769761587878e-19",GMP_RNDD,
+ check53("-8.22183238641455905806e-19", "7.42227178769761587878e-19",MPFR_RNDD,
"-7.9956059871694317927e-20");
- check53("5.82106394662028628236e+234","-5.21514064202368477230e+89",GMP_RNDD,
+ check53("5.82106394662028628236e+234","-5.21514064202368477230e+89",MPFR_RNDD,
"5.8210639466202855763e234");
check53("5.72931679569871602371e+122","-5.72886070363264321230e+122",
- GMP_RNDN, "4.5609206607281141508e118");
+ MPFR_RNDN, "4.5609206607281141508e118");
check53("-5.09937369394650450820e+238", "2.70203299854862982387e+250",
- GMP_RNDD, "2.7020329985435301323e250");
- check53("-2.96695924472363684394e+27", "1.22842938251111500000e+16",GMP_RNDD,
+ MPFR_RNDD, "2.7020329985435301323e250");
+ check53("-2.96695924472363684394e+27", "1.22842938251111500000e+16",MPFR_RNDD,
"-2.96695924471135255027e27");
check53("1.74693641655743793422e-227", "-7.71776956366861843469e-229",
- GMP_RNDN, "1.669758720920751867e-227");
+ MPFR_RNDN, "1.669758720920751867e-227");
/* x = -7883040437021647.0; for (i=0; i<468; i++) x = x / 2.0;*/
check53("-1.03432206392780011159e-125", "1.30127034799251347548e-133",
- GMP_RNDN,
+ MPFR_RNDN,
"-1.0343220509150965661100887242027378881805094180354e-125");
- check53("1.05824655795525779205e+71", "-1.06022698059744327881e+71",GMP_RNDZ,
+ check53("1.05824655795525779205e+71", "-1.06022698059744327881e+71",MPFR_RNDZ,
"-1.9804226421854867632e68");
check53("-5.84204911040921732219e+240", "7.26658169050749590763e+240",
- GMP_RNDD, "1.4245325800982785854e240");
- check53("1.00944884131046636376e+221","2.33809162651471520268e+215",GMP_RNDN,
+ MPFR_RNDD, "1.4245325800982785854e240");
+ check53("1.00944884131046636376e+221","2.33809162651471520268e+215",MPFR_RNDN,
"1.0094511794020929787e221");
/*x = 7045852550057985.0; for (i=0; i<986; i++) x = x / 2.0;*/
check53("4.29232078932667367325e-278",
"1.0773525047389793833221116707010783793203080117586e-281"
- , GMP_RNDU, "4.2933981418314132787e-278");
- check53("5.27584773801377058681e-80", "8.91207657803547196421e-91", GMP_RNDN,
+ , MPFR_RNDU, "4.2933981418314132787e-278");
+ check53("5.27584773801377058681e-80", "8.91207657803547196421e-91", MPFR_RNDN,
"5.2758477381028917269e-80");
check53("2.99280481918991653800e+272", "5.34637717585790933424e+271",
- GMP_RNDN, "3.5274425367757071711e272");
+ MPFR_RNDN, "3.5274425367757071711e272");
check53("4.67302514390488041733e-184", "2.18321376145645689945e-190",
- GMP_RNDN, "4.6730273271186420541e-184");
- check53("5.57294120336300389254e+71", "2.60596167942024924040e+65", GMP_RNDZ,
+ MPFR_RNDN, "4.6730273271186420541e-184");
+ check53("5.57294120336300389254e+71", "2.60596167942024924040e+65", MPFR_RNDZ,
"5.5729438093246831053e71");
- check53("6.6052588496951015469e24", "4938448004894539.0", GMP_RNDU,
+ check53("6.6052588496951015469e24", "4938448004894539.0", MPFR_RNDU,
"6.6052588546335505068e24");
check53("1.23056185051606761523e-190", "1.64589756643433857138e-181",
- GMP_RNDU, "1.6458975676649006598e-181");
+ MPFR_RNDU, "1.6458975676649006598e-181");
check53("2.93231171510175981584e-280", "3.26266919161341483877e-273",
- GMP_RNDU, "3.2626694848445867288e-273");
- check53("5.76707395945001907217e-58", "4.74752971449827687074e-51", GMP_RNDD,
+ MPFR_RNDU, "3.2626694848445867288e-273");
+ check53("5.76707395945001907217e-58", "4.74752971449827687074e-51", MPFR_RNDD,
"4.747530291205672325e-51");
- check53("277363943109.0", "11.0", GMP_RNDN, "277363943120.0");
+ check53("277363943109.0", "11.0", MPFR_RNDN, "277363943120.0");
check53("1.44791789689198883921e-140", "-1.90982880222349071284e-121",
- GMP_RNDN, "-1.90982880222349071e-121");
+ MPFR_RNDN, "-1.90982880222349071e-121");
/* tests for particular cases (Vincent Lefevre, 22 Aug 2001) */
- check53("9007199254740992.0", "1.0", GMP_RNDN, "9007199254740992.0");
- check53("9007199254740994.0", "1.0", GMP_RNDN, "9007199254740996.0");
- check53("9007199254740992.0", "-1.0", GMP_RNDN, "9007199254740991.0");
- check53("9007199254740994.0", "-1.0", GMP_RNDN, "9007199254740992.0");
- check53("9007199254740996.0", "-1.0", GMP_RNDN, "9007199254740996.0");
+ check53("9007199254740992.0", "1.0", MPFR_RNDN, "9007199254740992.0");
+ check53("9007199254740994.0", "1.0", MPFR_RNDN, "9007199254740996.0");
+ check53("9007199254740992.0", "-1.0", MPFR_RNDN, "9007199254740991.0");
+ check53("9007199254740994.0", "-1.0", MPFR_RNDN, "9007199254740992.0");
+ check53("9007199254740996.0", "-1.0", MPFR_RNDN, "9007199254740996.0");
check_overflow ();
check_1111 ();
diff --git a/tests/tadd1sp.c b/tests/tadd1sp.c
index 0ff9ef2b8..60fa56367 100644
--- a/tests/tadd1sp.c
+++ b/tests/tadd1sp.c
@@ -44,8 +44,8 @@ check_overflow (void)
mpfr_set_str1 (x, "8.00468257869324898448e+307");
mpfr_set_str1 (y, "7.44784712422708645156e+307");
- mpfr_add1sp (z1, x, y, GMP_RNDN);
- mpfr_add1 (z2, x, y, GMP_RNDN);
+ mpfr_add1sp (z1, x, y, MPFR_RNDN);
+ mpfr_add1 (z2, x, y, MPFR_RNDN);
if (mpfr_cmp (z1, z2))
{
printf ("Overflow bug in add1sp.\n");
@@ -122,7 +122,7 @@ check_random (mp_prec_t p)
if (MPFR_GET_EXP(b) < MPFR_GET_EXP(c))
mpfr_swap(b, c);
if (MPFR_IS_PURE_FP(b) && MPFR_IS_PURE_FP(c))
- for (r = 0 ; r < GMP_RND_MAX ; r++)
+ for (r = 0 ; r < MPFR_RND_MAX ; r++)
{
inexact1 = mpfr_add1(a1, b, c, (mp_rnd_t) r);
inexact2 = mpfr_add1sp(a2, b, c, (mp_rnd_t) r);
@@ -147,7 +147,7 @@ check_special (void)
mpfr_inits (a1, a2, b, c, (mpfr_ptr) 0);
- for (r = 0 ; r < GMP_RND_MAX ; r++)
+ for (r = 0 ; r < MPFR_RND_MAX ; r++)
{
SET_PREC(53);
mpfr_set_str1 (b, "1@100");
@@ -174,7 +174,7 @@ check_special (void)
mpfr_set_str_binary (c, "1.0e1");
mpfr_set_str_binary (a2, "1.1e-1");
mpfr_set_str_binary (a1, "0.11E2");
- mpfr_add1sp (a2, c, a2, GMP_RNDN);
+ mpfr_add1sp (a2, c, a2, MPFR_RNDN);
if (mpfr_cmp (a1, a2))
{
printf ("Regression reuse test failed!\n");
diff --git a/tests/tadd_d.c b/tests/tadd_d.c
index 7b8224c46..26e4dc61e 100644
--- a/tests/tadd_d.c
+++ b/tests/tadd_d.c
@@ -40,24 +40,24 @@ check_regulars (void)
mpfr_init2 (y, IEEE_DBL_MANT_DIG);
mpfr_init2 (z, IEEE_DBL_MANT_DIG);
- mpfr_set_str (y, "4096", 10, GMP_RNDN);
+ mpfr_set_str (y, "4096", 10, MPFR_RNDN);
d = 0.125;
mpfr_clear_flags ();
- inexact = mpfr_add_d (x, y, d, GMP_RNDN);
+ inexact = mpfr_add_d (x, y, d, MPFR_RNDN);
if (inexact != 0)
{
printf ("Inexact flag error in mpfr_add_d (1)\n");
exit (1);
}
- mpfr_set_str (z, "4096.125", 10, GMP_RNDN);
+ mpfr_set_str (z, "4096.125", 10, MPFR_RNDN);
if (mpfr_cmp (z, x))
{
printf ("Error in mpfr_add_d (");
- mpfr_out_str (stdout, 10, 7, y, GMP_RNDN);
+ mpfr_out_str (stdout, 10, 7, y, MPFR_RNDN);
printf (" + %.20g)\nexpected ", d);
- mpfr_out_str (stdout, 10, 0, z, GMP_RNDN);
+ mpfr_out_str (stdout, 10, 0, z, MPFR_RNDN);
printf ("\ngot ");
- mpfr_out_str (stdout, 10, 0, x, GMP_RNDN);
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN);
printf ("\n");
exit (1);
}
@@ -67,21 +67,21 @@ check_regulars (void)
mpfr_set_prec (z, 2);
mpfr_clear_flags ();
- inexact = mpfr_add_d (x, y, d, GMP_RNDN);
+ inexact = mpfr_add_d (x, y, d, MPFR_RNDN);
if (inexact == 0)
{
printf ("Inexact flag error in mpfr_add_d (2)\n");
exit (1);
}
- mpfr_set_str (z, "4096.125", 10, GMP_RNDN);
+ mpfr_set_str (z, "4096.125", 10, MPFR_RNDN);
if (mpfr_cmp (z, x))
{
printf ("Error in mpfr_add_d (");
- mpfr_out_str (stdout, 10, 0, y, GMP_RNDN);
+ mpfr_out_str (stdout, 10, 0, y, MPFR_RNDN);
printf (" + %.20g)\nexpected ", d);
- mpfr_out_str (stdout, 10, 0, z, GMP_RNDN);
+ mpfr_out_str (stdout, 10, 0, z, MPFR_RNDN);
printf ("\ngot ");
- mpfr_out_str (stdout, 10, 0, x, GMP_RNDN);
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN);
printf ("\n");
exit (1);
}
@@ -101,7 +101,7 @@ check_nans (void)
/* nan + 1.0 is nan */
mpfr_set_nan (x);
mpfr_clear_flags ();
- inexact = mpfr_add_d (y, x, 1.0, GMP_RNDN);
+ inexact = mpfr_add_d (y, x, 1.0, MPFR_RNDN);
MPFR_ASSERTN (inexact == 0);
MPFR_ASSERTN ((__gmpfr_flags ^ MPFR_FLAGS_NAN) == 0);
MPFR_ASSERTN (mpfr_nan_p (y));
@@ -109,7 +109,7 @@ check_nans (void)
/* +inf + 1.0 == +inf */
mpfr_set_inf (x, 1);
mpfr_clear_flags ();
- inexact = mpfr_add_d (y, x, 1.0, GMP_RNDN);
+ inexact = mpfr_add_d (y, x, 1.0, MPFR_RNDN);
MPFR_ASSERTN (inexact == 0);
MPFR_ASSERTN (__gmpfr_flags == 0);
MPFR_ASSERTN (mpfr_inf_p (y));
@@ -118,7 +118,7 @@ check_nans (void)
/* -inf + 1.0 == -inf */
mpfr_set_inf (x, -1);
mpfr_clear_flags ();
- inexact = mpfr_add_d (y, x, 1.0, GMP_RNDN);
+ inexact = mpfr_add_d (y, x, 1.0, MPFR_RNDN);
MPFR_ASSERTN (inexact == 0);
MPFR_ASSERTN (__gmpfr_flags == 0);
MPFR_ASSERTN (mpfr_inf_p (y));
diff --git a/tests/tadd_ui.c b/tests/tadd_ui.c
index 6f16fb51b..28fafa906 100644
--- a/tests/tadd_ui.c
+++ b/tests/tadd_ui.c
@@ -38,7 +38,7 @@ check3 (const char *xs, unsigned long y, mp_rnd_t rnd_mode, const char *zs)
if (mpfr_cmp_str1(zz, zs) )
{
printf ("expected sum is %s, got ",zs);
- mpfr_out_str(stdout, 10, 0, zz, GMP_RNDN);
+ mpfr_out_str(stdout, 10, 0, zz, MPFR_RNDN);
printf ("\nmpfr_add_ui failed for x=%s y=%lu with rnd_mode=%s\n",
xs, y, mpfr_print_rnd_mode(rnd_mode));
exit (1);
@@ -54,7 +54,7 @@ special (void)
mpfr_init2 (x, 63);
mpfr_init2 (y, 63);
mpfr_set_str_binary (x, "0.110100000000000001110001110010111111000000000101100011100100011");
- mpfr_add_ui (y, x, 1, GMP_RNDD);
+ mpfr_add_ui (y, x, 1, MPFR_RNDD);
mpfr_clear (x);
mpfr_clear (y);
}
@@ -69,18 +69,18 @@ check_nans (void)
/* nan + 2394875 == nan */
mpfr_set_nan (x);
- mpfr_add_ui (y, x, 2394875L, GMP_RNDN);
+ mpfr_add_ui (y, x, 2394875L, MPFR_RNDN);
MPFR_ASSERTN (mpfr_nan_p (y));
/* +inf + 2394875 == +inf */
mpfr_set_inf (x, 1);
- mpfr_add_ui (y, x, 2394875L, GMP_RNDN);
+ mpfr_add_ui (y, x, 2394875L, MPFR_RNDN);
MPFR_ASSERTN (mpfr_inf_p (y));
MPFR_ASSERTN (mpfr_sgn (y) > 0);
/* -inf + 2394875 == -inf */
mpfr_set_inf (x, -1);
- mpfr_add_ui (y, x, 2394875L, GMP_RNDN);
+ mpfr_add_ui (y, x, 2394875L, MPFR_RNDN);
MPFR_ASSERTN (mpfr_inf_p (y));
MPFR_ASSERTN (mpfr_sgn (y) < 0);
@@ -101,13 +101,13 @@ main (int argc, char *argv[])
check_nans ();
special ();
- check3 ("-1.716113812768534e-140", 1271212614, GMP_RNDZ,
+ check3 ("-1.716113812768534e-140", 1271212614, MPFR_RNDZ,
"1.27121261399999976e9");
- check3 ("1.22191250737771397120e+20", 948002822, GMP_RNDN,
+ check3 ("1.22191250737771397120e+20", 948002822, MPFR_RNDN,
"122191250738719408128.0");
- check3 ("-6.72658901114033715233e-165", 2000878121, GMP_RNDZ,
+ check3 ("-6.72658901114033715233e-165", 2000878121, MPFR_RNDZ,
"2.0008781209999997615e9");
- check3 ("-2.0769715792901673e-5", 880524, GMP_RNDN,
+ check3 ("-2.0769715792901673e-5", 880524, MPFR_RNDN,
"8.8052399997923023e5");
test_generic_ui (2, 1000, 100);
diff --git a/tests/tagm.c b/tests/tagm.c
index 1c1d65326..6d1d5aee6 100644
--- a/tests/tagm.c
+++ b/tests/tagm.c
@@ -43,7 +43,7 @@ check4 (const char *as, const char *bs, mp_rnd_t rnd_mode, const char *res)
{
printf ("mpfr_agm failed for a=%s, b=%s, rnd_mode=%d\n",as,bs,rnd_mode);
printf ("expected result is %s, got ",res);
- mpfr_out_str(stdout, 10, 0, tres, GMP_RNDN);
+ mpfr_out_str(stdout, 10, 0, tres, MPFR_RNDN);
putchar('\n');
exit (1);
}
@@ -60,9 +60,9 @@ check_large (void)
mpfr_init2 (b, 82);
mpfr_init2 (agm, 82);
- mpfr_set_ui (a, 1, GMP_RNDN);
+ mpfr_set_ui (a, 1, MPFR_RNDN);
mpfr_set_str_binary (b, "0.1111101100001000000001011000110111101000001011111000100001000101010100011111110010E-39");
- mpfr_agm (agm, a, b, GMP_RNDN);
+ mpfr_agm (agm, a, b, MPFR_RNDN);
mpfr_set_str_binary (a, "0.1110001000111101101010101010101101001010001001001011100101111011110101111001111100E-4");
if (mpfr_cmp (agm, a))
{
@@ -75,16 +75,16 @@ check_large (void)
mpfr_set_prec (a, 268);
mpfr_set_prec (b, 268);
mpfr_set_prec (agm, 268);
- mpfr_set_str (a, "703.93543315330225238487276503953366664991725089988315253092140138947103394917006", 10, GMP_RNDN);
- mpfr_set_str (b, "703.93543315330225238487279020523738740563816490895994499256063816906728642622316", 10, GMP_RNDN);
- mpfr_agm (agm, a, b, GMP_RNDN);
+ mpfr_set_str (a, "703.93543315330225238487276503953366664991725089988315253092140138947103394917006", 10, MPFR_RNDN);
+ mpfr_set_str (b, "703.93543315330225238487279020523738740563816490895994499256063816906728642622316", 10, MPFR_RNDN);
+ mpfr_agm (agm, a, b, MPFR_RNDN);
mpfr_set_prec (a, 18);
mpfr_set_prec (b, 70);
mpfr_set_prec (agm, 67);
mpfr_set_str_binary (a, "0.111001111100101000e8");
mpfr_set_str_binary (b, "0.1101110111100100010100110000010111011011011100110100111001010100100001e10");
- inex = mpfr_agm (agm, a, b, GMP_RNDN);
+ inex = mpfr_agm (agm, a, b, MPFR_RNDN);
mpfr_set_str_binary (b, "0.1111110010011101101100010101011011010010010000001010100011000110011e9");
if (mpfr_cmp (agm, b))
{
@@ -100,10 +100,10 @@ check_large (void)
/* test worst case: 9 consecutive ones after the last bit */
mpfr_set_prec (a, 2);
mpfr_set_prec (b, 2);
- mpfr_set_ui (a, 1, GMP_RNDN);
- mpfr_set_ui (b, 2, GMP_RNDN);
+ mpfr_set_ui (a, 1, MPFR_RNDN);
+ mpfr_set_ui (b, 2, MPFR_RNDN);
mpfr_set_prec (agm, 904);
- mpfr_agm (agm, a, b, GMP_RNDZ);
+ mpfr_agm (agm, a, b, MPFR_RNDZ);
mpfr_clear (a);
mpfr_clear (b);
@@ -120,67 +120,67 @@ check_nans (void)
mpfr_init2 (m, 123L);
/* agm(1,nan) == nan */
- mpfr_set_ui (x, 1L, GMP_RNDN);
+ mpfr_set_ui (x, 1L, MPFR_RNDN);
mpfr_set_nan (y);
- mpfr_agm (m, x, y, GMP_RNDN);
+ mpfr_agm (m, x, y, MPFR_RNDN);
MPFR_ASSERTN (mpfr_nan_p (m));
/* agm(1,+inf) == +inf */
- mpfr_set_ui (x, 1L, GMP_RNDN);
+ mpfr_set_ui (x, 1L, MPFR_RNDN);
mpfr_set_inf (y, 1);
- mpfr_agm (m, x, y, GMP_RNDN);
+ mpfr_agm (m, x, y, MPFR_RNDN);
MPFR_ASSERTN (mpfr_inf_p (m));
MPFR_ASSERTN (mpfr_sgn (m) > 0);
/* agm(+inf,+inf) == +inf */
mpfr_set_inf (x, 1);
mpfr_set_inf (y, 1);
- mpfr_agm (m, x, y, GMP_RNDN);
+ mpfr_agm (m, x, y, MPFR_RNDN);
MPFR_ASSERTN (mpfr_inf_p (m));
MPFR_ASSERTN (mpfr_sgn (m) > 0);
/* agm(-inf,+inf) == nan */
mpfr_set_inf (x, -1);
mpfr_set_inf (y, 1);
- mpfr_agm (m, x, y, GMP_RNDN);
+ mpfr_agm (m, x, y, MPFR_RNDN);
MPFR_ASSERTN (mpfr_nan_p (m));
/* agm(+0,+inf) == nan */
- mpfr_set_ui (x, 0, GMP_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
mpfr_set_inf (y, 1);
- mpfr_agm (m, x, y, GMP_RNDN);
+ mpfr_agm (m, x, y, MPFR_RNDN);
MPFR_ASSERTN (mpfr_nan_p (m));
/* agm(+0,1) == +0 */
- mpfr_set_ui (x, 0, GMP_RNDN);
- mpfr_set_ui (y, 1, GMP_RNDN);
- mpfr_agm (m, x, y, GMP_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_set_ui (y, 1, MPFR_RNDN);
+ mpfr_agm (m, x, y, MPFR_RNDN);
MPFR_ASSERTN (MPFR_IS_ZERO (m) && MPFR_IS_POS(m));
/* agm(-0,1) == +0 */
- mpfr_set_ui (x, 0, GMP_RNDN);
- mpfr_neg (x, x, GMP_RNDN);
- mpfr_set_ui (y, 1, GMP_RNDN);
- mpfr_agm (m, x, y, GMP_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN);
+ mpfr_set_ui (y, 1, MPFR_RNDN);
+ mpfr_agm (m, x, y, MPFR_RNDN);
MPFR_ASSERTN (MPFR_IS_ZERO (m) && MPFR_IS_POS(m));
/* agm(-0,+0) == +0 */
- mpfr_set_ui (x, 0, GMP_RNDN);
- mpfr_neg (x, x, GMP_RNDN);
- mpfr_set_ui (y, 0, GMP_RNDN);
- mpfr_agm (m, x, y, GMP_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN);
+ mpfr_set_ui (y, 0, MPFR_RNDN);
+ mpfr_agm (m, x, y, MPFR_RNDN);
MPFR_ASSERTN (MPFR_IS_ZERO (m) && MPFR_IS_POS(m));
/* agm(1,1) == 1 */
- mpfr_set_ui (x, 1, GMP_RNDN);
- mpfr_set_ui (y, 1, GMP_RNDN);
- mpfr_agm (m, x, y, GMP_RNDN);
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_set_ui (y, 1, MPFR_RNDN);
+ mpfr_agm (m, x, y, MPFR_RNDN);
MPFR_ASSERTN (mpfr_cmp_ui (m ,1) == 0);
/* agm(-1,-2) == NaN */
- mpfr_set_si (x, -1, GMP_RNDN);
- mpfr_set_si (y, -2, GMP_RNDN);
- mpfr_agm (m, x, y, GMP_RNDN);
+ mpfr_set_si (x, -1, MPFR_RNDN);
+ mpfr_set_si (y, -2, MPFR_RNDN);
+ mpfr_agm (m, x, y, MPFR_RNDN);
MPFR_ASSERTN (mpfr_nan_p (m));
mpfr_clear (x);
@@ -202,15 +202,15 @@ main (int argc, char* argv[])
check_nans ();
check_large ();
- check4 ("2.0", "1.0", GMP_RNDN, "1.45679103104690677029");
- check4 ("6.0", "4.0", GMP_RNDN, "4.94936087247260925182");
- check4 ("62.0", "61.0", GMP_RNDN, "6.14989837188450749750e+01");
- check4 ("0.5", "1.0", GMP_RNDN, "7.28395515523453385143e-01");
- check4 ("1.0", "2.0", GMP_RNDN, "1.45679103104690677029");
- check4 ("234375765.0", "234375000.0", GMP_RNDN, "2.3437538249984395504e8");
- check4 ("8.0", "1.0", GMP_RNDU, "3.615756177597362786");
- check4 ("1.0", "44.0", GMP_RNDU, "1.33658354512981247808e1");
- check4 ("1.0", "3.7252902984619140625e-9", GMP_RNDU,
+ check4 ("2.0", "1.0", MPFR_RNDN, "1.45679103104690677029");
+ check4 ("6.0", "4.0", MPFR_RNDN, "4.94936087247260925182");
+ check4 ("62.0", "61.0", MPFR_RNDN, "6.14989837188450749750e+01");
+ check4 ("0.5", "1.0", MPFR_RNDN, "7.28395515523453385143e-01");
+ check4 ("1.0", "2.0", MPFR_RNDN, "1.45679103104690677029");
+ check4 ("234375765.0", "234375000.0", MPFR_RNDN, "2.3437538249984395504e8");
+ check4 ("8.0", "1.0", MPFR_RNDU, "3.615756177597362786");
+ check4 ("1.0", "44.0", MPFR_RNDU, "1.33658354512981247808e1");
+ check4 ("1.0", "3.7252902984619140625e-9", MPFR_RNDU,
"7.55393356971199025907e-02");
test_generic (2, 300, 17);
diff --git a/tests/tasin.c b/tests/tasin.c
index 1472978ed..b27b343a0 100644
--- a/tests/tasin.c
+++ b/tests/tasin.c
@@ -40,7 +40,7 @@ special (void)
/* asin(NaN) = NaN */
mpfr_set_nan (x);
- mpfr_asin (y, x, GMP_RNDN);
+ mpfr_asin (y, x, MPFR_RNDN);
if (!mpfr_nan_p (y))
{
printf ("Error: mpfr_asin (NaN) <> NaN\n");
@@ -49,14 +49,14 @@ special (void)
/* asin(+/-Inf) = NaN */
mpfr_set_inf (x, 1);
- mpfr_asin (y, x, GMP_RNDN);
+ mpfr_asin (y, x, MPFR_RNDN);
if (!mpfr_nan_p (y))
{
printf ("Error: mpfr_asin (+Inf) <> NaN\n");
exit (1);
}
mpfr_set_inf (x, -1);
- mpfr_asin (y, x, GMP_RNDN);
+ mpfr_asin (y, x, MPFR_RNDN);
if (!mpfr_nan_p (y))
{
printf ("Error: mpfr_asin (-Inf) <> NaN\n");
@@ -64,15 +64,15 @@ special (void)
}
/* asin(+/-2) = NaN */
- mpfr_set_ui (x, 2, GMP_RNDN);
- mpfr_asin (y, x, GMP_RNDN);
+ mpfr_set_ui (x, 2, MPFR_RNDN);
+ mpfr_asin (y, x, MPFR_RNDN);
if (!mpfr_nan_p (y))
{
printf ("Error: mpfr_asin (+2) <> NaN\n");
exit (1);
}
- mpfr_set_si (x, -2, GMP_RNDN);
- mpfr_asin (y, x, GMP_RNDN);
+ mpfr_set_si (x, -2, MPFR_RNDN);
+ mpfr_asin (y, x, MPFR_RNDN);
if (!mpfr_nan_p (y))
{
printf ("Error: mpfr_asin (-2) <> NaN\n");
@@ -80,15 +80,15 @@ special (void)
}
/* asin(+/-0) = +/-0 */
- mpfr_set_ui (x, 0, GMP_RNDN);
- mpfr_asin (y, x, GMP_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_asin (y, x, MPFR_RNDN);
if (mpfr_cmp_ui (y, 0) || mpfr_sgn (y) < 0)
{
printf ("Error: mpfr_asin (+0) <> +0\n");
exit (1);
}
- mpfr_neg (x, x, GMP_RNDN);
- mpfr_asin (y, x, GMP_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN);
+ mpfr_asin (y, x, MPFR_RNDN);
if (mpfr_cmp_ui (y, 0) || mpfr_sgn (y) > 0)
{
printf ("Error: mpfr_asin (-0) <> -0\n");
@@ -96,12 +96,12 @@ special (void)
}
/* asin(1) = Pi/2 */
- for (r = 0; r < GMP_RND_MAX; r++)
+ for (r = 0; r < MPFR_RND_MAX; r++)
{
- mpfr_set_ui (x, 1, GMP_RNDN); /* exact */
+ mpfr_set_ui (x, 1, MPFR_RNDN); /* exact */
mpfr_asin (y, x, (mp_rnd_t) r);
mpfr_const_pi (x, (mp_rnd_t) r);
- mpfr_div_2exp (x, x, 1, GMP_RNDN); /* exact */
+ mpfr_div_2exp (x, x, 1, MPFR_RNDN); /* exact */
if (mpfr_cmp (x, y))
{
printf ("Error: asin(1) != Pi/2 for rnd=%s\n",
@@ -111,13 +111,13 @@ special (void)
}
/* asin(-1) = -Pi/2 */
- for (r = 0; r < GMP_RND_MAX; r++)
+ for (r = 0; r < MPFR_RND_MAX; r++)
{
- mpfr_set_si (x, -1, GMP_RNDN); /* exact */
+ mpfr_set_si (x, -1, MPFR_RNDN); /* exact */
mpfr_asin (y, x, (mp_rnd_t) r);
mpfr_const_pi (x, MPFR_INVERT_RND((mp_rnd_t) r));
- mpfr_neg (x, x, GMP_RNDN); /* exact */
- mpfr_div_2exp (x, x, 1, GMP_RNDN); /* exact */
+ mpfr_neg (x, x, MPFR_RNDN); /* exact */
+ mpfr_div_2exp (x, x, 1, MPFR_RNDN); /* exact */
if (mpfr_cmp (x, y))
{
printf ("Error: asin(-1) != -Pi/2 for rnd=%s\n",
@@ -130,7 +130,7 @@ special (void)
mpfr_set_prec (y, 32);
mpfr_set_str_binary (x, "0.1101110111111111001011101000101");
- mpfr_asin (x, x, GMP_RNDN);
+ mpfr_asin (x, x, MPFR_RNDN);
mpfr_set_str_binary (y, "1.00001100101011000001111100111");
if (mpfr_cmp (x, y))
{
@@ -139,7 +139,7 @@ special (void)
}
mpfr_set_str_binary (x, "-0.01110111000011101010111100000101");
- mpfr_asin (x, x, GMP_RNDN);
+ mpfr_asin (x, x, MPFR_RNDN);
mpfr_set_str_binary (y, "-0.0111101111010100011111110101");
if (mpfr_cmp (x, y))
{
@@ -152,7 +152,7 @@ special (void)
mpfr_set_prec (x, 9);
mpfr_set_prec (y, 19);
mpfr_set_str_binary (x, "0.110000000E-6");
- mpfr_asin (y, x, GMP_RNDD);
+ mpfr_asin (y, x, MPFR_RNDD);
mpfr_set_prec (x, 19);
mpfr_set_str_binary (x, "0.1100000000000001001E-6");
if (mpfr_cmp (x, y))
@@ -181,9 +181,9 @@ special_overflow (void)
mpfr_init2 (x, 24);
mpfr_init2 (y, 48);
mpfr_set_str_binary (x, "0.101100100000000000110100E0");
- mpfr_asin (y, x, GMP_RNDN);
+ mpfr_asin (y, x, MPFR_RNDN);
if (mpfr_cmp_str (y, "0.110001001101001111110000010110001000111011001000E0",
- 2, GMP_RNDN))
+ 2, MPFR_RNDN))
{
printf("Special Overflow error.\n");
mpfr_dump (y);
@@ -204,15 +204,15 @@ test20071215 (void)
mpfr_init (x);
mpfr_init (y);
- mpfr_set_ui (x, 0, GMP_RNDN);
- mpfr_neg (x, x, GMP_RNDN);
- mpfr_set_ui (y, 1, GMP_RNDN);
- mpfr_asin (y, x, GMP_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN);
+ mpfr_set_ui (y, 1, MPFR_RNDN);
+ mpfr_asin (y, x, MPFR_RNDN);
MPFR_ASSERTN(mpfr_zero_p (y) && MPFR_IS_NEG(y));
- mpfr_set_ui (x, 0, GMP_RNDN);
- mpfr_set_si (y, -1, GMP_RNDN);
- mpfr_asin (y, x, GMP_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_set_si (y, -1, MPFR_RNDN);
+ mpfr_asin (y, x, MPFR_RNDN);
MPFR_ASSERTN(mpfr_zero_p (y) && MPFR_IS_POS(y));
mpfr_clear (x);
diff --git a/tests/tasinh.c b/tests/tasinh.c
index c10f6a927..1734c9aee 100644
--- a/tests/tasinh.c
+++ b/tests/tasinh.c
@@ -37,8 +37,8 @@ special (void)
mpfr_init (y);
MPFR_SET_INF(x);
- mpfr_set_ui (y, 1, GMP_RNDN);
- mpfr_asinh (x, y, GMP_RNDN);
+ mpfr_set_ui (y, 1, MPFR_RNDN);
+ mpfr_asinh (x, y, MPFR_RNDN);
if (MPFR_IS_INF(x) || MPFR_IS_NAN(x) )
{
printf ("Inf flag not clears in asinh!\n");
@@ -46,7 +46,7 @@ special (void)
}
MPFR_SET_NAN(x);
- mpfr_asinh (x, y, GMP_RNDN);
+ mpfr_asinh (x, y, MPFR_RNDN);
if (MPFR_IS_NAN(x) || MPFR_IS_INF(x))
{
printf ("NAN flag not clears in asinh!\n");
@@ -54,15 +54,15 @@ special (void)
}
/* asinh(+0) = +0, asinh(-0) = -0 */
- mpfr_set_ui (x, 0, GMP_RNDN);
- mpfr_asinh (y, x, GMP_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_asinh (y, x, MPFR_RNDN);
if (mpfr_cmp_ui (y, 0) || mpfr_sgn (y) < 0)
{
printf ("Error: mpfr_asinh(+0) <> +0\n");
exit (1);
}
- mpfr_neg (x, x, GMP_RNDN);
- mpfr_asinh (y, x, GMP_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN);
+ mpfr_asinh (y, x, MPFR_RNDN);
if (mpfr_cmp_ui (y, 0) || mpfr_sgn (y) > 0)
{
printf ("Error: mpfr_asinh(-0) <> -0\n");
@@ -70,7 +70,7 @@ special (void)
}
MPFR_SET_NAN(x);
- mpfr_asinh (y, x, GMP_RNDN);
+ mpfr_asinh (y, x, MPFR_RNDN);
if (!mpfr_nan_p (y))
{
printf ("Error: mpfr_asinh(NaN) <> NaN\n");
@@ -78,7 +78,7 @@ special (void)
}
mpfr_set_inf (x, 1);
- mpfr_asinh (y, x, GMP_RNDN);
+ mpfr_asinh (y, x, MPFR_RNDN);
if (!mpfr_inf_p (y) || mpfr_sgn (y) < 0)
{
printf ("Error: mpfr_asinh(+Inf) <> +Inf\n");
@@ -86,7 +86,7 @@ special (void)
}
mpfr_set_inf (x, -1);
- mpfr_asinh (y, x, GMP_RNDN);
+ mpfr_asinh (y, x, MPFR_RNDN);
if (!mpfr_inf_p (y) || mpfr_sgn (y) > 0)
{
printf ("Error: mpfr_asinh(-Inf) <> -Inf\n");
@@ -97,7 +97,7 @@ special (void)
mpfr_set_prec (y, 32);
mpfr_set_str_binary (x, "0.1010100100111011001111100101E-1");
- mpfr_asinh (x, x, GMP_RNDN);
+ mpfr_asinh (x, x, MPFR_RNDN);
mpfr_set_str_binary (y, "0.10100110010010101101010011011101E-1");
if (!mpfr_equal_p (x, y))
{
@@ -106,7 +106,7 @@ special (void)
}
mpfr_set_str_binary (x, "-.10110011011010111110010001100001");
- mpfr_asinh (x, x, GMP_RNDN);
+ mpfr_asinh (x, x, MPFR_RNDN);
mpfr_set_str_binary (y, "-.10100111010000111001011100110011");
if (!mpfr_equal_p (x, y))
{
@@ -117,7 +117,7 @@ special (void)
mpfr_set_prec (x, 33);
mpfr_set_prec (y, 43);
mpfr_set_str_binary (x, "0.111001101100000110011001010000101");
- mpfr_asinh (y, x, GMP_RNDZ);
+ mpfr_asinh (y, x, MPFR_RNDZ);
mpfr_init2 (z, 43);
mpfr_set_str_binary (z, "0.1100111101010101101010101110000001000111001");
if (!mpfr_equal_p (y, z))
@@ -128,10 +128,10 @@ special (void)
mpfr_set_prec (x, 53);
mpfr_set_prec (y, 2);
- mpfr_set_str (x, "1.8000000000009@-6", 16, GMP_RNDN);
- mpfr_asinh (y, x, GMP_RNDZ);
+ mpfr_set_str (x, "1.8000000000009@-6", 16, MPFR_RNDN);
+ mpfr_asinh (y, x, MPFR_RNDZ);
mpfr_set_prec (z, 2);
- mpfr_set_str (z, "1.0@-6", 16, GMP_RNDN);
+ mpfr_set_str (z, "1.0@-6", 16, MPFR_RNDN);
if (!mpfr_equal_p (y, z))
{
printf ("Error: mpfr_asinh (4)\n");
diff --git a/tests/tatan.c b/tests/tatan.c
index 9be20b2cc..93bb03f7b 100644
--- a/tests/tatan.c
+++ b/tests/tatan.c
@@ -38,22 +38,22 @@ special (void)
mpfr_set_str_binary (x, "1.0000100110000001100111100011001110101110100111011101");
mpfr_set_str_binary (y, "1.1001101101110100101100110011011101101000011010111110e-1");
- mpfr_atan (z, x, GMP_RNDN);
+ mpfr_atan (z, x, MPFR_RNDN);
if (mpfr_cmp (y, z))
{
- printf ("Error in mpfr_atan for prec=53, rnd=GMP_RNDN\n");
+ printf ("Error in mpfr_atan for prec=53, rnd=MPFR_RNDN\n");
printf ("x=");
- mpfr_out_str (stdout, 2, 0, x, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN);
printf ("\nexpected ");
- mpfr_out_str (stdout, 2, 0, y, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN);
printf ("\ngot ");
- mpfr_out_str (stdout, 2, 0, z, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, z, MPFR_RNDN);
printf ("\n");
exit (1);
}
/* atan(+Inf) = Pi/2 */
- for (r = 0; r < GMP_RND_MAX ; r++)
+ for (r = 0; r < MPFR_RND_MAX ; r++)
{
mpfr_set_inf (x, 1);
mpfr_atan (y, x, (mp_rnd_t) r);
@@ -68,7 +68,7 @@ special (void)
}
/* atan(-Inf) = - Pi/2 */
- for (r = 0; r < GMP_RND_MAX ; r++)
+ for (r = 0; r < MPFR_RND_MAX ; r++)
{
mpfr_set_inf (x, -1);
mpfr_atan (y, x, (mp_rnd_t) r);
@@ -85,7 +85,7 @@ special (void)
/* atan(NaN) = NaN */
mpfr_set_nan (x);
- mpfr_atan (y, x, GMP_RNDN);
+ mpfr_atan (y, x, MPFR_RNDN);
if (!mpfr_nan_p (y))
{
printf ("Error: mpfr_atan(NaN) <> NaN\n");
@@ -93,29 +93,29 @@ special (void)
}
/* atan(+/-0) = +/-0 */
- mpfr_set_ui (x, 0, GMP_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
MPFR_SET_NEG (y);
- mpfr_atan (y, x, GMP_RNDN);
+ mpfr_atan (y, x, MPFR_RNDN);
if (mpfr_cmp_ui (y, 0) || MPFR_IS_NEG (y))
{
printf ("Error: mpfr_atan (+0) <> +0\n");
exit (1);
}
- mpfr_atan (x, x, GMP_RNDN);
+ mpfr_atan (x, x, MPFR_RNDN);
if (mpfr_cmp_ui (x, 0) || MPFR_IS_NEG (x))
{
printf ("Error: mpfr_atan (+0) <> +0 (in place)\n");
exit (1);
}
- mpfr_neg (x, x, GMP_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN);
MPFR_SET_POS (y);
- mpfr_atan (y, x, GMP_RNDN);
+ mpfr_atan (y, x, MPFR_RNDN);
if (mpfr_cmp_ui (y, 0) || MPFR_IS_POS (y))
{
printf ("Error: mpfr_atan (-0) <> -0\n");
exit (1);
}
- mpfr_atan (x, x, GMP_RNDN);
+ mpfr_atan (x, x, MPFR_RNDN);
if (mpfr_cmp_ui (x, 0) || MPFR_IS_POS (x))
{
printf ("Error: mpfr_atan (-0) <> -0 (in place)\n");
@@ -127,7 +127,7 @@ special (void)
/* test one random positive argument */
mpfr_set_str_binary (x, "0.10000100001100101001001001011001");
- mpfr_atan (x, x, GMP_RNDN);
+ mpfr_atan (x, x, MPFR_RNDN);
mpfr_set_str_binary (y, "0.1111010000001111001111000000011E-1");
if (mpfr_cmp (x, y))
{
@@ -137,7 +137,7 @@ special (void)
/* test one random negative argument */
mpfr_set_str_binary (x, "-0.1100001110110000010101011001011");
- mpfr_atan (x, x, GMP_RNDN);
+ mpfr_atan (x, x, MPFR_RNDN);
mpfr_set_str_binary (y, "-0.101001110001010010110001110001");
if (mpfr_cmp (x, y))
{
@@ -151,7 +151,7 @@ special (void)
mpfr_set_prec (y, 192);
mpfr_set_prec (z, 192);
mpfr_set_str_binary (x, "-0.100e1");
- mpfr_atan (z, x, GMP_RNDD);
+ mpfr_atan (z, x, MPFR_RNDD);
mpfr_set_str_binary (y, "-0.110010010000111111011010101000100010000101101000110000100011010011000100110001100110001010001011100000001101110000011100110100010010100100000010010011100000100010001010011001111100110001110101");
if (mpfr_cmp (z, y))
{
@@ -166,9 +166,9 @@ special (void)
mpfr_set_prec (y, 51);
mpfr_set_str_binary (x,
"0.101100100000101111111010001111111000001000000000000E-11");
- i = mpfr_atan (y, x, GMP_RNDN);
+ i = mpfr_atan (y, x, MPFR_RNDN);
if (mpfr_cmp_str (y,
- "1.01100100000101111111001110011001010110100100000000e-12", 2, GMP_RNDN)
+ "1.01100100000101111111001110011001010110100100000000e-12", 2, MPFR_RNDN)
|| i >= 0)
{
printf ("Wrong Regression test (%d)\n", i);
@@ -176,16 +176,16 @@ special (void)
exit (1);
}
- mpfr_set_si (x, -1, GMP_RNDN);
- mpfr_atan (x, x, GMP_RNDN);
+ mpfr_set_si (x, -1, MPFR_RNDN);
+ mpfr_atan (x, x, MPFR_RNDN);
MPFR_ASSERTN (MPFR_IS_NEG (x));
/* Test regression */
mpfr_set_prec (x, 48);
mpfr_set_prec (y, 48);
mpfr_set_str_binary (x, "1.11001110010000011111100000010000000000000000000e-19");
- mpfr_atan (y, x, GMP_RNDD);
- if (mpfr_cmp_str (y, "0.111001110010000011111100000001111111110000010011E-18", 2, GMP_RNDN))
+ mpfr_atan (y, x, MPFR_RNDD);
+ if (mpfr_cmp_str (y, "0.111001110010000011111100000001111111110000010011E-18", 2, MPFR_RNDN))
{
printf ("Error in mpfr_atan (4)\n");
printf ("Input 1.11001110010000011111100000010000000000000000000e-19 [prec=48]\n");
@@ -201,7 +201,7 @@ special (void)
#define TEST_FUNCTION mpfr_atan
#define test_generic test_generic_atan
-#define RAND_FUNCTION(x) (mpfr_urandomb (x, RANDS), mpfr_mul_2si (x, x, (randlimb () %1000-500), GMP_RNDN))
+#define RAND_FUNCTION(x) (mpfr_urandomb (x, RANDS), mpfr_mul_2si (x, x, (randlimb () %1000-500), MPFR_RNDN))
#include "tgeneric.c"
#define TEST_FUNCTION mpfr_atan2
@@ -229,9 +229,9 @@ special_overflow (void)
mpfr_init2 (x, 24);
mpfr_init2 (y, 48);
mpfr_set_str_binary (x, "0.101101010001001101111010E0");
- mpfr_atan (y, x, GMP_RNDN);
+ mpfr_atan (y, x, MPFR_RNDN);
if (mpfr_cmp_str (y, "0.100111011001100111000010111101000111010101011110E0",
- 2, GMP_RNDN))
+ 2, MPFR_RNDN))
{
printf("Special Overflow error.\n");
mpfr_dump (y);
@@ -251,103 +251,103 @@ special_atan2 (void)
mpfr_inits2 (4, x, y, z, (mpfr_ptr) 0);
/* Anything with NAN should be set to NAN */
- mpfr_set_ui (y, 0, GMP_RNDN);
+ mpfr_set_ui (y, 0, MPFR_RNDN);
mpfr_set_nan (x);
- mpfr_atan2 (z, y, x, GMP_RNDN);
+ mpfr_atan2 (z, y, x, MPFR_RNDN);
MPFR_ASSERTN (MPFR_IS_NAN (z));
mpfr_swap (x, y);
- mpfr_atan2 (z, y, x, GMP_RNDN);
+ mpfr_atan2 (z, y, x, MPFR_RNDN);
MPFR_ASSERTN (MPFR_IS_NAN (z));
/* 0+ 0+ --> 0+ */
- mpfr_set_ui (y, 0, GMP_RNDN);
- mpfr_atan2 (z, y, x, GMP_RNDN);
+ mpfr_set_ui (y, 0, MPFR_RNDN);
+ mpfr_atan2 (z, y, x, MPFR_RNDN);
MPFR_ASSERTN (MPFR_IS_ZERO (z) && MPFR_IS_POS (z));
/* 0- 0+ --> 0- */
MPFR_CHANGE_SIGN (y);
- mpfr_atan2 (z, y, x, GMP_RNDN);
+ mpfr_atan2 (z, y, x, MPFR_RNDN);
MPFR_ASSERTN (MPFR_IS_ZERO (z) && MPFR_IS_NEG (z));
/* 0- 0- --> -PI */
MPFR_CHANGE_SIGN (x);
- mpfr_atan2 (z, y, x, GMP_RNDN);
- MPFR_ASSERTN (mpfr_cmp_str (z, "-3.1415", 10, GMP_RNDN) == 0);
+ mpfr_atan2 (z, y, x, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_cmp_str (z, "-3.1415", 10, MPFR_RNDN) == 0);
/* 0+ 0- --> +PI */
MPFR_CHANGE_SIGN (y);
- mpfr_atan2 (z, y, x, GMP_RNDN);
- MPFR_ASSERTN (mpfr_cmp_str (z, "3.1415", 10, GMP_RNDN) == 0);
+ mpfr_atan2 (z, y, x, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_cmp_str (z, "3.1415", 10, MPFR_RNDN) == 0);
/* 0+ -1 --> PI */
- mpfr_set_si (x, -1, GMP_RNDN);
- mpfr_atan2 (z, y, x, GMP_RNDN);
- MPFR_ASSERTN (mpfr_cmp_str (z, "3.1415", 10, GMP_RNDN) == 0);
+ mpfr_set_si (x, -1, MPFR_RNDN);
+ mpfr_atan2 (z, y, x, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_cmp_str (z, "3.1415", 10, MPFR_RNDN) == 0);
/* 0- -1 --> -PI */
MPFR_CHANGE_SIGN (y);
- mpfr_atan2 (z, y, x, GMP_RNDN);
- MPFR_ASSERTN (mpfr_cmp_str (z, "-3.1415", 10, GMP_RNDN) == 0);
+ mpfr_atan2 (z, y, x, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_cmp_str (z, "-3.1415", 10, MPFR_RNDN) == 0);
/* 0- +1 --> 0- */
- mpfr_set_ui (x, 1, GMP_RNDN);
- mpfr_atan2 (z, y, x, GMP_RNDN);
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_atan2 (z, y, x, MPFR_RNDN);
MPFR_ASSERTN (MPFR_IS_ZERO (z) && MPFR_IS_NEG (z));
/* 0+ +1 --> 0+ */
MPFR_CHANGE_SIGN (y);
- mpfr_atan2 (z, y, x, GMP_RNDN);
+ mpfr_atan2 (z, y, x, MPFR_RNDN);
MPFR_ASSERTN (MPFR_IS_ZERO (z) && MPFR_IS_POS (z));
/* +1 0+ --> PI/2 */
mpfr_swap (x, y);
- mpfr_atan2 (z, y, x, GMP_RNDN);
- MPFR_ASSERTN (mpfr_cmp_str (z, "1.57075", 10, GMP_RNDN) == 0);
+ mpfr_atan2 (z, y, x, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_cmp_str (z, "1.57075", 10, MPFR_RNDN) == 0);
/* +1 0- --> PI/2 */
MPFR_CHANGE_SIGN (x);
- mpfr_atan2 (z, y, x, GMP_RNDN);
- MPFR_ASSERTN (mpfr_cmp_str (z, "1.57075", 10, GMP_RNDN) == 0);
+ mpfr_atan2 (z, y, x, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_cmp_str (z, "1.57075", 10, MPFR_RNDN) == 0);
/* -1 0- --> -PI/2 */
MPFR_CHANGE_SIGN (y);
- mpfr_atan2 (z, y, x, GMP_RNDN);
- MPFR_ASSERTN (mpfr_cmp_str (z, "-1.57075", 10, GMP_RNDN) == 0);
+ mpfr_atan2 (z, y, x, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_cmp_str (z, "-1.57075", 10, MPFR_RNDN) == 0);
/* -1 0+ --> -PI/2 */
MPFR_CHANGE_SIGN (x);
- mpfr_atan2 (z, y, x, GMP_RNDN);
- MPFR_ASSERTN (mpfr_cmp_str (z, "-1.57075", 10, GMP_RNDN) == 0);
+ mpfr_atan2 (z, y, x, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_cmp_str (z, "-1.57075", 10, MPFR_RNDN) == 0);
/* -1 +INF --> -0 */
MPFR_SET_INF (x);
- mpfr_atan2 (z, y, x, GMP_RNDN);
+ mpfr_atan2 (z, y, x, MPFR_RNDN);
MPFR_ASSERTN (MPFR_IS_ZERO (z) && MPFR_IS_NEG (z));
/* +1 +INF --> +0 */
MPFR_CHANGE_SIGN (y);
- mpfr_atan2 (z, y, x, GMP_RNDN);
+ mpfr_atan2 (z, y, x, MPFR_RNDN);
MPFR_ASSERTN (MPFR_IS_ZERO (z) && MPFR_IS_POS (z));
/* +1 -INF --> +PI */
MPFR_CHANGE_SIGN (x);
- mpfr_atan2 (z, y, x, GMP_RNDN);
- MPFR_ASSERTN (mpfr_cmp_str (z, "3.1415", 10, GMP_RNDN) == 0);
+ mpfr_atan2 (z, y, x, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_cmp_str (z, "3.1415", 10, MPFR_RNDN) == 0);
/* -1 -INF --> -PI */
MPFR_CHANGE_SIGN (y);
- mpfr_atan2 (z, y, x, GMP_RNDN);
- MPFR_ASSERTN (mpfr_cmp_str (z, "-3.1415", 10, GMP_RNDN) == 0);
+ mpfr_atan2 (z, y, x, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_cmp_str (z, "-3.1415", 10, MPFR_RNDN) == 0);
/* -INF -1 --> -PI/2 */
mpfr_swap (x, y);
- mpfr_atan2 (z, y, x, GMP_RNDN);
- MPFR_ASSERTN (mpfr_cmp_str (z, "-1.57075", 10, GMP_RNDN) == 0);
+ mpfr_atan2 (z, y, x, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_cmp_str (z, "-1.57075", 10, MPFR_RNDN) == 0);
/* +INF -1 --> PI/2 */
MPFR_CHANGE_SIGN (y);
- mpfr_atan2 (z, y, x, GMP_RNDN);
- MPFR_ASSERTN (mpfr_cmp_str (z, "1.57075", 10, GMP_RNDN) == 0);
+ mpfr_atan2 (z, y, x, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_cmp_str (z, "1.57075", 10, MPFR_RNDN) == 0);
/* +INF -INF --> 3*PI/4 */
MPFR_SET_INF (x);
- mpfr_atan2 (z, y, x, GMP_RNDN);
- MPFR_ASSERTN (mpfr_cmp_str (z, "2.356194490192344928", 10, GMP_RNDN) == 0);
+ mpfr_atan2 (z, y, x, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_cmp_str (z, "2.356194490192344928", 10, MPFR_RNDN) == 0);
/* +INF +INF --> PI/4 */
MPFR_CHANGE_SIGN (x);
- mpfr_atan2 (z, y, x, GMP_RNDN);
- MPFR_ASSERTN (mpfr_cmp_str (z, "0.785375", 10, GMP_RNDN) == 0);
+ mpfr_atan2 (z, y, x, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_cmp_str (z, "0.785375", 10, MPFR_RNDN) == 0);
/* -INF +INF --> -PI/4 */
MPFR_CHANGE_SIGN (y);
- mpfr_atan2 (z, y, x, GMP_RNDN);
- MPFR_ASSERTN (mpfr_cmp_str (z, "-0.785375", 10, GMP_RNDN) == 0);
+ mpfr_atan2 (z, y, x, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_cmp_str (z, "-0.785375", 10, MPFR_RNDN) == 0);
/* -INF -INF --> -3*PI/4 */
MPFR_CHANGE_SIGN (x);
- mpfr_atan2 (z, y, x, GMP_RNDN);
- MPFR_ASSERTN (mpfr_cmp_str (z, "-2.356194490192344928", 10, GMP_RNDN) == 0);
+ mpfr_atan2 (z, y, x, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_cmp_str (z, "-2.356194490192344928", 10, MPFR_RNDN) == 0);
mpfr_clears (x, y, z, (mpfr_ptr) 0);
}
@@ -360,15 +360,15 @@ smallvals_atan2 (void)
mp_exp_t old_emin;
mpfr_inits (a, x, y, (mpfr_ptr) 0);
- mpfr_set_ui (y, 0, GMP_RNDN);
+ mpfr_set_ui (y, 0, MPFR_RNDN);
mpfr_nextbelow (y);
- mpfr_set_ui (x, 1, GMP_RNDN);
+ mpfr_set_ui (x, 1, MPFR_RNDN);
/* y=-2^(-emin-1), x=1 */
- mpfr_atan2 (a, y, x, GMP_RNDD);
+ mpfr_atan2 (a, y, x, MPFR_RNDD);
MPFR_ASSERTN (mpfr_equal_p (a, y));
- mpfr_atan2 (a, y, x, GMP_RNDU);
+ mpfr_atan2 (a, y, x, MPFR_RNDU);
MPFR_ASSERTN (mpfr_zero_p (a) && MPFR_IS_NEG(a));
mpfr_set_prec (x, 8);
@@ -377,27 +377,27 @@ smallvals_atan2 (void)
old_emin = mpfr_get_emin ();
mpfr_set_emin (MPFR_EMIN_MIN);
- mpfr_set_si (y, 3, GMP_RNDN);
+ mpfr_set_si (y, 3, MPFR_RNDN);
mpfr_set_exp (y, mpfr_get_emin ());
mpfr_set_str_binary (x, "1.1");
- mpfr_atan2 (a, y, x, GMP_RNDU);
- mpfr_set_si (y, 1, GMP_RNDN);
+ mpfr_atan2 (a, y, x, MPFR_RNDU);
+ mpfr_set_si (y, 1, MPFR_RNDN);
mpfr_set_exp (y, mpfr_get_emin ());
MPFR_ASSERTN (mpfr_equal_p (a, y));
/* From a bug reported by Christopher Creutzig on 2007-08-28.
Added test in each rounding mode.
Segmentation fault or assertion failure due to an infinite Ziv loop. */
- mpfr_set_si (y, 1, GMP_RNDN);
+ mpfr_set_si (y, 1, MPFR_RNDN);
mpfr_set_exp (y, mpfr_get_emin ());
mpfr_set_str_binary (x, "1.01");
- mpfr_atan2 (a, y, x, GMP_RNDZ);
+ mpfr_atan2 (a, y, x, MPFR_RNDZ);
MPFR_ASSERTN (mpfr_zero_p (a));
- mpfr_atan2 (a, y, x, GMP_RNDD);
+ mpfr_atan2 (a, y, x, MPFR_RNDD);
MPFR_ASSERTN (mpfr_zero_p (a));
- mpfr_atan2 (a, y, x, GMP_RNDU);
+ mpfr_atan2 (a, y, x, MPFR_RNDU);
MPFR_ASSERTN (mpfr_equal_p (a, y));
- mpfr_atan2 (a, y, x, GMP_RNDN);
+ mpfr_atan2 (a, y, x, MPFR_RNDN);
MPFR_ASSERTN (mpfr_equal_p (a, y));
mpfr_set_emin (old_emin);
@@ -421,7 +421,7 @@ atan2_bug_20071003 (void)
"0.10100101010110010100010010111000110110011110001011110E3");
mpfr_set_str_binary (z,
"-0.11101111001101101100111011001101000010010111101110110E-1");
- mpfr_atan2 (a, y, x, GMP_RNDN);
+ mpfr_atan2 (a, y, x, MPFR_RNDN);
if (! mpfr_equal_p (a, z))
{
printf ("mpfr_atan2 fails on:\n");
diff --git a/tests/tatanh.c b/tests/tatanh.c
index ea032bdc3..9dfffd960 100644
--- a/tests/tatanh.c
+++ b/tests/tatanh.c
@@ -39,8 +39,8 @@ special (void)
mpfr_init (y);
MPFR_SET_INF(x);
- mpfr_set_ui (y, 0, GMP_RNDN);
- mpfr_atanh (x, y, GMP_RNDN);
+ mpfr_set_ui (y, 0, MPFR_RNDN);
+ mpfr_atanh (x, y, MPFR_RNDN);
if (MPFR_IS_INF(x) || MPFR_IS_NAN(x) )
{
printf ("Inf flag not clears in atanh!\n");
@@ -48,7 +48,7 @@ special (void)
}
MPFR_SET_NAN(x);
- mpfr_atanh (x, y, GMP_RNDN);
+ mpfr_atanh (x, y, MPFR_RNDN);
if (MPFR_IS_NAN(x) || MPFR_IS_INF(x))
{
printf ("NAN flag not clears in atanh!\n");
@@ -58,16 +58,16 @@ special (void)
/* atanh(+/-x) = NaN if x > 1 */
for (i = 3; i <= 6; i++)
{
- mpfr_set_si (x, i, GMP_RNDN);
- mpfr_div_2ui (x, x, 1, GMP_RNDN);
- mpfr_atanh (y, x, GMP_RNDN);
+ mpfr_set_si (x, i, MPFR_RNDN);
+ mpfr_div_2ui (x, x, 1, MPFR_RNDN);
+ mpfr_atanh (y, x, MPFR_RNDN);
if (!mpfr_nan_p (y))
{
printf ("Error: mpfr_atanh(%d/2) <> NaN\n", i);
exit (1);
}
- mpfr_neg (x, x, GMP_RNDN);
- mpfr_atanh (y, x, GMP_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN);
+ mpfr_atanh (y, x, MPFR_RNDN);
if (!mpfr_nan_p (y))
{
printf ("Error: mpfr_atanh(-%d/2) <> NaN\n", i);
@@ -76,15 +76,15 @@ special (void)
}
/* atanh(+0) = +0, atanh(-0) = -0 */
- mpfr_set_ui (x, 0, GMP_RNDN);
- mpfr_atanh (y, x, GMP_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_atanh (y, x, MPFR_RNDN);
if (mpfr_cmp_ui (y, 0) || mpfr_sgn (y) < 0)
{
printf ("Error: mpfr_atanh(+0) <> +0\n");
exit (1);
}
- mpfr_neg (x, x, GMP_RNDN);
- mpfr_atanh (y, x, GMP_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN);
+ mpfr_atanh (y, x, MPFR_RNDN);
if (mpfr_cmp_ui (y, 0) || mpfr_sgn (y) > 0)
{
printf ("Error: mpfr_atanh(-0) <> -0\n");
@@ -92,7 +92,7 @@ special (void)
}
MPFR_SET_NAN(x);
- mpfr_atanh (y, x, GMP_RNDN);
+ mpfr_atanh (y, x, MPFR_RNDN);
if (!mpfr_nan_p (y))
{
printf ("Error: mpfr_atanh(NaN) <> NaN\n");
@@ -100,7 +100,7 @@ special (void)
}
mpfr_set_inf (x, 1);
- mpfr_atanh (y, x, GMP_RNDN);
+ mpfr_atanh (y, x, MPFR_RNDN);
if (!mpfr_nan_p (y))
{
printf ("Error: mpfr_atanh(+Inf) <> NaN\n");
@@ -109,23 +109,23 @@ special (void)
}
mpfr_set_inf (x, -1);
- mpfr_atanh (y, x, GMP_RNDN);
+ mpfr_atanh (y, x, MPFR_RNDN);
if (!mpfr_nan_p (y))
{
printf ("Error: mpfr_atanh(-Inf) <> NaN\n");
exit (1);
}
- mpfr_set_ui (x, 1, GMP_RNDN);
- mpfr_atanh (y, x, GMP_RNDN);
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_atanh (y, x, MPFR_RNDN);
if (!mpfr_inf_p (y) || mpfr_sgn (y) < 0)
{
printf ("Error: mpfr_atanh(1) <> +Inf\n");
exit (1);
}
- mpfr_set_si (x, -1, GMP_RNDN);
- mpfr_atanh (y, x, GMP_RNDN);
+ mpfr_set_si (x, -1, MPFR_RNDN);
+ mpfr_atanh (y, x, MPFR_RNDN);
if (!mpfr_inf_p (y) || mpfr_sgn (y) > 0)
{
printf ("Error: mpfr_atanh(-1) <> -Inf\n");
@@ -136,7 +136,7 @@ special (void)
mpfr_set_prec (y, 32);
mpfr_set_str_binary (x, "0.10001000001001011000100001E-6");
- mpfr_atanh (x, x, GMP_RNDN);
+ mpfr_atanh (x, x, MPFR_RNDN);
mpfr_set_str_binary (y, "0.10001000001001100101010110100001E-6");
if (mpfr_cmp (x, y))
{
@@ -145,7 +145,7 @@ special (void)
}
mpfr_set_str_binary (x, "-0.1101011110111100111010011001011E-1");
- mpfr_atanh (x, x, GMP_RNDN);
+ mpfr_atanh (x, x, MPFR_RNDN);
mpfr_set_str_binary (y, "-0.11100110000100001111101100010111E-1");
if (mpfr_cmp (x, y))
{
@@ -156,7 +156,7 @@ special (void)
mpfr_set_prec (x, 33);
mpfr_set_prec (y, 43);
mpfr_set_str_binary (x, "0.111001101100000110011001010000101");
- mpfr_atanh (y, x, GMP_RNDZ);
+ mpfr_atanh (y, x, MPFR_RNDZ);
mpfr_init2 (z, 43);
mpfr_set_str_binary (z, "1.01111010110001101001000000101101011110101");
if (mpfr_cmp (y, z))
diff --git a/tests/taway.c b/tests/taway.c
index 48e6d158f..ecadcf688 100644
--- a/tests/taway.c
+++ b/tests/taway.c
@@ -26,7 +26,7 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
#include "mpfr-test.h"
-#define DISP(s, t) {printf(s); mpfr_out_str(stdout, 2, 0, t, GMP_RNDN); }
+#define DISP(s, t) {printf(s); mpfr_out_str(stdout, 2, 0, t, MPFR_RNDN); }
#define DISP2(s,t) {DISP(s,t); putchar('\n');}
#define SPECIAL_MAX 12
@@ -69,10 +69,10 @@ set_special (mpfr_ptr x, unsigned int select)
mpfr_set_str_binary (x, "1e+1");
break;
case 9:
- mpfr_const_pi (x, GMP_RNDN);
+ mpfr_const_pi (x, MPFR_RNDN);
break;
case 10:
- mpfr_const_pi (x, GMP_RNDN);
+ mpfr_const_pi (x, MPFR_RNDN);
MPFR_SET_EXP (x, MPFR_GET_EXP (x)-1);
break;
default:
@@ -114,8 +114,8 @@ test3 (int (*testfunc)(mpfr_ptr, mpfr_srcptr, mpfr_srcptr, mp_rnd_t),
set_special (ref2, i%SPECIAL_MAX);
set_special (ref3, i/SPECIAL_MAX);
- inexa = testfunc (res1, ref2, ref3, GMP_RNDA);
- r = MPFR_SIGN(res1) > 0 ? GMP_RNDU : GMP_RNDD;
+ inexa = testfunc (res1, ref2, ref3, MPFR_RNDA);
+ r = MPFR_SIGN(res1) > 0 ? MPFR_RNDU : MPFR_RNDD;
inexd = testfunc (ref1, ref2, ref3, r);
if (mpfr_compare (res1, ref1) || inexa != inexd)
@@ -169,8 +169,8 @@ test4 (int (*testfunc)(mpfr_ptr, mpfr_srcptr, mpfr_srcptr, mpfr_srcptr,
{
set_special (op3, k);
- inexa = testfunc (res, op1, op2, op3, GMP_RNDA);
- r = MPFR_SIGN(res) > 0 ? GMP_RNDU : GMP_RNDD;
+ inexa = testfunc (res, op1, op2, op3, MPFR_RNDA);
+ r = MPFR_SIGN(res) > 0 ? MPFR_RNDU : MPFR_RNDD;
inexd = testfunc (ref, op1, op2, op3, r);
if (mpfr_compare (res, ref) || inexa != inexd)
@@ -217,8 +217,8 @@ test2ui (int (*testfunc)(mpfr_ptr, mpfr_srcptr, unsigned long int, mp_rnd_t),
set_special (ref2, i % SPECIAL_MAX);
ref3 = i / SPECIAL_MAX == 0 ? 0 : randlimb ();
- inexa = testfunc (res1, ref2, ref3, GMP_RNDA);
- r = MPFR_SIGN(res1) > 0 ? GMP_RNDU : GMP_RNDD;
+ inexa = testfunc (res1, ref2, ref3, MPFR_RNDA);
+ r = MPFR_SIGN(res1) > 0 ? MPFR_RNDU : MPFR_RNDD;
inexd = testfunc (ref1, ref2, ref3, r);
if (mpfr_compare (res1, ref1) || inexa != inexd)
@@ -260,8 +260,8 @@ testui2 (int (*testfunc)(mpfr_ptr, unsigned long int, mpfr_srcptr, mp_rnd_t),
set_special (ref3, i % SPECIAL_MAX);
ref2 = i / SPECIAL_MAX == 0 ? 0 : randlimb ();
- inexa = testfunc (res1, ref2, ref3, GMP_RNDA);
- r = MPFR_SIGN(res1) > 0 ? GMP_RNDU : GMP_RNDD;
+ inexa = testfunc (res1, ref2, ref3, MPFR_RNDA);
+ r = MPFR_SIGN(res1) > 0 ? MPFR_RNDU : MPFR_RNDD;
inexd = testfunc (ref1, ref2, ref3, r);
if (mpfr_compare (res1, ref1) || inexa != inexd)
@@ -301,9 +301,9 @@ test2 (int (*testfunc)(mpfr_ptr, mpfr_srcptr, mp_rnd_t), char *foo)
set_special (ref2, i);
/* first round to away */
- inexa = testfunc (res1, ref2, GMP_RNDA);
+ inexa = testfunc (res1, ref2, MPFR_RNDA);
- r = MPFR_SIGN(res1) > 0 ? GMP_RNDU : GMP_RNDD;
+ r = MPFR_SIGN(res1) > 0 ? MPFR_RNDU : MPFR_RNDD;
inexd = testfunc (ref1, ref2, r);
if (mpfr_compare (res1, ref1) || inexa != inexd)
{
@@ -344,10 +344,10 @@ test3a (int (*testfunc)(mpfr_ptr, mpfr_ptr, mpfr_srcptr, mp_rnd_t), char *foo)
{
set_special (ref3, i);
- inexa = testfunc (res1, res2, ref3, GMP_RNDA);
+ inexa = testfunc (res1, res2, ref3, MPFR_RNDA);
/* first check wrt the first operand */
- r = MPFR_SIGN(res1) > 0 ? GMP_RNDU : GMP_RNDD;
+ r = MPFR_SIGN(res1) > 0 ? MPFR_RNDU : MPFR_RNDD;
inexd = testfunc (ref1, ref2, ref3, r);
if (mpfr_compare (res1, ref1) || inexa != inexd)
{
@@ -360,7 +360,7 @@ test3a (int (*testfunc)(mpfr_ptr, mpfr_ptr, mpfr_srcptr, mp_rnd_t), char *foo)
}
/* now check wrt the second operand */
- r = MPFR_SIGN(res2) > 0 ? GMP_RNDU : GMP_RNDD;
+ r = MPFR_SIGN(res2) > 0 ? MPFR_RNDU : MPFR_RNDD;
inexd = testfunc (ref1, ref2, ref3, r);
if (mpfr_compare (res2, ref2) || inexa != inexd)
{
diff --git a/tests/tcan_round.c b/tests/tcan_round.c
index 50840a13c..32bbfce95 100644
--- a/tests/tcan_round.c
+++ b/tests/tcan_round.c
@@ -45,7 +45,7 @@ check_round_p (void)
err = p + randlimb () % BITS_PER_MP_LIMB;
r1 = mpfr_round_p (buf, n, err, p);
r2 = mpfr_can_round_raw (buf, n, MPFR_SIGN_POS, err,
- GMP_RNDN, GMP_RNDZ, p);
+ MPFR_RNDN, MPFR_RNDZ, p);
if (r1 != r2)
{
printf ("mpfr_round_p(%d) != mpfr_can_round(%d)!\n"
@@ -69,14 +69,14 @@ main (void)
bit to zero in case of equal distance */
mpfr_init2 (x, 59);
mpfr_set_str_binary (x, "-0.10010001010111000011110010111010111110000000111101100111111E663");
- if (mpfr_can_round (x, 54, GMP_RNDZ, GMP_RNDZ, 53) != 0)
+ if (mpfr_can_round (x, 54, MPFR_RNDZ, MPFR_RNDZ, 53) != 0)
{
printf ("Error (1) in mpfr_can_round\n");
exit (1);
}
mpfr_set_str_binary (x, "-Inf");
- if (mpfr_can_round (x, 2000, GMP_RNDZ, GMP_RNDZ, 2000) != 0)
+ if (mpfr_can_round (x, 2000, MPFR_RNDZ, MPFR_RNDZ, 2000) != 0)
{
printf ("Error (2) in mpfr_can_round\n");
exit (1);
@@ -84,20 +84,20 @@ main (void)
mpfr_set_prec (x, 64);
mpfr_set_str_binary (x, "0.1011001000011110000110000110001111101011000010001110011000000000");
- if (mpfr_can_round (x, 65, GMP_RNDN, GMP_RNDN, 54))
+ if (mpfr_can_round (x, 65, MPFR_RNDN, MPFR_RNDN, 54))
{
printf ("Error (3) in mpfr_can_round\n");
exit (1);
}
mpfr_set_prec (x, 62);
- mpfr_set_str (x, "0.ff4ca619c76ba69", 16, GMP_RNDZ);
+ mpfr_set_str (x, "0.ff4ca619c76ba69", 16, MPFR_RNDZ);
for (i = 30; i < 99; i++)
for (j = 30; j < 99; j++)
{
int r1, r2;
- for (r1 = 0; r1 < GMP_RND_MAX ; r1++)
- for (r2 = 0; r2 < GMP_RND_MAX ; r2++)
+ for (r1 = 0; r1 < MPFR_RND_MAX ; r1++)
+ for (r2 = 0; r2 < MPFR_RND_MAX ; r2++)
mpfr_can_round (x, i, (mp_rnd_t) r1, (mp_rnd_t) r2, j); /* test for assertions */
}
diff --git a/tests/tcbrt.c b/tests/tcbrt.c
index 2a75f9257..46b9af6c8 100644
--- a/tests/tcbrt.c
+++ b/tests/tcbrt.c
@@ -35,7 +35,7 @@ special (void)
/* cbrt(NaN) = NaN */
mpfr_set_nan (x);
- mpfr_cbrt (y, x, GMP_RNDN);
+ mpfr_cbrt (y, x, MPFR_RNDN);
if (!mpfr_nan_p (y))
{
printf ("Error: cbrt(NaN) <> NaN\n");
@@ -44,7 +44,7 @@ special (void)
/* cbrt(+Inf) = +Inf */
mpfr_set_inf (x, 1);
- mpfr_cbrt (y, x, GMP_RNDN);
+ mpfr_cbrt (y, x, MPFR_RNDN);
if (!mpfr_inf_p (y) || mpfr_sgn (y) < 0)
{
printf ("Error: cbrt(+Inf) <> +Inf\n");
@@ -53,7 +53,7 @@ special (void)
/* cbrt(-Inf) = -Inf */
mpfr_set_inf (x, -1);
- mpfr_cbrt (y, x, GMP_RNDN);
+ mpfr_cbrt (y, x, MPFR_RNDN);
if (!mpfr_inf_p (y) || mpfr_sgn (y) > 0)
{
printf ("Error: cbrt(-Inf) <> -Inf\n");
@@ -61,15 +61,15 @@ special (void)
}
/* cbrt(+/-0) = +/-0 */
- mpfr_set_ui (x, 0, GMP_RNDN);
- mpfr_cbrt (y, x, GMP_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_cbrt (y, x, MPFR_RNDN);
if (mpfr_cmp_ui (y, 0) || mpfr_sgn (y) < 0)
{
printf ("Error: cbrt(+0) <> +0\n");
exit (1);
}
- mpfr_neg (x, x, GMP_RNDN);
- mpfr_cbrt (y, x, GMP_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN);
+ mpfr_cbrt (y, x, MPFR_RNDN);
if (mpfr_cmp_ui (y, 0) || mpfr_sgn (y) > 0)
{
printf ("Error: cbrt(-0) <> -0\n");
@@ -77,8 +77,8 @@ special (void)
}
mpfr_set_prec (x, 53);
- mpfr_set_str (x, "8.39005285514734966412e-01", 10, GMP_RNDN);
- mpfr_cbrt (x, x, GMP_RNDN);
+ mpfr_set_str (x, "8.39005285514734966412e-01", 10, MPFR_RNDN);
+ mpfr_cbrt (x, x, MPFR_RNDN);
if (mpfr_cmp_str1 (x, "9.43166207799662426048e-01"))
{
printf ("Error in crbrt (1)\n");
@@ -88,7 +88,7 @@ special (void)
mpfr_set_prec (x, 32);
mpfr_set_prec (y, 32);
mpfr_set_str_binary (x, "0.10000100001100101001001001011001");
- mpfr_cbrt (x, x, GMP_RNDN);
+ mpfr_cbrt (x, x, MPFR_RNDN);
mpfr_set_str_binary (y, "0.11001101011000100111000111111001");
if (mpfr_cmp (x, y))
{
@@ -99,7 +99,7 @@ special (void)
mpfr_set_prec (x, 32);
mpfr_set_prec (y, 32);
mpfr_set_str_binary (x, "-0.1100001110110000010101011001011");
- mpfr_cbrt (x, x, GMP_RNDD);
+ mpfr_cbrt (x, x, MPFR_RNDD);
mpfr_set_str_binary (y, "-0.11101010000100100101000101011001");
if (mpfr_cmp (x, y))
{
@@ -110,7 +110,7 @@ special (void)
mpfr_set_prec (x, 82);
mpfr_set_prec (y, 27);
mpfr_set_str_binary (x, "0.1010001111011101011011000111001011001101100011110110010011011011011010011001100101e-7");
- mpfr_cbrt (y, x, GMP_RNDD);
+ mpfr_cbrt (y, x, MPFR_RNDD);
mpfr_set_str_binary (x, "0.101011110001110001000100011E-2");
if (mpfr_cmp (x, y))
{
@@ -121,7 +121,7 @@ special (void)
mpfr_set_prec (x, 204);
mpfr_set_prec (y, 38);
mpfr_set_str_binary (x, "0.101000000001101000000001100111111011111001110110100001111000100110100111001101100111110001110001011011010110010011100101111001111100001010010100111011101100000011011000101100010000000011000101001010001001E-5");
- mpfr_cbrt (y, x, GMP_RNDD);
+ mpfr_cbrt (y, x, MPFR_RNDD);
mpfr_set_str_binary (x, "0.10001001111010011011101000010110110010E-1");
if (mpfr_cmp (x, y))
{
@@ -133,7 +133,7 @@ special (void)
mpfr_set_prec (x, 5);
mpfr_set_prec (y, 5);
mpfr_set_str_binary (x, "1.1000E-2");
- mpfr_cbrt (y, x, GMP_RNDN);
+ mpfr_cbrt (y, x, MPFR_RNDN);
mpfr_set_str_binary (x, "1.0111E-1");
if (mpfr_cmp (x, y))
{
@@ -164,25 +164,25 @@ main (void)
for (p=2; p<100; p++)
{
mpfr_set_prec (x, p);
- for (r = 0; r < GMP_RND_MAX; r++)
+ for (r = 0; r < MPFR_RND_MAX; r++)
{
- mpfr_set_ui (x, 1, GMP_RNDN);
+ mpfr_set_ui (x, 1, MPFR_RNDN);
mpfr_cbrt (x, x, (mp_rnd_t) r);
if (mpfr_cmp_ui (x, 1))
{
printf ("Error in mpfr_cbrt for x=1, rnd=%s\ngot ",
mpfr_print_rnd_mode ((mp_rnd_t) r));
- mpfr_out_str (stdout, 2, 0, x, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN);
printf ("\n");
exit (1);
}
- mpfr_set_si (x, -1, GMP_RNDN);
+ mpfr_set_si (x, -1, MPFR_RNDN);
mpfr_cbrt (x, x, (mp_rnd_t) r);
if (mpfr_cmp_si (x, -1))
{
printf ("Error in mpfr_cbrt for x=-1, rnd=%s\ngot ",
mpfr_print_rnd_mode ((mp_rnd_t) r));
- mpfr_out_str (stdout, 2, 0, x, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN);
printf ("\n");
exit (1);
}
@@ -192,15 +192,15 @@ main (void)
int i;
for (i = -12; i <= 12; i++)
{
- mpfr_set_ui (x, 27, GMP_RNDN);
- mpfr_mul_2si (x, x, 3*i, GMP_RNDN);
- mpfr_cbrt (x, x, GMP_RNDN);
+ mpfr_set_ui (x, 27, MPFR_RNDN);
+ mpfr_mul_2si (x, x, 3*i, MPFR_RNDN);
+ mpfr_cbrt (x, x, MPFR_RNDN);
if (mpfr_cmp_si_2exp (x, 3, i))
{
printf ("Error in mpfr_cbrt for "
"x = 27.0 * 2^(%d), rnd=%s\ngot ",
3*i, mpfr_print_rnd_mode ((mp_rnd_t) r));
- mpfr_out_str (stdout, 2, 0, x, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN);
printf ("\ninstead of 3 * 2^(%d)\n", i);
exit (1);
}
diff --git a/tests/tcheck.c b/tests/tcheck.c
index 305be131f..f3441ff43 100644
--- a/tests/tcheck.c
+++ b/tests/tcheck.c
@@ -50,18 +50,18 @@ main (void)
MPFR_SET_ZERO(a);
if (!mpfr_check(a)) ERROR("for zero");
/* Check var */
- mpfr_set_ui(a, 2, GMP_RNDN);
+ mpfr_set_ui(a, 2, MPFR_RNDN);
if (!mpfr_check(a)) ERROR("for set_ui");
mpfr_clear_overflow();
max = 1000; /* Allows max 2^1000 bits for the exponent */
while ((!mpfr_overflow_p()) && (max>0))
{
- mpfr_mul(a, a, a, GMP_RNDN);
+ mpfr_mul(a, a, a, MPFR_RNDN);
if (!mpfr_check(a)) ERROR("for mul");
max--;
}
if (max==0) ERROR("can't reach overflow");
- mpfr_set_ui(a, 2137, GMP_RNDN);
+ mpfr_set_ui(a, 2137, MPFR_RNDN);
/* Corrupt a and check for it */
MPFR_SIGN(a) = 2;
if (mpfr_check(a)) ERROR("sgn");
@@ -105,7 +105,7 @@ main (void)
MPFR_MANT(a)[MPFR_LIMB_SIZE(a)-1] &= MPFR_LIMB_MASK (BITS_PER_MP_LIMB-1);
if (mpfr_check(a)) ERROR("last bits non 0");
/* Final */
- mpfr_set_ui(a, 2137, GMP_RNDN);
+ mpfr_set_ui(a, 2137, MPFR_RNDN);
if (!mpfr_check(a)) ERROR("after last set");
mpfr_clear (a);
if (mpfr_check(a)) ERROR("after clear");
diff --git a/tests/tcmp.c b/tests/tcmp.c
index b220649f2..53397fc1b 100644
--- a/tests/tcmp.c
+++ b/tests/tcmp.c
@@ -98,8 +98,8 @@ main (void)
mpfr_set_prec (yy, 53);
/* bug found by Gerardo Ballabio */
- mpfr_set_ui(xx, 0, GMP_RNDN);
- mpfr_set_str (yy, "0.1", 10, GMP_RNDN);
+ mpfr_set_ui(xx, 0, MPFR_RNDN);
+ mpfr_set_str (yy, "0.1", 10, MPFR_RNDN);
if ((c = mpfr_cmp (xx, yy)) >= 0)
{
printf ("Error in mpfr_cmp(0.0, 0.1), gives %d\n", c);
@@ -107,7 +107,7 @@ main (void)
}
mpfr_set_inf (xx, 1);
- mpfr_set_str (yy, "-23489745.0329", 10, GMP_RNDN);
+ mpfr_set_str (yy, "-23489745.0329", 10, MPFR_RNDN);
if ((c = mpfr_cmp (xx, yy)) <= 0)
{
printf ("Error in mpfr_cmp(Infp, 23489745.0329), gives %d\n", c);
@@ -147,15 +147,15 @@ main (void)
}
mpfr_set_inf (xx, -1);
- mpfr_set_str (yy, "2346.09234", 10, GMP_RNDN);
+ mpfr_set_str (yy, "2346.09234", 10, MPFR_RNDN);
if ((c = mpfr_cmp (xx, yy)) >= 0)
{
printf ("Error in mpfr_cmp(Infm, 2346.09234), gives %d\n", c);
exit (1);
}
- mpfr_set_ui (xx, 0, GMP_RNDN);
- mpfr_set_ui (yy, 1, GMP_RNDN);
+ mpfr_set_ui (xx, 0, MPFR_RNDN);
+ mpfr_set_ui (yy, 1, MPFR_RNDN);
if ((c = mpfr_cmp3 (xx, yy, 1)) >= 0)
{
printf ("Error: mpfr_cmp3 (0, 1, 1) gives %d instead of"
@@ -176,8 +176,8 @@ main (void)
if (!Isnan(x) && !Isnan(y))
{
i++;
- mpfr_set_d (xx, x, GMP_RNDN);
- mpfr_set_d (yy, y, GMP_RNDN);
+ mpfr_set_d (xx, x, MPFR_RNDN);
+ mpfr_set_d (yy, y, MPFR_RNDN);
c = mpfr_cmp (xx,yy);
if ((c>0 && x<=y) || (c==0 && x!=y) || (c<0 && x>=y))
{
diff --git a/tests/tcmp2.c b/tests/tcmp2.c
index d3cd28083..67ed39565 100644
--- a/tests/tcmp2.c
+++ b/tests/tcmp2.c
@@ -56,31 +56,31 @@ worst_cases (void)
mpfr_init2 (x, 200);
mpfr_init2 (y, 200);
- mpfr_set_ui (y, 1, GMP_RNDN);
+ mpfr_set_ui (y, 1, MPFR_RNDN);
for (i = 1; i < MPFR_PREC(x); i++)
{
- mpfr_set_ui (x, 1, GMP_RNDN);
- mpfr_div_2exp (y, y, 1, GMP_RNDN); /* y = 1/2^i */
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_div_2exp (y, y, 1, MPFR_RNDN); /* y = 1/2^i */
l = 0;
if (mpfr_cmp2 (x, y, &l) <= 0 || l != 1)
{
printf ("Error in mpfr_cmp2:\nx=");
- mpfr_out_str (stdout, 2, 0, x, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN);
printf ("\ny=");
- mpfr_out_str (stdout, 2, 0, y, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN);
printf ("\ngot %lu instead of 1\n", l);
exit (1);
}
- mpfr_add (x, x, y, GMP_RNDN); /* x = 1 + 1/2^i */
+ mpfr_add (x, x, y, MPFR_RNDN); /* x = 1 + 1/2^i */
l = 0;
if (mpfr_cmp2 (x, y, &l) <= 0 || l != 0)
{
printf ("Error in mpfr_cmp2:\nx=");
- mpfr_out_str (stdout, 2, 0, x, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN);
printf ("\ny=");
- mpfr_out_str (stdout, 2, 0, y, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN);
printf ("\ngot %lu instead of 0\n", l);
exit (1);
}
@@ -89,7 +89,7 @@ worst_cases (void)
for (i = 0; i < 64; i++) /* |u| = i */
{
mpfr_urandomb (x, RANDS);
- mpfr_set (y, x, GMP_RNDN);
+ mpfr_set (y, x, MPFR_RNDN);
set_bit (x, i + 1, 1);
set_bit (y, i + 1, 0);
for (j = 0; j < 64; j++) /* |v| = j */
@@ -110,9 +110,9 @@ worst_cases (void)
if (l != expected)
{
printf ("Error in mpfr_cmp2:\nx=");
- mpfr_out_str (stdout, 2, 0, x, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN);
printf ("\ny=");
- mpfr_out_str (stdout, 2, 0, y, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN);
printf ("\ngot %lu instead of %u\n", l, expected);
exit (1);
}
@@ -124,9 +124,9 @@ worst_cases (void)
if (l != expected)
{
printf ("Error in mpfr_cmp2:\nx=");
- mpfr_out_str (stdout, 2, 0, x, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN);
printf ("\ny=");
- mpfr_out_str (stdout, 2, 0, y, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN);
printf ("\ngot %lu instead of %u\n", l, expected);
exit (1);
}
@@ -152,17 +152,17 @@ tcmp2 (double x, double y, int i)
i = (int) (__gmpfr_floor_log2 (x) - __gmpfr_floor_log2 (x - y));
}
mpfr_init2(xx, 53); mpfr_init2(yy, 53);
- mpfr_set_d (xx, x, GMP_RNDN);
- mpfr_set_d (yy, y, GMP_RNDN);
+ mpfr_set_d (xx, x, MPFR_RNDN);
+ mpfr_set_d (yy, y, MPFR_RNDN);
j = 0;
if (mpfr_cmp2 (xx, yy, &j) == 0)
{
if (x != y)
{
printf ("Error in mpfr_cmp2 for\nx=");
- mpfr_out_str (stdout, 2, 0, xx, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, xx, MPFR_RNDN);
printf ("\ny=");
- mpfr_out_str (stdout, 2, 0, yy, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, yy, MPFR_RNDN);
printf ("\ngot sign 0 for x != y\n");
exit (1);
}
@@ -170,9 +170,9 @@ tcmp2 (double x, double y, int i)
else if (j != (unsigned) i)
{
printf ("Error in mpfr_cmp2 for\nx=");
- mpfr_out_str (stdout, 2, 0, xx, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, xx, MPFR_RNDN);
printf ("\ny=");
- mpfr_out_str (stdout, 2, 0, yy, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, yy, MPFR_RNDN);
printf ("\ngot %lu instead of %d\n", j, i);
exit (1);
}
@@ -248,7 +248,7 @@ special (void)
/* bug found by Nathalie Revol, 2 Apr 2001 */
mpfr_set_prec (x, 65); mpfr_set_prec (y, 65);
- mpfr_set_ui (x, 5, GMP_RNDN);
+ mpfr_set_ui (x, 5, MPFR_RNDN);
mpfr_set_str_binary (y, "0.10011111111111111111111111111111111111111111111111111111111111101E3");
j = 0;
if (mpfr_cmp2(x, y, &j) <= 0 || j != 63)
diff --git a/tests/tcmp_d.c b/tests/tcmp_d.c
index c3f05fd9c..af5bc9453 100644
--- a/tests/tcmp_d.c
+++ b/tests/tcmp_d.c
@@ -35,33 +35,33 @@ main (void)
mpfr_init2(x, IEEE_DBL_MANT_DIG);
- mpfr_set_d (x, 2.34763465, GMP_RNDN);
+ mpfr_set_d (x, 2.34763465, MPFR_RNDN);
if (mpfr_cmp_d(x, 2.34763465)!=0) {
printf("Error in mpfr_cmp_d 2.34763465 and ");
- mpfr_out_str(stdout, 10, 0, x, GMP_RNDN); putchar('\n');
+ mpfr_out_str(stdout, 10, 0, x, MPFR_RNDN); putchar('\n');
exit(1);
}
if (mpfr_cmp_d(x, 2.345)<=0) {
printf("Error in mpfr_cmp_d 2.345 and ");
- mpfr_out_str(stdout, 10, 0, x, GMP_RNDN); putchar('\n');
+ mpfr_out_str(stdout, 10, 0, x, MPFR_RNDN); putchar('\n');
exit(1);
}
if (mpfr_cmp_d(x, 2.4)>=0) {
printf("Error in mpfr_cmp_d 2.4 and ");
- mpfr_out_str(stdout, 10, 0, x, GMP_RNDN); putchar('\n');
+ mpfr_out_str(stdout, 10, 0, x, MPFR_RNDN); putchar('\n');
exit(1);
}
- mpfr_set_ui (x, 0, GMP_RNDZ);
- mpfr_neg (x, x, GMP_RNDZ);
+ mpfr_set_ui (x, 0, MPFR_RNDZ);
+ mpfr_neg (x, x, MPFR_RNDZ);
if (mpfr_cmp_d (x, 0.0)) {
printf("Error in mpfr_cmp_d 0.0 and ");
- mpfr_out_str(stdout, 10, 0, x, GMP_RNDN); putchar('\n');
+ mpfr_out_str(stdout, 10, 0, x, MPFR_RNDN); putchar('\n');
exit(1);
}
- mpfr_set_ui (x, 0, GMP_RNDN);
- mpfr_ui_div (x, 1, x, GMP_RNDU);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_ui_div (x, 1, x, MPFR_RNDU);
if (mpfr_cmp_d (x, 0.0) == 0)
{
printf ("Error in mpfr_cmp_d (Inf, 0)\n");
diff --git a/tests/tcmp_ld.c b/tests/tcmp_ld.c
index e0869b9dc..78ed043f4 100644
--- a/tests/tcmp_ld.c
+++ b/tests/tcmp_ld.c
@@ -34,33 +34,33 @@ main (void)
mpfr_init2(x, MPFR_LDBL_MANT_DIG);
- mpfr_set_ld (x, 2.34763465, GMP_RNDN);
+ mpfr_set_ld (x, 2.34763465, MPFR_RNDN);
if (mpfr_cmp_ld(x, 2.34763465)!=0) {
printf("Error in mpfr_cmp_ld 2.34763465 and ");
- mpfr_out_str(stdout, 10, 0, x, GMP_RNDN); putchar('\n');
+ mpfr_out_str(stdout, 10, 0, x, MPFR_RNDN); putchar('\n');
exit(1);
}
if (mpfr_cmp_ld(x, 2.345)<=0) {
printf("Error in mpfr_cmp_ld 2.345 and ");
- mpfr_out_str(stdout, 10, 0, x, GMP_RNDN); putchar('\n');
+ mpfr_out_str(stdout, 10, 0, x, MPFR_RNDN); putchar('\n');
exit(1);
}
if (mpfr_cmp_ld(x, 2.4)>=0) {
printf("Error in mpfr_cmp_ld 2.4 and ");
- mpfr_out_str(stdout, 10, 0, x, GMP_RNDN); putchar('\n');
+ mpfr_out_str(stdout, 10, 0, x, MPFR_RNDN); putchar('\n');
exit(1);
}
- mpfr_set_ui (x, 0, GMP_RNDZ);
- mpfr_neg (x, x, GMP_RNDZ);
+ mpfr_set_ui (x, 0, MPFR_RNDZ);
+ mpfr_neg (x, x, MPFR_RNDZ);
if (mpfr_cmp_ld (x, 0.0)) {
printf("Error in mpfr_cmp_ld 0.0 and ");
- mpfr_out_str(stdout, 10, 0, x, GMP_RNDN); putchar('\n');
+ mpfr_out_str(stdout, 10, 0, x, MPFR_RNDN); putchar('\n');
exit(1);
}
- mpfr_set_ui (x, 0, GMP_RNDN);
- mpfr_ui_div (x, 1, x, GMP_RNDU);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_ui_div (x, 1, x, MPFR_RNDU);
if (mpfr_cmp_ld (x, 0.0) == 0)
{
printf ("Error in mpfr_cmp_ld (Inf, 0)\n");
diff --git a/tests/tcmp_ui.c b/tests/tcmp_ui.c
index e50d302c4..9c569aa9a 100644
--- a/tests/tcmp_ui.c
+++ b/tests/tcmp_ui.c
@@ -100,7 +100,7 @@ main (void)
mpfr_init(x);
/* tests for cmp_ui */
- mpfr_set_ui (x, 3, GMP_RNDZ);
+ mpfr_set_ui (x, 3, MPFR_RNDZ);
if ((mpfr_cmp_ui) (x, i = 3) != 0)
{
printf ("Error in mpfr_cmp_ui(3.0, 3)\n");
@@ -116,14 +116,14 @@ main (void)
printf ("Error in mpfr_cmp_ui(3.0,4)\n");
exit (1);
}
- mpfr_set_ui (x, 0, GMP_RNDZ);
- mpfr_neg (x, x, GMP_RNDZ);
+ mpfr_set_ui (x, 0, MPFR_RNDZ);
+ mpfr_neg (x, x, MPFR_RNDZ);
if (mpfr_cmp_ui (x, i = 0))
{
printf ("Error in mpfr_cmp_ui(0.0,0)\n");
exit (1);
}
- mpfr_set_ui (x, 1, GMP_RNDZ);
+ mpfr_set_ui (x, 1, MPFR_RNDZ);
if (mpfr_cmp_ui (x, i = 0) == 0)
{
printf ("Error in mpfr_cmp_ui(1.0,0)\n");
@@ -143,15 +143,15 @@ main (void)
exit (1);
}
- mpfr_set_si (x, -1, GMP_RNDN);
+ mpfr_set_si (x, -1, MPFR_RNDN);
MPFR_ASSERTN(mpfr_cmp_ui (x, 1) < 0);
MPFR_ASSERTN(mpfr_cmp_ui (x, 0) < 0);
- mpfr_set_ui (x, 1, GMP_RNDN);
+ mpfr_set_ui (x, 1, MPFR_RNDN);
MPFR_ASSERTN(mpfr_cmp_ui (x, 0) > 0);
/* tests for cmp_si */
- (mpfr_set_si) (x, -3, GMP_RNDZ);
+ (mpfr_set_si) (x, -3, MPFR_RNDZ);
if ((mpfr_cmp_si) (x, s = -3) != 0)
{
printf ("Error in mpfr_cmp_si(-3.0,-3)\n");
@@ -182,19 +182,19 @@ main (void)
}
/* case b=0 */
- mpfr_set_ui (x, 0, GMP_RNDZ);
+ mpfr_set_ui (x, 0, MPFR_RNDZ);
MPFR_ASSERTN(mpfr_cmp_si (x, 0) == 0);
MPFR_ASSERTN(mpfr_cmp_si (x, 1) < 0);
MPFR_ASSERTN(mpfr_cmp_si (x, -1) > 0);
/* case i=0 */
- mpfr_set_ui (x, 1, GMP_RNDZ);
+ mpfr_set_ui (x, 1, MPFR_RNDZ);
MPFR_ASSERTN(mpfr_cmp_si (x, 0) > 0);
- mpfr_set_ui (x, 0, GMP_RNDZ);
+ mpfr_set_ui (x, 0, MPFR_RNDZ);
MPFR_ASSERTN(mpfr_cmp_si (x, 0) == 0);
- mpfr_neg (x, x, GMP_RNDZ);
+ mpfr_neg (x, x, MPFR_RNDZ);
MPFR_ASSERTN(mpfr_cmp_si (x, 0) == 0);
- mpfr_set_si (x, -1, GMP_RNDZ);
+ mpfr_set_si (x, -1, MPFR_RNDZ);
MPFR_ASSERTN(mpfr_cmp_si (x, 0) < 0);
/* case large x */
@@ -208,8 +208,8 @@ main (void)
MPFR_ASSERTN(mpfr_cmp_si (x, -1) < 0);
/* corner case */
- mpfr_set_ui (x, 1, GMP_RNDZ);
- mpfr_mul_2exp (x, x, BITS_PER_MP_LIMB - 1, GMP_RNDZ);
+ mpfr_set_ui (x, 1, MPFR_RNDZ);
+ mpfr_mul_2exp (x, x, BITS_PER_MP_LIMB - 1, MPFR_RNDZ);
/* now EXP(x)=BITS_PER_MP_LIMB */
MPFR_ASSERTN(mpfr_cmp_si (x, 1) > 0);
diff --git a/tests/tcmpabs.c b/tests/tcmpabs.c
index 2ca18009f..6485c80e3 100644
--- a/tests/tcmpabs.c
+++ b/tests/tcmpabs.c
@@ -84,13 +84,13 @@ main (void)
ERROR ("Error in mpfr_cmpabs: not 1.0000000002 > 1.0\n");
mpfr_set_prec(yy, 53);
- mpfr_set_ui(xx, 0, GMP_RNDN);
- mpfr_set_str (yy, "-0.1", 10, GMP_RNDN);
+ mpfr_set_ui(xx, 0, MPFR_RNDN);
+ mpfr_set_str (yy, "-0.1", 10, MPFR_RNDN);
if (mpfr_cmpabs(xx, yy) >= 0)
ERROR ("Error in mpfr_cmpabs(0.0, 0.1)\n");
mpfr_set_inf (xx, -1);
- mpfr_set_str (yy, "23489745.0329", 10, GMP_RNDN);
+ mpfr_set_str (yy, "23489745.0329", 10, MPFR_RNDN);
if (mpfr_cmpabs(xx, yy) <= 0)
ERROR ("Error in mpfr_cmp(-Inf, 23489745.0329)\n");
@@ -100,7 +100,7 @@ main (void)
ERROR ("Error in mpfr_cmpabs(Inf, -Inf)\n");
mpfr_set_inf (yy, -1);
- mpfr_set_str (xx, "2346.09234", 10, GMP_RNDN);
+ mpfr_set_str (xx, "2346.09234", 10, MPFR_RNDN);
if (mpfr_cmpabs (xx, yy) >= 0)
ERROR ("Error in mpfr_cmpabs(-Inf, 2346.09234)\n");
diff --git a/tests/tcomparisons.c b/tests/tcomparisons.c
index 31c3fc967..455103b02 100644
--- a/tests/tcomparisons.c
+++ b/tests/tcomparisons.c
@@ -50,9 +50,9 @@ cmp_tests (void)
signy = randlimb () % 256 ? signx : 1 - signx;
/* signy = signx most of the time (most interesting case) */
if (signx)
- mpfr_neg (x, x, GMP_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN);
if (signy)
- mpfr_neg (y, y, GMP_RNDN);
+ mpfr_neg (y, y, MPFR_RNDN);
if (i <= 1)
mpfr_set_nan (x);
if (i == 0 || i == 2)
@@ -78,9 +78,9 @@ cmp_tests (void)
(cmp > 0 && cmpbool != 0x13))))
{
printf ("Error in cmp_tests for\nx = ");
- mpfr_out_str (stdout, 2, 0, x, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN);
printf (" and\ny = ");
- mpfr_out_str (stdout, 2, 0, y, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN);
printf ("\n");
exit (1);
}
@@ -104,15 +104,15 @@ eq_tests (void)
mpfr_set_prec (y, precx + (randlimb () % 64));
mpfr_urandomb (x, RANDS);
if (randlimb () & 1)
- mpfr_neg (x, x, GMP_RNDN);
- mpfr_set (y, x, GMP_RNDN); /* exact -> x = y */
+ mpfr_neg (x, x, MPFR_RNDN);
+ mpfr_set (y, x, MPFR_RNDN); /* exact -> x = y */
if (mpfr_greater_p (x, y) || !mpfr_greaterequal_p (x, y) ||
mpfr_less_p (x, y) || !mpfr_lessequal_p (x, y) ||
mpfr_lessgreater_p (x, y) || !mpfr_equal_p (x, y) ||
mpfr_unordered_p (x, y))
{
printf ("Error in eq_tests for x = ");
- mpfr_out_str (stdout, 2, 0, x, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN);
printf ("\n");
exit (1);
}
diff --git a/tests/tconst_catalan.c b/tests/tconst_catalan.c
index 4c8d1e2e4..232aa7e79 100644
--- a/tests/tconst_catalan.c
+++ b/tests/tconst_catalan.c
@@ -31,7 +31,7 @@ my_const_catalan (mpfr_ptr x, mpfr_srcptr y, mp_rnd_t r)
return mpfr_const_catalan (x, r);
}
-#define RAND_FUNCTION(x) mpfr_set_ui(x,0,GMP_RNDN)
+#define RAND_FUNCTION(x) mpfr_set_ui(x,0,MPFR_RNDN)
#define TEST_FUNCTION my_const_catalan
#include "tgeneric.c"
@@ -43,8 +43,8 @@ main (int argc, char *argv[])
tests_start_mpfr ();
mpfr_init2 (x, 32);
- (mpfr_const_catalan) (x, GMP_RNDN);
- mpfr_mul_2exp (x, x, 32, GMP_RNDN);
+ (mpfr_const_catalan) (x, MPFR_RNDN);
+ mpfr_mul_2exp (x, x, 32, MPFR_RNDN);
if (mpfr_cmp_ui (x, 3934042271UL))
{
printf ("Error in const_catalan for prec=32\n");
diff --git a/tests/tconst_euler.c b/tests/tconst_euler.c
index 89fc374dc..18d797fbe 100644
--- a/tests/tconst_euler.c
+++ b/tests/tconst_euler.c
@@ -32,7 +32,7 @@ my_const_euler (mpfr_ptr x, mpfr_srcptr y, mp_rnd_t r)
return mpfr_const_euler (x, r);
}
-#define RAND_FUNCTION(x) mpfr_set_ui ((x), 0, GMP_RNDN)
+#define RAND_FUNCTION(x) mpfr_set_ui ((x), 0, MPFR_RNDN)
#define TEST_FUNCTION my_const_euler
#include "tgeneric.c"
@@ -50,8 +50,8 @@ main (int argc, char *argv[])
if (argc > 1)
{
mpfr_init2 (gamma, prec);
- mpfr_const_euler (gamma, GMP_RNDN);
- printf("gamma="); mpfr_out_str (stdout, 10, 0, gamma, GMP_RNDD);
+ mpfr_const_euler (gamma, MPFR_RNDN);
+ printf("gamma="); mpfr_out_str (stdout, 10, 0, gamma, MPFR_RNDD);
puts ("");
mpfr_clear (gamma);
return 0;
@@ -63,7 +63,7 @@ main (int argc, char *argv[])
mpfr_set_prec (y, 32);
mpfr_set_prec (z, 32);
- (mpfr_const_euler) (y, GMP_RNDN);
+ (mpfr_const_euler) (y, MPFR_RNDN);
mpfr_set_str_binary (z, "0.10010011110001000110011111100011");
if (mpfr_cmp (y, z))
{
@@ -77,11 +77,11 @@ main (int argc, char *argv[])
mpfr_set_prec (t, prec);
yprec = prec + 10;
- for (rnd = 0; rnd < GMP_RND_MAX; rnd++)
+ for (rnd = 0; rnd < MPFR_RND_MAX; rnd++)
{
mpfr_set_prec (y, yprec);
mpfr_const_euler (y, (mp_rnd_t) rnd);
- err = (rnd == GMP_RNDN) ? yprec + 1 : yprec;
+ err = (rnd == MPFR_RNDN) ? yprec + 1 : yprec;
if (mpfr_can_round (y, err, (mp_rnd_t) rnd, (mp_rnd_t) rnd, prec))
{
mpfr_set (t, y, (mp_rnd_t) rnd);
@@ -91,10 +91,10 @@ main (int argc, char *argv[])
printf ("results differ for prec=%u rnd_mode=%s\n", prec,
mpfr_print_rnd_mode ((mp_rnd_t) rnd));
printf (" got ");
- mpfr_out_str (stdout, 2, prec, z, GMP_RNDN);
+ mpfr_out_str (stdout, 2, prec, z, MPFR_RNDN);
puts ("");
printf (" expected ");
- mpfr_out_str (stdout, 2, prec, t, GMP_RNDN);
+ mpfr_out_str (stdout, 2, prec, t, MPFR_RNDN);
puts ("");
printf (" approximation was ");
mpfr_print_binary (y);
diff --git a/tests/tconst_log2.c b/tests/tconst_log2.c
index 1dbbfa074..fcf4e06bd 100644
--- a/tests/tconst_log2.c
+++ b/tests/tconst_log2.c
@@ -37,7 +37,7 @@ check (mp_prec_t p0, mp_prec_t p1)
mpfr_init (x);
mpfr_init (y);
mpfr_init2 (z, p1 + 10);
- mpfr_const_log2 (z, GMP_RNDN);
+ mpfr_const_log2 (z, MPFR_RNDN);
mpfr_clear_cache (__gmpfr_cache_const_log2);
for (; p0<=p1; p0++)
@@ -49,7 +49,7 @@ check (mp_prec_t p0, mp_prec_t p1)
mpfr_const_log2 (x, rnd);
mpfr_set (y, z, rnd);
if ((dif = mpfr_cmp (x, y))
- && mpfr_can_round (z, mpfr_get_prec(z), GMP_RNDN,
+ && mpfr_can_round (z, mpfr_get_prec(z), MPFR_RNDN,
rnd, p0))
{
printf ("mpfr_const_log2 fails for prec=%u, rnd=%s Diff=%d\n",
@@ -72,9 +72,9 @@ check_large (void)
mpfr_t x, y;
mpfr_init2 (x, 25000);
mpfr_init2 (y, 26000);
- (mpfr_const_log2) (x, GMP_RNDN); /* First one ! */
- (mpfr_const_log2) (y, GMP_RNDN); /* Then the other - cache - */
- mpfr_prec_round (y, 25000, GMP_RNDN);
+ (mpfr_const_log2) (x, MPFR_RNDN); /* First one ! */
+ (mpfr_const_log2) (y, MPFR_RNDN); /* Then the other - cache - */
+ mpfr_prec_round (y, 25000, MPFR_RNDN);
if (mpfr_cmp (x, y))
{
printf ("const_log2: error for large prec\n");
@@ -84,7 +84,7 @@ check_large (void)
/* worst-case with 15 successive ones after last bit,
to exercise can_round loop */
mpfr_set_prec (x, 26249);
- mpfr_const_log2 (x, GMP_RNDZ);
+ mpfr_const_log2 (x, MPFR_RNDZ);
mpfr_clears (x, y, (mpfr_ptr) 0);
}
@@ -97,14 +97,14 @@ check_cache (void)
mpfr_init2 (x, 195);
mpfr_free_cache ();
- i = mpfr_const_log2 (x, GMP_RNDN);
+ i = mpfr_const_log2 (x, MPFR_RNDN);
if (i == 0)
{
printf("Error for log2. Invalid ternary value (1).\n");
exit (1);
}
mpfr_set_prec (x, 194);
- i = mpfr_const_log2 (x, GMP_RNDN);
+ i = mpfr_const_log2 (x, MPFR_RNDN);
if (i == 0)
{
printf("Error for log2. Invalid ternary value (2).\n");
@@ -113,10 +113,10 @@ check_cache (void)
mpfr_free_cache ();
mpfr_set_prec (x, 9);
- mpfr_const_log2 (x, GMP_RNDN);
+ mpfr_const_log2 (x, MPFR_RNDN);
mpfr_set_prec (x, 8);
- mpfr_const_log2 (x, GMP_RNDN);
- if (mpfr_cmp_str (x, "0.10110001E0", 2, GMP_RNDN))
+ mpfr_const_log2 (x, MPFR_RNDN);
+ if (mpfr_cmp_str (x, "0.10110001E0", 2, MPFR_RNDN))
{
printf("Error for log2. Wrong rounding.\n");
exit (1);
@@ -132,7 +132,7 @@ my_const_log2 (mpfr_ptr x, mpfr_srcptr y, mp_rnd_t r)
return mpfr_const_log2 (x, r);
}
-#define RAND_FUNCTION(x) mpfr_set_ui ((x), 0, GMP_RNDN)
+#define RAND_FUNCTION(x) mpfr_set_ui ((x), 0, MPFR_RNDN)
#define TEST_FUNCTION my_const_log2
#include "tgeneric.c"
@@ -146,7 +146,7 @@ main (int argc, char *argv[])
tests_start_mpfr ();
p = (argc>1) ? atoi(argv[1]) : 53;
- rnd = (argc>2) ? (mp_rnd_t) atoi(argv[2]) : GMP_RNDZ;
+ rnd = (argc>2) ? (mp_rnd_t) atoi(argv[2]) : MPFR_RNDZ;
mpfr_init (x);
@@ -154,12 +154,12 @@ main (int argc, char *argv[])
/* check precision of 2 bits */
mpfr_set_prec (x, 2);
- mpfr_const_log2 (x, GMP_RNDN);
+ mpfr_const_log2 (x, MPFR_RNDN);
if (mpfr_cmp_ui_2exp(x, 3, -2)) /* 3*2^-2 */
{
- printf ("mpfr_const_log2 failed for prec=2, rnd=GMP_RNDN\n"
+ printf ("mpfr_const_log2 failed for prec=2, rnd=MPFR_RNDN\n"
"expected 0.75, got ");
- mpfr_out_str(stdout, 10, 0, x, GMP_RNDN);
+ mpfr_out_str(stdout, 10, 0, x, MPFR_RNDN);
putchar('\n');
exit (1);
}
@@ -174,7 +174,7 @@ main (int argc, char *argv[])
}
mpfr_set_prec (x, 53);
- mpfr_const_log2 (x, GMP_RNDZ);
+ mpfr_const_log2 (x, MPFR_RNDZ);
if (mpfr_cmp_str1 (x, "6.9314718055994530941e-1") )
{
printf ("mpfr_const_log2 failed for prec=53\n");
@@ -182,7 +182,7 @@ main (int argc, char *argv[])
}
mpfr_set_prec (x, 32);
- mpfr_const_log2 (x, GMP_RNDN);
+ mpfr_const_log2 (x, MPFR_RNDN);
if (mpfr_cmp_str1 (x, "0.69314718060195446"))
{
printf ("mpfr_const_log2 failed for prec=32\n");
diff --git a/tests/tconst_pi.c b/tests/tconst_pi.c
index 120eabe14..b3eebfbc4 100644
--- a/tests/tconst_pi.c
+++ b/tests/tconst_pi.c
@@ -37,15 +37,15 @@ check_large (void)
mpfr_init2 (z, 11791);
/* The algo failed to round for p=11791. */
- (mpfr_const_pi) (z, GMP_RNDU);
- mpfr_const_pi (x, GMP_RNDN); /* First one ! */
- mpfr_const_pi (y, GMP_RNDN); /* Then the other - cache - */
- mpfr_prec_round (y, 20000, GMP_RNDN);
+ (mpfr_const_pi) (z, MPFR_RNDU);
+ mpfr_const_pi (x, MPFR_RNDN); /* First one ! */
+ mpfr_const_pi (y, MPFR_RNDN); /* Then the other - cache - */
+ mpfr_prec_round (y, 20000, MPFR_RNDN);
if (mpfr_cmp (x, y)) {
printf ("const_pi: error for large prec (%d)\n", 1);
exit (1);
}
- mpfr_prec_round (y, 11791, GMP_RNDU);
+ mpfr_prec_round (y, 11791, MPFR_RNDU);
if (mpfr_cmp (z, y)) {
printf ("const_pi: error for large prec (%d)\n", 2);
exit (1);
@@ -54,7 +54,7 @@ check_large (void)
/* a worst-case to exercise recomputation */
if (MPFR_PREC_MAX > 33440) {
mpfr_set_prec (x, 33440);
- mpfr_const_pi (x, GMP_RNDZ);
+ mpfr_const_pi (x, MPFR_RNDZ);
}
mpfr_clears (x, y, z, (mpfr_ptr) 0);
@@ -67,7 +67,7 @@ my_const_pi (mpfr_ptr x, mpfr_srcptr y, mp_rnd_t r)
return mpfr_const_pi (x, r);
}
-#define RAND_FUNCTION(x) mpfr_set_ui ((x), 0, GMP_RNDN)
+#define RAND_FUNCTION(x) mpfr_set_ui ((x), 0, MPFR_RNDN)
#define TEST_FUNCTION my_const_pi
#include "tgeneric.c"
@@ -88,7 +88,7 @@ main (int argc, char *argv[])
p = a;
}
- rnd = (argc > 2) ? (mp_rnd_t) atoi(argv[2]) : GMP_RNDZ;
+ rnd = (argc > 2) ? (mp_rnd_t) atoi(argv[2]) : MPFR_RNDZ;
mpfr_init2 (x, p);
mpfr_const_pi (x, rnd);
@@ -104,12 +104,12 @@ main (int argc, char *argv[])
else if (mpfr_cmp_str1 (x, "3.141592653589793116") )
{
printf ("mpfr_const_pi failed for prec=53\n");
- mpfr_out_str (stdout, 10, 0, x, GMP_RNDN); putchar('\n');
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN); putchar('\n');
exit (1);
}
mpfr_set_prec (x, 32);
- mpfr_const_pi (x, GMP_RNDN);
+ mpfr_const_pi (x, MPFR_RNDN);
if (mpfr_cmp_str1 (x, "3.141592653468251") )
{
printf ("mpfr_const_pi failed for prec=32\n");
diff --git a/tests/tcopysign.c b/tests/tcopysign.c
index c1693a880..91bbe918b 100644
--- a/tests/tcopysign.c
+++ b/tests/tcopysign.c
@@ -33,22 +33,22 @@ copysign_variant (mpfr_ptr z, mpfr_srcptr x, mpfr_srcptr y,
switch (k)
{
case 0:
- mpfr_copysign (z, x, y, GMP_RNDN);
+ mpfr_copysign (z, x, y, MPFR_RNDN);
return;
case 1:
- (mpfr_copysign) (z, x, y, GMP_RNDN);
+ (mpfr_copysign) (z, x, y, MPFR_RNDN);
return;
case 2:
- mpfr_setsign (z, x, mpfr_signbit (y), GMP_RNDN);
+ mpfr_setsign (z, x, mpfr_signbit (y), MPFR_RNDN);
return;
case 3:
- mpfr_setsign (z, x, (mpfr_signbit) (y), GMP_RNDN);
+ mpfr_setsign (z, x, (mpfr_signbit) (y), MPFR_RNDN);
return;
case 4:
- (mpfr_setsign) (z, x, mpfr_signbit (y), GMP_RNDN);
+ (mpfr_setsign) (z, x, mpfr_signbit (y), MPFR_RNDN);
return;
case 5:
- (mpfr_setsign) (z, x, (mpfr_signbit) (y), GMP_RNDN);
+ (mpfr_setsign) (z, x, (mpfr_signbit) (y), MPFR_RNDN);
return;
}
}
@@ -73,7 +73,7 @@ main (void)
i ? MPFR_SET_NEG (x) : MPFR_SET_POS (x);
mpfr_set_nan (y);
j ? MPFR_SET_NEG (y) : MPFR_SET_POS (y);
- copysign_variant (z, x, y, GMP_RNDN, k);
+ copysign_variant (z, x, y, MPFR_RNDN, k);
if (MPFR_SIGN (z) != MPFR_SIGN (y) || !mpfr_nanflag_p ())
{
printf ("Error in mpfr_copysign (%cNaN, %cNaN)\n",
@@ -81,12 +81,12 @@ main (void)
exit (1);
}
- mpfr_set_si (x, i ? -1250 : 1250, GMP_RNDN);
+ mpfr_set_si (x, i ? -1250 : 1250, MPFR_RNDN);
mpfr_set_nan (y);
j ? MPFR_SET_NEG (y) : MPFR_SET_POS (y);
- copysign_variant (z, x, y, GMP_RNDN, k);
+ copysign_variant (z, x, y, MPFR_RNDN, k);
if (i != j)
- mpfr_neg (x, x, GMP_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN);
if (! mpfr_equal_p (z, x) || mpfr_nanflag_p ())
{
printf ("Error in mpfr_copysign (%c1250, %cNaN)\n",
@@ -94,11 +94,11 @@ main (void)
exit (1);
}
- mpfr_set_si (x, i ? -1250 : 1250, GMP_RNDN);
- mpfr_set_si (y, j ? -1717 : 1717, GMP_RNDN);
- copysign_variant (z, x, y, GMP_RNDN, k);
+ mpfr_set_si (x, i ? -1250 : 1250, MPFR_RNDN);
+ mpfr_set_si (y, j ? -1717 : 1717, MPFR_RNDN);
+ copysign_variant (z, x, y, MPFR_RNDN, k);
if (i != j)
- mpfr_neg (x, x, GMP_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN);
if (! mpfr_equal_p (z, x) || mpfr_nanflag_p ())
{
printf ("Error in mpfr_copysign (%c1250, %c1717)\n",
diff --git a/tests/tcos.c b/tests/tcos.c
index 4cbef916d..eedc40b26 100644
--- a/tests/tcos.c
+++ b/tests/tcos.c
@@ -30,7 +30,7 @@ static int
test_cos (mpfr_ptr a, mpfr_srcptr b, mp_rnd_t rnd_mode)
{
int res;
- int ok = rnd_mode == GMP_RNDN && mpfr_number_p (b) && mpfr_get_prec (a)>=53;
+ int ok = rnd_mode == MPFR_RNDN && mpfr_number_p (b) && mpfr_get_prec (a)>=53;
if (ok)
{
mpfr_print_raw (b);
@@ -61,7 +61,7 @@ check53 (const char *xs, const char *cos_xs, mp_rnd_t rnd_mode)
printf ("mpfr_cos failed for x=%s, rnd=%s\n",
xs, mpfr_print_rnd_mode (rnd_mode));
printf ("mpfr_cos gives cos(x)=");
- mpfr_out_str(stdout, 10, 0, c, GMP_RNDN);
+ mpfr_out_str(stdout, 10, 0, c, MPFR_RNDN);
printf(", expected %s\n", cos_xs);
exit (1);
}
@@ -81,7 +81,7 @@ check_nans (void)
mpfr_init2 (y, 123L);
mpfr_set_nan (x);
- test_cos (y, x, GMP_RNDN);
+ test_cos (y, x, MPFR_RNDN);
if (! mpfr_nan_p (y))
{
printf ("Error: cos(NaN) != NaN\n");
@@ -89,7 +89,7 @@ check_nans (void)
}
mpfr_set_inf (x, 1);
- test_cos (y, x, GMP_RNDN);
+ test_cos (y, x, MPFR_RNDN);
if (! mpfr_nan_p (y))
{
printf ("Error: cos(Inf) != NaN\n");
@@ -97,7 +97,7 @@ check_nans (void)
}
mpfr_set_inf (x, -1);
- test_cos (y, x, GMP_RNDN);
+ test_cos (y, x, MPFR_RNDN);
if (! mpfr_nan_p (y))
{
printf ("Error: cos(-Inf) != NaN\n");
@@ -105,15 +105,15 @@ check_nans (void)
}
/* cos(+/-0) = 1 */
- mpfr_set_ui (x, 0, GMP_RNDN);
- test_cos (y, x, GMP_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ test_cos (y, x, MPFR_RNDN);
if (mpfr_cmp_ui (y, 1))
{
printf ("Error: cos(+0) != 1\n");
exit (1);
}
- mpfr_neg (x, x, GMP_RNDN);
- test_cos (y, x, GMP_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN);
+ test_cos (y, x, MPFR_RNDN);
if (mpfr_cmp_ui (y, 1))
{
printf ("Error: cos(-0) != 1\n");
@@ -123,10 +123,10 @@ check_nans (void)
/* Compute ~Pi/2 to check */
/* FIXME: Too slow!
mpfr_set_prec (x, 20000);
- mpfr_const_pi (x, GMP_RNDD); mpfr_div_2ui (x, x, 1, GMP_RNDN);
+ mpfr_const_pi (x, MPFR_RNDD); mpfr_div_2ui (x, x, 1, MPFR_RNDN);
mpfr_set_prec (y, 24);
- test_cos (y, x, GMP_RNDN);
- if (mpfr_cmp_str (y, "0.111001010110100011000001E-20000", 2, GMP_RNDN))
+ test_cos (y, x, MPFR_RNDN);
+ if (mpfr_cmp_str (y, "0.111001010110100011000001E-20000", 2, MPFR_RNDN))
{
printf("Error computing cos(~Pi/2)\n");
mpfr_dump (y);
@@ -153,7 +153,7 @@ special_overflow (void)
set_emin (-125);
set_emax (128);
mpfr_set_str_binary (x, "0.111101010110110011101101E6");
- test_cos (y, x, GMP_RNDZ);
+ test_cos (y, x, MPFR_RNDZ);
set_emin (emin);
set_emax (emax);
@@ -175,17 +175,17 @@ overflowed_cos0 (void)
for (emax = -1; emax <= 0; emax++)
{
- mpfr_set_ui_2exp (y, 1, emax, GMP_RNDN);
+ mpfr_set_ui_2exp (y, 1, emax, MPFR_RNDN);
mpfr_nextbelow (y);
set_emax (emax); /* 1 is not representable. */
/* and if emax < 0, 1 - eps is not representable either. */
for (i = -1; i <= 1; i++)
RND_LOOP (rnd)
{
- mpfr_set_si_2exp (x, i, -512 * ABS (i), GMP_RNDN);
+ mpfr_set_si_2exp (x, i, -512 * ABS (i), MPFR_RNDN);
mpfr_clear_flags ();
inex = mpfr_cos (x, x, (mp_rnd_t) rnd);
- if ((i == 0 || emax < 0 || rnd == GMP_RNDN || rnd == GMP_RNDU) &&
+ if ((i == 0 || emax < 0 || rnd == MPFR_RNDN || rnd == MPFR_RNDU) &&
! mpfr_overflow_p ())
{
printf ("Error in overflowed_cos0 (i = %d, rnd = %s):\n"
@@ -193,7 +193,7 @@ overflowed_cos0 (void)
i, mpfr_print_rnd_mode ((mp_rnd_t) rnd));
err = 1;
}
- if (rnd == GMP_RNDZ || rnd == GMP_RNDD)
+ if (rnd == MPFR_RNDZ || rnd == MPFR_RNDD)
{
if (inex >= 0)
{
@@ -255,17 +255,17 @@ main (int argc, char *argv[])
mpfr_set_prec (x, 53);
mpfr_set_prec (y, 2);
- mpfr_set_str (x, "9.81333845856942e-1", 10, GMP_RNDN);
- test_cos (y, x, GMP_RNDN);
+ mpfr_set_str (x, "9.81333845856942e-1", 10, MPFR_RNDN);
+ test_cos (y, x, MPFR_RNDN);
mpfr_set_prec (x, 30);
mpfr_set_prec (y, 30);
mpfr_set_str_binary (x, "1.00001010001101110010100010101e-1");
- test_cos (y, x, GMP_RNDU);
+ test_cos (y, x, MPFR_RNDU);
mpfr_set_str_binary (x, "1.10111100010101011110101010100e-1");
if (mpfr_cmp (y, x))
{
- printf ("Error for prec=30, rnd=GMP_RNDU\n");
+ printf ("Error for prec=30, rnd=MPFR_RNDU\n");
printf ("expected "); mpfr_print_binary (x); puts ("");
printf (" got "); mpfr_print_binary (y); puts ("");
exit (1);
@@ -274,11 +274,11 @@ main (int argc, char *argv[])
mpfr_set_prec (x, 59);
mpfr_set_prec (y, 59);
mpfr_set_str_binary (x, "1.01101011101111010011111110111111111011011101100111100011e-3");
- test_cos (y, x, GMP_RNDU);
+ test_cos (y, x, MPFR_RNDU);
mpfr_set_str_binary (x, "1.1111011111110010001001001011100111101110100010000010010011e-1");
if (mpfr_cmp (y, x))
{
- printf ("Error for prec=59, rnd=GMP_RNDU\n");
+ printf ("Error for prec=59, rnd=MPFR_RNDU\n");
printf ("expected "); mpfr_print_binary (x); puts ("");
printf (" got "); mpfr_print_binary (y); puts ("");
exit (1);
@@ -287,11 +287,11 @@ main (int argc, char *argv[])
mpfr_set_prec (x, 5);
mpfr_set_prec (y, 5);
mpfr_set_str_binary (x, "1.1100e-2");
- test_cos (y, x, GMP_RNDD);
+ test_cos (y, x, MPFR_RNDD);
mpfr_set_str_binary (x, "1.1100e-1");
if (mpfr_cmp (y, x))
{
- printf ("Error for x=1.1100e-2, rnd=GMP_RNDD\n");
+ printf ("Error for x=1.1100e-2, rnd=MPFR_RNDD\n");
printf ("expected 1.1100e-1, got "); mpfr_print_binary (y); puts ("");
exit (1);
}
@@ -301,7 +301,7 @@ main (int argc, char *argv[])
mpfr_set_str_binary (x, "0.10001000001001011000100001E-6");
mpfr_set_str_binary (y, "0.1111111111111101101111001100001");
- test_cos (x, x, GMP_RNDN);
+ test_cos (x, x, MPFR_RNDN);
if (mpfr_cmp (x, y))
{
printf ("Error for prec=32 (1)\n");
@@ -310,7 +310,7 @@ main (int argc, char *argv[])
mpfr_set_str_binary (x, "-0.1101011110111100111010011001011E-1");
mpfr_set_str_binary (y, "0.11101001100110111011011010100011");
- test_cos (x, x, GMP_RNDN);
+ test_cos (x, x, MPFR_RNDN);
if (mpfr_cmp (x, y))
{
printf ("Error for prec=32 (2)\n");
@@ -320,7 +320,7 @@ main (int argc, char *argv[])
/* huge argument reduction */
mpfr_set_str_binary (x, "0.10000010000001101011101111001011E40");
mpfr_set_str_binary (y, "0.10011000001111010000101011001011E-1");
- test_cos (x, x, GMP_RNDN);
+ test_cos (x, x, MPFR_RNDN);
if (mpfr_cmp (x, y))
{
printf ("Error for prec=32 (3)\n");
@@ -330,20 +330,20 @@ main (int argc, char *argv[])
mpfr_set_prec (x, 3);
mpfr_set_prec (y, 3);
mpfr_set_str_binary (x, "0.110E60");
- inex = mpfr_cos (y, x, GMP_RNDD);
+ inex = mpfr_cos (y, x, MPFR_RNDD);
MPFR_ASSERTN(inex < 0);
/* worst case from PhD thesis of Vincent Lefe`vre: x=8980155785351021/2^54 */
- check53 ("4.984987858808754279e-1", "8.783012931285841817e-1", GMP_RNDN);
- check53 ("4.984987858808754279e-1", "8.783012931285840707e-1", GMP_RNDD);
- check53 ("4.984987858808754279e-1", "8.783012931285840707e-1", GMP_RNDZ);
- check53 ("4.984987858808754279e-1", "8.783012931285841817e-1", GMP_RNDU);
- check53 ("1.00031274099908640274", "0.540039116973283217504", GMP_RNDN);
- check53 ("1.00229256850978698523", "0.538371757797526551137", GMP_RNDZ);
- check53 ("1.00288304857059840103", "0.537874062022526966409", GMP_RNDZ);
- check53 ("1.00591265847407274059", "0.53531755997839769456", GMP_RNDN);
+ check53 ("4.984987858808754279e-1", "8.783012931285841817e-1", MPFR_RNDN);
+ check53 ("4.984987858808754279e-1", "8.783012931285840707e-1", MPFR_RNDD);
+ check53 ("4.984987858808754279e-1", "8.783012931285840707e-1", MPFR_RNDZ);
+ check53 ("4.984987858808754279e-1", "8.783012931285841817e-1", MPFR_RNDU);
+ check53 ("1.00031274099908640274", "0.540039116973283217504", MPFR_RNDN);
+ check53 ("1.00229256850978698523", "0.538371757797526551137", MPFR_RNDZ);
+ check53 ("1.00288304857059840103", "0.537874062022526966409", MPFR_RNDZ);
+ check53 ("1.00591265847407274059", "0.53531755997839769456", MPFR_RNDN);
- check53 ("1.00591265847407274059", "0.53531755997839769456", GMP_RNDN);
+ check53 ("1.00591265847407274059", "0.53531755997839769456", MPFR_RNDN);
overflowed_cos0 ();
test_generic (2, 100, 15);
@@ -352,7 +352,7 @@ main (int argc, char *argv[])
mpfr_set_prec (x, 3);
mpfr_set_prec (y, 13);
mpfr_set_str_binary (x, "-0.100E196");
- inex = mpfr_cos (y, x, GMP_RNDU);
+ inex = mpfr_cos (y, x, MPFR_RNDU);
mpfr_set_prec (x, 13);
mpfr_set_str_binary (x, "0.1111111100101");
MPFR_ASSERTN (inex > 0 && mpfr_equal_p (x, y));
diff --git a/tests/tcosh.c b/tests/tcosh.c
index 1326b2c7c..e6abe2098 100644
--- a/tests/tcosh.c
+++ b/tests/tcosh.c
@@ -40,7 +40,7 @@ special (void)
mpfr_init (y);
mpfr_set_nan (x);
- mpfr_cosh (y, x, GMP_RNDN);
+ mpfr_cosh (y, x, MPFR_RNDN);
if (!mpfr_nan_p (y))
{
printf ("Error: cosh(NaN) != NaN\n");
@@ -48,7 +48,7 @@ special (void)
}
mpfr_set_inf (x, 1);
- mpfr_cosh (y, x, GMP_RNDN);
+ mpfr_cosh (y, x, MPFR_RNDN);
if (!mpfr_inf_p (y) || mpfr_sgn (y) < 0)
{
printf ("Error: cosh(+Inf) != +Inf\n");
@@ -56,7 +56,7 @@ special (void)
}
mpfr_set_inf (x, -1);
- mpfr_cosh (y, x, GMP_RNDN);
+ mpfr_cosh (y, x, MPFR_RNDN);
if (!mpfr_inf_p (y) || mpfr_sgn (y) < 0)
{
printf ("Error: cosh(-Inf) != +Inf\n");
@@ -64,15 +64,15 @@ special (void)
}
/* cosh(+/-0) = 1 */
- mpfr_set_ui (x, 0, GMP_RNDN);
- mpfr_cosh (y, x, GMP_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_cosh (y, x, MPFR_RNDN);
if (mpfr_cmp_ui (y, 1))
{
printf ("Error: cosh(+0) != 1\n");
exit (1);
}
- mpfr_neg (x, x, GMP_RNDN);
- mpfr_cosh (y, x, GMP_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN);
+ mpfr_cosh (y, x, MPFR_RNDN);
if (mpfr_cmp_ui (y, 1))
{
printf ("Error: cosh(-0) != 1\n");
@@ -84,7 +84,7 @@ special (void)
mpfr_set_str_binary (x, "0.1101110111111111001011101000101");
mpfr_set_str_binary (y, "1.0110011001110000101100011001001");
- mpfr_cosh (x, x, GMP_RNDN);
+ mpfr_cosh (x, x, MPFR_RNDN);
if (mpfr_cmp (x, y))
{
printf ("Error: mpfr_cosh for prec=32 (1)\n");
@@ -93,7 +93,7 @@ special (void)
mpfr_set_str_binary (x, "-0.1110111000011101010111100000101E-1");
mpfr_set_str_binary (y, "1.0001110000101111111111100110101");
- mpfr_cosh (x, x, GMP_RNDN);
+ mpfr_cosh (x, x, MPFR_RNDN);
if (mpfr_cmp (x, y))
{
printf ("Error: mpfr_cosh for prec=32 (2)\n");
@@ -103,28 +103,28 @@ special (void)
mpfr_set_prec (x, 2);
mpfr_clear_flags ();
mpfr_set_str_binary (x, "1E1000000000");
- i = mpfr_cosh (x, x, GMP_RNDN);
+ i = mpfr_cosh (x, x, MPFR_RNDN);
MPFR_ASSERTN (MPFR_IS_INF (x) && MPFR_SIGN (x) > 0);
MPFR_ASSERTN (mpfr_overflow_p ());
MPFR_ASSERTN (i == 1);
mpfr_clear_flags ();
mpfr_set_str_binary (x, "-1E1000000000");
- i = mpfr_cosh (x, x, GMP_RNDN);
+ i = mpfr_cosh (x, x, MPFR_RNDN);
MPFR_ASSERTN (MPFR_IS_INF (x) && MPFR_SIGN (x) > 0);
MPFR_ASSERTN (mpfr_overflow_p () && !mpfr_underflow_p ());
MPFR_ASSERTN (i == 1);
mpfr_clear_flags ();
mpfr_set_str_binary (x, "-1E1000000000");
- i = mpfr_cosh (x, x, GMP_RNDD);
+ i = mpfr_cosh (x, x, MPFR_RNDD);
MPFR_ASSERTN (!MPFR_IS_INF (x) && MPFR_SIGN (x) > 0);
MPFR_ASSERTN (mpfr_overflow_p () && !mpfr_underflow_p ());
MPFR_ASSERTN (i == -1);
mpfr_clear_flags ();
mpfr_set_str_binary (x, "-1E1000000000");
- i = mpfr_cosh (x, x, GMP_RNDU);
+ i = mpfr_cosh (x, x, MPFR_RNDU);
MPFR_ASSERTN (MPFR_IS_INF (x) && MPFR_SIGN (x) > 0);
MPFR_ASSERTN (mpfr_overflow_p () && !mpfr_underflow_p ());
MPFR_ASSERTN (i == 1);
@@ -153,8 +153,8 @@ special_overflow (void)
mpfr_init2 (y, 24);
mpfr_set_str_binary (x, "0.101100100000000000110100E7");
- mpfr_cosh (y, x, GMP_RNDN);
- if (mpfr_cmp_str (y, "0.101010001111001010001110E128", 2, GMP_RNDN))
+ mpfr_cosh (y, x, MPFR_RNDN);
+ if (mpfr_cmp_str (y, "0.101010001111001010001110E128", 2, MPFR_RNDN))
{
printf("Special overflow error 1.\n");
mpfr_dump (y);
@@ -162,7 +162,7 @@ special_overflow (void)
}
mpfr_set_str_binary (x, "0.101100100000000000110100E8");
- mpfr_cosh (y, x, GMP_RNDN);
+ mpfr_cosh (y, x, MPFR_RNDN);
if (!mpfr_inf_p(y))
{
printf("Special overflow error 2.\n");
@@ -174,7 +174,7 @@ special_overflow (void)
set_emax (emax);
mpfr_set_str_binary (x, "0.101100100000000000110100E1000000");
- mpfr_cosh (y, x, GMP_RNDN);
+ mpfr_cosh (y, x, MPFR_RNDN);
if (!mpfr_inf_p(y))
{
printf("Special overflow error 3.\n");
diff --git a/tests/tcot.c b/tests/tcot.c
index 4062c436a..bb33c6acb 100644
--- a/tests/tcot.c
+++ b/tests/tcot.c
@@ -38,7 +38,7 @@ check_specials (void)
mpfr_init2 (y, 123L);
mpfr_set_nan (x);
- mpfr_cot (y, x, GMP_RNDN);
+ mpfr_cot (y, x, MPFR_RNDN);
if (! mpfr_nan_p (y))
{
printf ("Error: cot(NaN) != NaN\n");
@@ -46,7 +46,7 @@ check_specials (void)
}
mpfr_set_inf (x, 1);
- mpfr_cot (y, x, GMP_RNDN);
+ mpfr_cot (y, x, MPFR_RNDN);
if (! mpfr_nan_p (y))
{
printf ("Error: cot(Inf) != NaN\n");
@@ -54,7 +54,7 @@ check_specials (void)
}
mpfr_set_inf (x, -1);
- mpfr_cot (y, x, GMP_RNDN);
+ mpfr_cot (y, x, MPFR_RNDN);
if (! mpfr_nan_p (y))
{
printf ("Error: cot(-Inf) != NaN\n");
@@ -62,15 +62,15 @@ check_specials (void)
}
/* cot(+/-0) = +/-Inf */
- mpfr_set_ui (x, 0, GMP_RNDN);
- mpfr_cot (y, x, GMP_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_cot (y, x, MPFR_RNDN);
if (! (mpfr_inf_p (y) && mpfr_sgn (y) > 0))
{
printf ("Error: cot(+0) != +Inf\n");
exit (1);
}
- mpfr_neg (x, x, GMP_RNDN);
- mpfr_cot (y, x, GMP_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN);
+ mpfr_cot (y, x, MPFR_RNDN);
if (! (mpfr_inf_p (y) && mpfr_sgn (y) < 0))
{
printf ("Error: cot(-0) != -Inf\n");
@@ -101,14 +101,14 @@ two2emin (mp_exp_t e)
for (i = -4; i <= 4; i++)
RND_LOOP (rnd)
{
- mpfr_set_si (y, i, GMP_RNDN);
+ mpfr_set_si (y, i, MPFR_RNDN);
mpfr_ui_div (y, 1, y, (mp_rnd_t) rnd); /* no overflow/underflow */
- mpfr_set_si_2exp (x, i, -e, GMP_RNDN);
+ mpfr_set_si_2exp (x, i, -e, MPFR_RNDN);
if (ABS (i) != 3) /* not a power of 2 (not 0 either) */
mpfr_sub (y, y, x, (mp_rnd_t) rnd); /* no overflow/underflow */
- mpfr_set_ui_2exp (x, 1, -e, GMP_RNDN);
+ mpfr_set_ui_2exp (x, 1, -e, MPFR_RNDN);
mpfr_div (y, y, x, (mp_rnd_t) rnd); /* 1/x - SIGN(x).epsilon */
- mpfr_set_si_2exp (x, i, -e, GMP_RNDN);
+ mpfr_set_si_2exp (x, i, -e, MPFR_RNDN);
mpfr_cot (x, x, (mp_rnd_t) rnd);
if (! mpfr_equal_p (x, y))
{
diff --git a/tests/tcoth.c b/tests/tcoth.c
index be2373bd5..5ab4ee204 100644
--- a/tests/tcoth.c
+++ b/tests/tcoth.c
@@ -37,7 +37,7 @@ check_specials (void)
mpfr_init2 (y, 123L);
mpfr_set_nan (x);
- mpfr_coth (y, x, GMP_RNDN);
+ mpfr_coth (y, x, MPFR_RNDN);
if (! mpfr_nan_p (y))
{
printf ("Error: coth(NaN) != NaN\n");
@@ -45,7 +45,7 @@ check_specials (void)
}
mpfr_set_inf (x, 1);
- mpfr_coth (y, x, GMP_RNDN);
+ mpfr_coth (y, x, MPFR_RNDN);
if (mpfr_cmp_ui (y, 1))
{
printf ("Error: coth(Inf) != 1\n");
@@ -53,7 +53,7 @@ check_specials (void)
}
mpfr_set_inf (x, -1);
- mpfr_coth (y, x, GMP_RNDN);
+ mpfr_coth (y, x, MPFR_RNDN);
if (mpfr_cmp_si (y, -1))
{
printf ("Error: coth(-Inf) != -1\n");
@@ -61,15 +61,15 @@ check_specials (void)
}
/* cot(+/-0) = +/-0 */
- mpfr_set_ui (x, 0, GMP_RNDN);
- mpfr_coth (y, x, GMP_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_coth (y, x, MPFR_RNDN);
if (! (mpfr_zero_p (y) && MPFR_SIGN (y) > 0))
{
printf ("Error: coth(+0) != +0\n");
exit (1);
}
- mpfr_neg (x, x, GMP_RNDN);
- mpfr_coth (y, x, GMP_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN);
+ mpfr_coth (y, x, MPFR_RNDN);
if (! (mpfr_zero_p (y) && MPFR_SIGN (y) < 0))
{
printf ("Error: coth(-0) != -0\n");
@@ -89,9 +89,9 @@ check_bugs (void)
mpfr_init (y);
/* bug found by Rob (Sisyphus) on 16 Sep 2005 */
- mpfr_set_ui (x, 2, GMP_RNDN);
+ mpfr_set_ui (x, 2, MPFR_RNDN);
mpfr_set_prec (y, 2);
- mpfr_coth (y, x, GMP_RNDN);
+ mpfr_coth (y, x, MPFR_RNDN);
if (mpfr_cmp_ui (y, 1))
{
printf ("Error for coth(2), expected 1, got ");
@@ -102,25 +102,25 @@ check_bugs (void)
mpfr_set_prec (x, 53);
mpfr_set_prec (y, 53);
- mpfr_set_str (x, "18.368400284838550", 10, GMP_RNDN);
- mpfr_set_str (y, "1.0000000000000002", 10, GMP_RNDN);
- mpfr_coth (x, x, GMP_RNDN);
+ mpfr_set_str (x, "18.368400284838550", 10, MPFR_RNDN);
+ mpfr_set_str (y, "1.0000000000000002", 10, MPFR_RNDN);
+ mpfr_coth (x, x, MPFR_RNDN);
if (mpfr_cmp (x, y) != 0)
{
printf ("Error for coth(18.368400284838550)\n");
exit (1);
}
- mpfr_set_str (x, "18.714973875118520", 10, GMP_RNDN);
- mpfr_coth (x, x, GMP_RNDN);
+ mpfr_set_str (x, "18.714973875118520", 10, MPFR_RNDN);
+ mpfr_coth (x, x, MPFR_RNDN);
if (mpfr_cmp (x, y) != 0)
{
printf ("Error for coth(18.714973875118520)\n");
exit (1);
}
- mpfr_set_str (x, "18.714973875118524", 10, GMP_RNDN);
- mpfr_coth (x, x, GMP_RNDN);
+ mpfr_set_str (x, "18.714973875118524", 10, MPFR_RNDN);
+ mpfr_coth (x, x, MPFR_RNDN);
if (mpfr_cmp_ui (x, 1) != 0)
{
printf ("Error for coth(18.714973875118524)\n");
@@ -158,11 +158,11 @@ underflowed_cothinf (void)
i, mpfr_print_rnd_mode ((mp_rnd_t) rnd));
err = 1;
}
- mpfr_set_si (y, (i < 0 && (rnd == GMP_RNDD || rnd == GMP_RNDA)) ||
- (i > 0 && (rnd == GMP_RNDU || rnd == GMP_RNDA))
- ? 2 : 0, GMP_RNDN);
+ mpfr_set_si (y, (i < 0 && (rnd == MPFR_RNDD || rnd == MPFR_RNDA)) ||
+ (i > 0 && (rnd == MPFR_RNDU || rnd == MPFR_RNDA))
+ ? 2 : 0, MPFR_RNDN);
if (i < 0)
- mpfr_neg (y, y, GMP_RNDN);
+ mpfr_neg (y, y, MPFR_RNDN);
if (! (mpfr_equal_p (x, y) &&
MPFR_MULT_SIGN (MPFR_SIGN (x), MPFR_SIGN (y)) > 0))
{
@@ -174,16 +174,16 @@ underflowed_cothinf (void)
printf (".\n");
err = 1;
}
- if ((rnd == GMP_RNDD ||
- (i > 0 && (rnd == GMP_RNDN || rnd == GMP_RNDZ))) && inex >= 0)
+ if ((rnd == MPFR_RNDD ||
+ (i > 0 && (rnd == MPFR_RNDN || rnd == MPFR_RNDZ))) && inex >= 0)
{
printf ("Error in underflowed_cothinf (i = %d, rnd = %s):\n"
" The inexact value must be negative.\n",
i, mpfr_print_rnd_mode ((mp_rnd_t) rnd));
err = 1;
}
- if ((rnd == GMP_RNDU ||
- (i < 0 && (rnd == GMP_RNDN || rnd == GMP_RNDZ))) && inex <= 0)
+ if ((rnd == MPFR_RNDU ||
+ (i < 0 && (rnd == MPFR_RNDN || rnd == MPFR_RNDZ))) && inex <= 0)
{
printf ("Error in underflowed_cothinf (i = %d, rnd = %s):\n"
" The inexact value must be positive.\n",
diff --git a/tests/tcsc.c b/tests/tcsc.c
index 136d7f3d4..088d7bb9c 100644
--- a/tests/tcsc.c
+++ b/tests/tcsc.c
@@ -38,7 +38,7 @@ check_specials (void)
mpfr_init2 (y, 123L);
mpfr_set_nan (x);
- mpfr_csc (y, x, GMP_RNDN);
+ mpfr_csc (y, x, MPFR_RNDN);
if (! mpfr_nan_p (y))
{
printf ("Error: csc(NaN) != NaN\n");
@@ -46,7 +46,7 @@ check_specials (void)
}
mpfr_set_inf (x, 1);
- mpfr_csc (y, x, GMP_RNDN);
+ mpfr_csc (y, x, MPFR_RNDN);
if (! mpfr_nan_p (y))
{
printf ("Error: csc(Inf) != NaN\n");
@@ -54,7 +54,7 @@ check_specials (void)
}
mpfr_set_inf (x, -1);
- mpfr_csc (y, x, GMP_RNDN);
+ mpfr_csc (y, x, MPFR_RNDN);
if (! mpfr_nan_p (y))
{
printf ("Error: csc(-Inf) != NaN\n");
@@ -62,15 +62,15 @@ check_specials (void)
}
/* csc(+/-0) = +/-Inf */
- mpfr_set_ui (x, 0, GMP_RNDN);
- mpfr_csc (y, x, GMP_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_csc (y, x, MPFR_RNDN);
if (! (mpfr_inf_p (y) && mpfr_sgn (y) > 0))
{
printf ("Error: csc(+0) != +Inf\n");
exit (1);
}
- mpfr_neg (x, x, GMP_RNDN);
- mpfr_csc (y, x, GMP_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN);
+ mpfr_csc (y, x, MPFR_RNDN);
if (! (mpfr_inf_p (y) && mpfr_sgn (y) < 0))
{
printf ("Error: csc(-0) != -Inf\n");
diff --git a/tests/tcsch.c b/tests/tcsch.c
index bf391516b..f48861a90 100644
--- a/tests/tcsch.c
+++ b/tests/tcsch.c
@@ -38,7 +38,7 @@ check_specials (void)
mpfr_init2 (y, 123L);
mpfr_set_nan (x);
- mpfr_csch (y, x, GMP_RNDN);
+ mpfr_csch (y, x, MPFR_RNDN);
if (! mpfr_nan_p (y))
{
printf ("Error: csch(NaN) != NaN\n");
@@ -46,7 +46,7 @@ check_specials (void)
}
mpfr_set_inf (x, 1);
- mpfr_csch (y, x, GMP_RNDN);
+ mpfr_csch (y, x, MPFR_RNDN);
if (! (mpfr_zero_p (y) && MPFR_SIGN (y) >0))
{
printf ("Error: csch(+Inf) != +0\n");
@@ -54,7 +54,7 @@ check_specials (void)
}
mpfr_set_inf (x, -1);
- mpfr_csch (y, x, GMP_RNDN);
+ mpfr_csch (y, x, MPFR_RNDN);
if (! (mpfr_zero_p (y) && MPFR_SIGN (y) <0))
{
printf ("Error: csch(-0) != -0\n");
@@ -62,15 +62,15 @@ check_specials (void)
}
/* csc(+/-0) = +/-Inf */
- mpfr_set_ui (x, 0, GMP_RNDN);
- mpfr_csch (y, x, GMP_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_csch (y, x, MPFR_RNDN);
if (! (mpfr_inf_p (y) && mpfr_sgn (y) > 0))
{
printf ("Error: csch(+0) != +Inf\n");
exit (1);
}
- mpfr_neg (x, x, GMP_RNDN);
- mpfr_csch (y, x, GMP_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN);
+ mpfr_csch (y, x, MPFR_RNDN);
if (! (mpfr_inf_p (y) && mpfr_sgn (y) < 0))
{
printf ("Error: csch(-0) != -Inf\n");
@@ -78,15 +78,15 @@ check_specials (void)
}
/* check huge x */
- mpfr_set_str (x, "8e8", 10, GMP_RNDN);
- mpfr_csch (y, x, GMP_RNDN);
+ mpfr_set_str (x, "8e8", 10, MPFR_RNDN);
+ mpfr_csch (y, x, MPFR_RNDN);
if (! (mpfr_zero_p (y) && MPFR_SIGN (y) > 0))
{
printf ("Error: csch(8e8) != +0\n");
exit (1);
}
- mpfr_set_str (x, "-8e8", 10, GMP_RNDN);
- mpfr_csch (y, x, GMP_RNDN);
+ mpfr_set_str (x, "-8e8", 10, MPFR_RNDN);
+ mpfr_csch (y, x, MPFR_RNDN);
if (! (mpfr_zero_p (y) && MPFR_SIGN (y) < 0))
{
printf ("Error: csch(-8e8) != -0\n");
diff --git a/tests/td_div.c b/tests/td_div.c
index 4e6e895c1..f4c605992 100644
--- a/tests/td_div.c
+++ b/tests/td_div.c
@@ -40,7 +40,7 @@ check_nans (void)
/* 1.0 / nan is nan */
mpfr_set_nan (x);
mpfr_clear_flags ();
- inexact = mpfr_d_div (y, 1.0, x, GMP_RNDN);
+ inexact = mpfr_d_div (y, 1.0, x, MPFR_RNDN);
MPFR_ASSERTN (inexact == 0);
MPFR_ASSERTN ((__gmpfr_flags ^ MPFR_FLAGS_NAN) == 0);
MPFR_ASSERTN (mpfr_nan_p (y));
@@ -48,7 +48,7 @@ check_nans (void)
/* 1.0 / +inf == +0 */
mpfr_set_inf (x, 1);
mpfr_clear_flags ();
- inexact = mpfr_d_div (y, 1.0, x, GMP_RNDN);
+ inexact = mpfr_d_div (y, 1.0, x, MPFR_RNDN);
MPFR_ASSERTN (inexact == 0);
MPFR_ASSERTN (__gmpfr_flags == 0);
MPFR_ASSERTN (mpfr_zero_p (y));
@@ -57,16 +57,16 @@ check_nans (void)
/* 1.0 / -inf == -0 */
mpfr_set_inf (x, -1);
mpfr_clear_flags ();
- inexact = mpfr_d_div (y, 1.0, x, GMP_RNDN);
+ inexact = mpfr_d_div (y, 1.0, x, MPFR_RNDN);
MPFR_ASSERTN (inexact == 0);
MPFR_ASSERTN (__gmpfr_flags == 0);
MPFR_ASSERTN (mpfr_zero_p (y));
MPFR_ASSERTN (MPFR_IS_NEG (y));
/* 1.0 / 0 == +inf */
- mpfr_set_d (x, 0.0, GMP_RNDN);
+ mpfr_set_d (x, 0.0, MPFR_RNDN);
mpfr_clear_flags ();
- inexact = mpfr_d_div (y, 1.0, x, GMP_RNDN);
+ inexact = mpfr_d_div (y, 1.0, x, MPFR_RNDN);
MPFR_ASSERTN (inexact == 0);
MPFR_ASSERTN (__gmpfr_flags == 0);
MPFR_ASSERTN (mpfr_inf_p (y));
@@ -95,24 +95,24 @@ main (void)
mpfr_init2 (y, IEEE_DBL_MANT_DIG);
mpfr_init2 (z, IEEE_DBL_MANT_DIG);
- mpfr_set_str (y, "4096", 10, GMP_RNDN);
+ mpfr_set_str (y, "4096", 10, MPFR_RNDN);
d = 0.125;
mpfr_clear_flags ();
- inexact = mpfr_d_div (x, d, y, GMP_RNDN);
+ inexact = mpfr_d_div (x, d, y, MPFR_RNDN);
if (inexact != 0)
{
printf ("Inexact flag error in mpfr_d_div\n");
exit (1);
}
- mpfr_set_str (z, " 0.000030517578125", 10, GMP_RNDN);
+ mpfr_set_str (z, " 0.000030517578125", 10, MPFR_RNDN);
if (mpfr_cmp (z, x))
{
printf ("Error in mpfr_d_div (");
- mpfr_out_str (stdout, 10, 0, y, GMP_RNDN);
+ mpfr_out_str (stdout, 10, 0, y, MPFR_RNDN);
printf (" + %.20g)\nexpected ", d);
- mpfr_out_str (stdout, 10, 0, z, GMP_RNDN);
+ mpfr_out_str (stdout, 10, 0, z, MPFR_RNDN);
printf ("\ngot ");
- mpfr_out_str (stdout, 10, 0, x, GMP_RNDN);
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN);
printf ("\n");
exit (1);
}
diff --git a/tests/td_sub.c b/tests/td_sub.c
index 745dfb886..ab0abd4a3 100644
--- a/tests/td_sub.c
+++ b/tests/td_sub.c
@@ -40,7 +40,7 @@ check_nans (void)
/* 1.0 - nan is nan */
mpfr_set_nan (x);
mpfr_clear_flags ();
- inexact = mpfr_d_sub (y, 1.0, x, GMP_RNDN);
+ inexact = mpfr_d_sub (y, 1.0, x, MPFR_RNDN);
MPFR_ASSERTN (inexact == 0);
MPFR_ASSERTN ((__gmpfr_flags ^ MPFR_FLAGS_NAN) == 0);
MPFR_ASSERTN (mpfr_nan_p (y));
@@ -48,7 +48,7 @@ check_nans (void)
/* 1.0 - +inf == -inf */
mpfr_set_inf (x, 1);
mpfr_clear_flags ();
- inexact = mpfr_d_sub (y, 1.0, x, GMP_RNDN);
+ inexact = mpfr_d_sub (y, 1.0, x, MPFR_RNDN);
MPFR_ASSERTN (inexact == 0);
MPFR_ASSERTN (__gmpfr_flags == 0);
MPFR_ASSERTN (mpfr_inf_p (y));
@@ -57,7 +57,7 @@ check_nans (void)
/* 1.0 - -inf == +inf */
mpfr_set_inf (x, -1);
mpfr_clear_flags ();
- inexact = mpfr_d_sub (y, 1.0, x, GMP_RNDN);
+ inexact = mpfr_d_sub (y, 1.0, x, MPFR_RNDN);
MPFR_ASSERTN (inexact == 0);
MPFR_ASSERTN (__gmpfr_flags == 0);
MPFR_ASSERTN (mpfr_inf_p (y));
@@ -86,24 +86,24 @@ main (void)
mpfr_init2 (y, IEEE_DBL_MANT_DIG);
mpfr_init2 (z, IEEE_DBL_MANT_DIG);
- mpfr_set_str (y, "4096", 10, GMP_RNDN);
+ mpfr_set_str (y, "4096", 10, MPFR_RNDN);
d = 0.125;
mpfr_clear_flags ();
- inexact = mpfr_d_sub (x, d, y, GMP_RNDN);
+ inexact = mpfr_d_sub (x, d, y, MPFR_RNDN);
if (inexact != 0)
{
printf ("Inexact flag error in mpfr_d_sub\n");
exit (1);
}
- mpfr_set_str (z, "-4095.875", 10, GMP_RNDN);
+ mpfr_set_str (z, "-4095.875", 10, MPFR_RNDN);
if (mpfr_cmp (z, x))
{
printf ("Error in mpfr_d_sub (");
- mpfr_out_str (stdout, 10, 7, y, GMP_RNDN);
+ mpfr_out_str (stdout, 10, 7, y, MPFR_RNDN);
printf (" + %.20g)\nexpected ", d);
- mpfr_out_str (stdout, 10, 0, z, GMP_RNDN);
+ mpfr_out_str (stdout, 10, 0, z, MPFR_RNDN);
printf ("\ngot ");
- mpfr_out_str (stdout, 10, 0, x, GMP_RNDN);
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN);
printf ("\n");
exit (1);
}
diff --git a/tests/tdim.c b/tests/tdim.c
index 3dfe6ed95..bab6a7bf8 100644
--- a/tests/tdim.c
+++ b/tests/tdim.c
@@ -45,8 +45,8 @@ main (void)
/* case x=NaN */
mpfr_set_nan (x);
- mpfr_set_ui (y, 0, GMP_RNDN);
- mpfr_dim (z, x, y, GMP_RNDN);
+ mpfr_set_ui (y, 0, MPFR_RNDN);
+ mpfr_dim (z, x, y, MPFR_RNDN);
if (!mpfr_nan_p (z))
{
printf ("Error in mpfr_dim (NaN, 0)\n");
@@ -55,8 +55,8 @@ main (void)
/* case x=+Inf */
mpfr_set_inf (x, 1);
- mpfr_set_ui (y, 0, GMP_RNDN);
- mpfr_dim (z, x, y, GMP_RNDN);
+ mpfr_set_ui (y, 0, MPFR_RNDN);
+ mpfr_dim (z, x, y, MPFR_RNDN);
if (!mpfr_inf_p (z) || mpfr_sgn (z) < 0)
{
printf ("Error in mpfr_dim (+Inf, 0)\n");
@@ -65,8 +65,8 @@ main (void)
/* case x=-Inf */
mpfr_set_inf (x, -1);
- mpfr_set_ui (y, 0, GMP_RNDN);
- mpfr_dim (z, x, y, GMP_RNDN);
+ mpfr_set_ui (y, 0, MPFR_RNDN);
+ mpfr_dim (z, x, y, MPFR_RNDN);
if (mpfr_cmp_ui (z, 0) || mpfr_sgn (z) < 0)
{
printf ("Error in mpfr_dim (-Inf, 0)\n");
@@ -76,7 +76,7 @@ main (void)
/* case x=y=+Inf */
mpfr_set_inf (x, 1);
mpfr_set_inf (y, 1);
- mpfr_dim (z, x, y, GMP_RNDN);
+ mpfr_dim (z, x, y, MPFR_RNDN);
if (mpfr_cmp_ui (z, 0) || mpfr_sgn (z) < 0)
{
printf ("Error in mpfr_dim (+Inf, +Inf)\n");
@@ -84,9 +84,9 @@ main (void)
}
/* case x > y */
- mpfr_set_ui (x, 2, GMP_RNDN);
- mpfr_set_ui (y, 1, GMP_RNDN);
- mpfr_dim (z, x, y, GMP_RNDN);
+ mpfr_set_ui (x, 2, MPFR_RNDN);
+ mpfr_set_ui (y, 1, MPFR_RNDN);
+ mpfr_dim (z, x, y, MPFR_RNDN);
if (mpfr_cmp_ui (z, 1))
{
printf ("Error in mpfr_dim (2, 1)\n");
@@ -94,9 +94,9 @@ main (void)
}
/* case x < y */
- mpfr_set_ui (x, 1, GMP_RNDN);
- mpfr_set_ui (y, 2, GMP_RNDN);
- mpfr_dim (z, x, y, GMP_RNDN);
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_set_ui (y, 2, MPFR_RNDN);
+ mpfr_dim (z, x, y, MPFR_RNDN);
if (mpfr_cmp_ui (z, 0))
{
printf ("Error in mpfr_dim (1, 2)\n");
diff --git a/tests/tdiv.c b/tests/tdiv.c
index 3f454af4b..043b214d2 100644
--- a/tests/tdiv.c
+++ b/tests/tdiv.c
@@ -30,7 +30,7 @@ static int
test_div (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mp_rnd_t rnd_mode)
{
int res;
- int ok = rnd_mode == GMP_RNDN && mpfr_number_p (b) && mpfr_number_p (c);
+ int ok = rnd_mode == MPFR_RNDN && mpfr_number_p (b) && mpfr_number_p (c);
if (ok)
{
mpfr_print_raw (b);
@@ -74,12 +74,12 @@ check4 (const char *Ns, const char *Ds, mp_rnd_t rnd_mode, int p,
mpfr_set_str1 (n, Ns);
mpfr_set_str1 (d, Ds);
test_div(q, n, d, rnd_mode);
- if (mpfr_cmp_str (q, Qs, ((p==53) ? 10 : 2), GMP_RNDN) )
+ if (mpfr_cmp_str (q, Qs, ((p==53) ? 10 : 2), MPFR_RNDN) )
{
printf ("mpfr_div failed for n=%s, d=%s, p=%d, rnd_mode=%s\n",
Ns, Ds, p, mpfr_print_rnd_mode (rnd_mode));
printf ("got ");mpfr_print_binary(q);
- mpfr_set_str (q, Qs, ((p==53) ? 10 : 2), GMP_RNDN);
+ mpfr_set_str (q, Qs, ((p==53) ? 10 : 2), MPFR_RNDN);
printf("\nexpected "); mpfr_print_binary(q);
putchar('\n');
exit (1);
@@ -102,7 +102,7 @@ check24 (const char *Ns, const char *Ds, mp_rnd_t rnd_mode, const char *Qs)
printf ("mpfr_div failed for n=%s, d=%s, prec=24, rnd_mode=%s\n",
Ns, Ds, mpfr_print_rnd_mode(rnd_mode));
printf ("expected quotient is %s, got ", Qs);
- mpfr_out_str(stdout,10,0,q, GMP_RNDN); putchar('\n');
+ mpfr_out_str(stdout,10,0,q, MPFR_RNDN); putchar('\n');
exit (1);
}
mpfr_clears (q, n, d, (mpfr_ptr) 0);
@@ -113,85 +113,85 @@ check24 (const char *Ns, const char *Ds, mp_rnd_t rnd_mode, const char *Qs)
static void
check_float(void)
{
- check24("70368760954880.0", "8388609.0", GMP_RNDN, "8.388609e6");
- check24("140737479966720.0", "16777213.0", GMP_RNDN, "8.388609e6");
- check24("70368777732096.0", "8388611.0", GMP_RNDN, "8.388609e6");
- check24("105553133043712.0", "12582911.0", GMP_RNDN, "8.38861e6");
+ check24("70368760954880.0", "8388609.0", MPFR_RNDN, "8.388609e6");
+ check24("140737479966720.0", "16777213.0", MPFR_RNDN, "8.388609e6");
+ check24("70368777732096.0", "8388611.0", MPFR_RNDN, "8.388609e6");
+ check24("105553133043712.0", "12582911.0", MPFR_RNDN, "8.38861e6");
/* the exponent for the following example was forgotten in
the Arith'14 version of Parks' paper */
- check24 ("12582913.0", "12582910.0", GMP_RNDN, "1.000000238");
- check24 ("105553124655104.0", "12582910.0", GMP_RNDN, "8388610.0");
- check24("140737479966720.0", "8388609.0", GMP_RNDN, "1.6777213e7");
- check24("70368777732096.0", "8388609.0", GMP_RNDN, "8.388611e6");
- check24("105553133043712.0", "8388610.0", GMP_RNDN, "1.2582911e7");
- check24("105553124655104.0", "8388610.0", GMP_RNDN, "1.258291e7");
-
- check24("70368760954880.0", "8388609.0", GMP_RNDZ, "8.388608e6");
- check24("140737479966720.0", "16777213.0", GMP_RNDZ, "8.388609e6");
- check24("70368777732096.0", "8388611.0", GMP_RNDZ, "8.388608e6");
- check24("105553133043712.0", "12582911.0", GMP_RNDZ, "8.38861e6");
- check24("12582913.0", "12582910.0", GMP_RNDZ, "1.000000238");
- check24 ("105553124655104.0", "12582910.0", GMP_RNDZ, "8388610.0");
- check24("140737479966720.0", "8388609.0", GMP_RNDZ, "1.6777213e7");
- check24("70368777732096.0", "8388609.0", GMP_RNDZ, "8.38861e6");
- check24("105553133043712.0", "8388610.0", GMP_RNDZ, "1.2582911e7");
- check24("105553124655104.0", "8388610.0", GMP_RNDZ, "1.258291e7");
-
- check24("70368760954880.0", "8388609.0", GMP_RNDU, "8.388609e6");
- check24("140737479966720.0", "16777213.0", GMP_RNDU, "8.38861e6");
- check24("70368777732096.0", "8388611.0", GMP_RNDU, "8.388609e6");
- check24("105553133043712.0", "12582911.0", GMP_RNDU, "8.388611e6");
- check24("12582913.0", "12582910.0", GMP_RNDU, "1.000000357");
- check24 ("105553124655104.0", "12582910.0", GMP_RNDU, "8388611.0");
- check24("140737479966720.0", "8388609.0", GMP_RNDU, "1.6777214e7");
- check24("70368777732096.0", "8388609.0", GMP_RNDU, "8.388611e6");
- check24("105553133043712.0", "8388610.0", GMP_RNDU, "1.2582912e7");
- check24("105553124655104.0", "8388610.0", GMP_RNDU, "1.2582911e7");
-
- check24("70368760954880.0", "8388609.0", GMP_RNDD, "8.388608e6");
- check24("140737479966720.0", "16777213.0", GMP_RNDD, "8.388609e6");
- check24("70368777732096.0", "8388611.0", GMP_RNDD, "8.388608e6");
- check24("105553133043712.0", "12582911.0", GMP_RNDD, "8.38861e6");
- check24("12582913.0", "12582910.0", GMP_RNDD, "1.000000238");
- check24 ("105553124655104.0", "12582910.0", GMP_RNDD, "8388610.0");
- check24("140737479966720.0", "8388609.0", GMP_RNDD, "1.6777213e7");
- check24("70368777732096.0", "8388609.0", GMP_RNDD, "8.38861e6");
- check24("105553133043712.0", "8388610.0", GMP_RNDD, "1.2582911e7");
- check24("105553124655104.0", "8388610.0", GMP_RNDD, "1.258291e7");
-
- check24("70368760954880.0", "8388609.0", GMP_RNDA, "8.388609e6");
+ check24 ("12582913.0", "12582910.0", MPFR_RNDN, "1.000000238");
+ check24 ("105553124655104.0", "12582910.0", MPFR_RNDN, "8388610.0");
+ check24("140737479966720.0", "8388609.0", MPFR_RNDN, "1.6777213e7");
+ check24("70368777732096.0", "8388609.0", MPFR_RNDN, "8.388611e6");
+ check24("105553133043712.0", "8388610.0", MPFR_RNDN, "1.2582911e7");
+ check24("105553124655104.0", "8388610.0", MPFR_RNDN, "1.258291e7");
+
+ check24("70368760954880.0", "8388609.0", MPFR_RNDZ, "8.388608e6");
+ check24("140737479966720.0", "16777213.0", MPFR_RNDZ, "8.388609e6");
+ check24("70368777732096.0", "8388611.0", MPFR_RNDZ, "8.388608e6");
+ check24("105553133043712.0", "12582911.0", MPFR_RNDZ, "8.38861e6");
+ check24("12582913.0", "12582910.0", MPFR_RNDZ, "1.000000238");
+ check24 ("105553124655104.0", "12582910.0", MPFR_RNDZ, "8388610.0");
+ check24("140737479966720.0", "8388609.0", MPFR_RNDZ, "1.6777213e7");
+ check24("70368777732096.0", "8388609.0", MPFR_RNDZ, "8.38861e6");
+ check24("105553133043712.0", "8388610.0", MPFR_RNDZ, "1.2582911e7");
+ check24("105553124655104.0", "8388610.0", MPFR_RNDZ, "1.258291e7");
+
+ check24("70368760954880.0", "8388609.0", MPFR_RNDU, "8.388609e6");
+ check24("140737479966720.0", "16777213.0", MPFR_RNDU, "8.38861e6");
+ check24("70368777732096.0", "8388611.0", MPFR_RNDU, "8.388609e6");
+ check24("105553133043712.0", "12582911.0", MPFR_RNDU, "8.388611e6");
+ check24("12582913.0", "12582910.0", MPFR_RNDU, "1.000000357");
+ check24 ("105553124655104.0", "12582910.0", MPFR_RNDU, "8388611.0");
+ check24("140737479966720.0", "8388609.0", MPFR_RNDU, "1.6777214e7");
+ check24("70368777732096.0", "8388609.0", MPFR_RNDU, "8.388611e6");
+ check24("105553133043712.0", "8388610.0", MPFR_RNDU, "1.2582912e7");
+ check24("105553124655104.0", "8388610.0", MPFR_RNDU, "1.2582911e7");
+
+ check24("70368760954880.0", "8388609.0", MPFR_RNDD, "8.388608e6");
+ check24("140737479966720.0", "16777213.0", MPFR_RNDD, "8.388609e6");
+ check24("70368777732096.0", "8388611.0", MPFR_RNDD, "8.388608e6");
+ check24("105553133043712.0", "12582911.0", MPFR_RNDD, "8.38861e6");
+ check24("12582913.0", "12582910.0", MPFR_RNDD, "1.000000238");
+ check24 ("105553124655104.0", "12582910.0", MPFR_RNDD, "8388610.0");
+ check24("140737479966720.0", "8388609.0", MPFR_RNDD, "1.6777213e7");
+ check24("70368777732096.0", "8388609.0", MPFR_RNDD, "8.38861e6");
+ check24("105553133043712.0", "8388610.0", MPFR_RNDD, "1.2582911e7");
+ check24("105553124655104.0", "8388610.0", MPFR_RNDD, "1.258291e7");
+
+ check24("70368760954880.0", "8388609.0", MPFR_RNDA, "8.388609e6");
}
static void
check_double(void)
{
- check53("0.0", "1.0", GMP_RNDZ, "0.0");
- check53("-7.4988969224688591e63", "4.8816866450288732e306", GMP_RNDD,
+ check53("0.0", "1.0", MPFR_RNDZ, "0.0");
+ check53("-7.4988969224688591e63", "4.8816866450288732e306", MPFR_RNDD,
"-1.5361282826510687291e-243");
check53("-1.33225773037748601769e+199", "3.63449540676937123913e+79",
- GMP_RNDZ, "-3.6655920045905428978e119");
- check53("9.89438396044940256501e-134", "5.93472984109987421717e-67",GMP_RNDU,
+ MPFR_RNDZ, "-3.6655920045905428978e119");
+ check53("9.89438396044940256501e-134", "5.93472984109987421717e-67",MPFR_RNDU,
"1.6672003992376663654e-67");
- check53("9.89438396044940256501e-134", "5.93472984109987421717e-67",GMP_RNDA,
+ check53("9.89438396044940256501e-134", "5.93472984109987421717e-67",MPFR_RNDA,
"1.6672003992376663654e-67");
check53("9.89438396044940256501e-134", "-5.93472984109987421717e-67",
- GMP_RNDU, "-1.6672003992376663654e-67");
+ MPFR_RNDU, "-1.6672003992376663654e-67");
check53("-4.53063926135729747564e-308", "7.02293374921793516813e-84",
- GMP_RNDD, "-6.4512060388748850857e-225");
+ MPFR_RNDD, "-6.4512060388748850857e-225");
check53("6.25089225176473806123e-01","-2.35527154824420243364e-230",
- GMP_RNDD, "-2.6540006635008291192e229");
+ MPFR_RNDD, "-2.6540006635008291192e229");
check53("6.25089225176473806123e-01","-2.35527154824420243364e-230",
- GMP_RNDA, "-2.6540006635008291192e229");
- check53("6.52308934689126e15", "-1.62063546601505417497e273", GMP_RNDN,
+ MPFR_RNDA, "-2.6540006635008291192e229");
+ check53("6.52308934689126e15", "-1.62063546601505417497e273", MPFR_RNDN,
"-4.0250194961676020848e-258");
check53("1.04636807108079349236e-189", "3.72295730823253012954e-292",
- GMP_RNDZ, "2.810583051186143125e102");
+ MPFR_RNDZ, "2.810583051186143125e102");
/* problems found by Kevin under HP-PA */
- check53 ("2.861044553323177e-136", "-1.1120354257068143e+45", GMP_RNDZ,
+ check53 ("2.861044553323177e-136", "-1.1120354257068143e+45", MPFR_RNDZ,
"-2.5727998292003016e-181");
- check53 ("-4.0559157245809205e-127", "-1.1237723844524865e+77", GMP_RNDN,
+ check53 ("-4.0559157245809205e-127", "-1.1237723844524865e+77", MPFR_RNDN,
"3.6091968273068081e-204");
- check53 ("-1.8177943561493235e-93", "-8.51233984260364e-104", GMP_RNDU,
+ check53 ("-1.8177943561493235e-93", "-8.51233984260364e-104", MPFR_RNDU,
"2.1354814184595821e+10");
}
@@ -204,10 +204,10 @@ check_64(void)
mpfr_set_str_binary(x, "1.00100100110110101001010010101111000001011100100101010000000000E54");
mpfr_set_str_binary(y, "1.00000000000000000000000000000000000000000000000000000000000000E584");
- test_div(z, x, y, GMP_RNDU);
- if (mpfr_cmp_str (z, "0.1001001001101101010010100101011110000010111001001010100000000000E-529", 2, GMP_RNDN))
+ test_div(z, x, y, MPFR_RNDU);
+ if (mpfr_cmp_str (z, "0.1001001001101101010010100101011110000010111001001010100000000000E-529", 2, MPFR_RNDN))
{
- printf("Error for tdiv for GMP_RNDU and p=64\nx=");
+ printf("Error for tdiv for MPFR_RNDU and p=64\nx=");
mpfr_print_binary(x);
printf("\ny=");
mpfr_print_binary(y);
@@ -228,18 +228,18 @@ check_convergence (void)
mpfr_init2(x, 130);
mpfr_set_str_binary(x, "0.1011111101011010101000001010011111101000011100011101010011111011000011001010000000111100100111110011001010110100100001001000111001E6944");
mpfr_init2(y, 130);
- mpfr_set_ui(y, 5, GMP_RNDN);
- test_div(x, x, y, GMP_RNDD); /* exact division */
+ mpfr_set_ui(y, 5, MPFR_RNDN);
+ test_div(x, x, y, MPFR_RNDD); /* exact division */
mpfr_set_prec(x, 64);
mpfr_set_prec(y, 64);
mpfr_set_str_binary(x, "0.10010010011011010100101001010111100000101110010010101E55");
mpfr_set_str_binary(y, "0.1E585");
- test_div(x, x, y, GMP_RNDN);
+ test_div(x, x, y, MPFR_RNDN);
mpfr_set_str_binary(y, "0.10010010011011010100101001010111100000101110010010101E-529");
if (mpfr_cmp (x, y))
{
- printf ("Error in mpfr_div for prec=64, rnd=GMP_RNDN\n");
+ printf ("Error in mpfr_div for prec=64, rnd=MPFR_RNDN\n");
printf ("got "); mpfr_print_binary(x); puts ("");
printf ("instead of "); mpfr_print_binary(y); puts ("");
exit(1);
@@ -249,10 +249,10 @@ check_convergence (void)
{
mpfr_set_prec(x, i);
mpfr_set_prec(y, i);
- mpfr_set_ui(x, 1, GMP_RNDN);
+ mpfr_set_ui(x, 1, MPFR_RNDN);
RND_LOOP(j)
{
- mpfr_set_ui (y, 1, GMP_RNDN);
+ mpfr_set_ui (y, 1, MPFR_RNDN);
test_div (y, x, y, (mp_rnd_t) j);
if (mpfr_cmp_ui (y, 1))
{
@@ -278,7 +278,7 @@ get_inexact (mpfr_t y, mpfr_t x, mpfr_t u)
mpfr_t xx;
int inex;
mpfr_init2 (xx, mpfr_get_prec (y) + mpfr_get_prec (u));
- mpfr_mul (xx, y, u, GMP_RNDN); /* exact */
+ mpfr_mul (xx, y, u, MPFR_RNDN); /* exact */
inex = mpfr_cmp (xx, x);
mpfr_clear (xx);
return inex;
@@ -312,7 +312,7 @@ check_hard (void)
while (mpfr_cmp_ui (q2, 0) == 0);
}
else /* use q2=1 */
- mpfr_set_ui (q2, 1, GMP_RNDN);
+ mpfr_set_ui (q2, 1, MPFR_RNDN);
for (precv = precq; precv <= 10 * precq; precv += precq)
{
mpfr_set_prec (v, precv);
@@ -324,7 +324,7 @@ check_hard (void)
for (precu = precq; precu <= 10 * precq; precu += precq)
{
mpfr_set_prec (u, precu);
- mpfr_mul (u, v, q2, GMP_RNDN);
+ mpfr_mul (u, v, q2, MPFR_RNDN);
mpfr_nextbelow (u);
for (i = 0; i <= 2; i++)
{
@@ -340,7 +340,7 @@ check_hard (void)
printf ("v= "); mpfr_dump (v);
printf ("q= "); mpfr_dump (q);
mpfr_set_prec (q2, precq + precv);
- mpfr_mul (q2, q, v, GMP_RNDN);
+ mpfr_mul (q2, q, v, MPFR_RNDN);
printf ("q*v="); mpfr_dump (q2);
exit (1);
}
@@ -384,12 +384,12 @@ check_lowr (void)
mpfr_urandomb (tmp, RANDS);
}
while (mpfr_cmp_ui (tmp, 0) == 0);
- mpfr_mul (x, z, tmp, GMP_RNDN); /* exact */
- c = test_div (z2, x, tmp, GMP_RNDN);
+ mpfr_mul (x, z, tmp, MPFR_RNDN); /* exact */
+ c = test_div (z2, x, tmp, MPFR_RNDN);
if (c || mpfr_cmp (z2, z))
{
- printf ("Error in mpfr_div rnd=GMP_RNDN\n");
+ printf ("Error in mpfr_div rnd=MPFR_RNDN\n");
printf ("got "); mpfr_print_binary(z2); puts ("");
printf ("instead of "); mpfr_print_binary(z); puts ("");
printf ("inex flag = %d, expected 0\n", c);
@@ -407,15 +407,15 @@ check_lowr (void)
mpfr_urandomb (tmp, RANDS);
}
while (mpfr_cmp_ui (tmp, 0) == 0);
- mpfr_mul (x, z, tmp, GMP_RNDN); /* exact */
- c = test_div (z2, x, tmp, GMP_RNDN);
+ mpfr_mul (x, z, tmp, MPFR_RNDN); /* exact */
+ c = test_div (z2, x, tmp, MPFR_RNDN);
/* since z2 has one less bit that z, either the division is exact
if z is representable on 9 bits, or we have an even round case */
c2 = get_inexact (z2, x, tmp);
if ((mpfr_cmp (z2, z) == 0 && c) || inex_cmp (c, c2))
{
- printf ("Error in mpfr_div rnd=GMP_RNDN\n");
+ printf ("Error in mpfr_div rnd=MPFR_RNDN\n");
printf ("got "); mpfr_print_binary(z2); puts ("");
printf ("instead of "); mpfr_print_binary(z); puts ("");
printf ("inex flag = %d, expected %d\n", c, c2);
@@ -426,7 +426,7 @@ check_lowr (void)
mpfr_nexttoinf (z);
if (mpfr_cmp(z2, z))
{
- printf ("Error in mpfr_div [even rnd?] rnd=GMP_RNDN\n");
+ printf ("Error in mpfr_div [even rnd?] rnd=MPFR_RNDN\n");
printf ("Dividing ");
printf ("got "); mpfr_print_binary(z2); puts ("");
printf ("instead of "); mpfr_print_binary(z); puts ("");
@@ -439,7 +439,7 @@ check_lowr (void)
mpfr_nexttozero (z);
if (mpfr_cmp(z2, z))
{
- printf ("Error in mpfr_div [even rnd?] rnd=GMP_RNDN\n");
+ printf ("Error in mpfr_div [even rnd?] rnd=MPFR_RNDN\n");
printf ("Dividing ");
printf ("got "); mpfr_print_binary(z2); puts ("");
printf ("instead of "); mpfr_print_binary(z); puts ("");
@@ -468,30 +468,30 @@ check_lowr (void)
mpfr_urandomb (tmp, RANDS);
}
while (mpfr_cmp_ui (tmp, 0) == 0);
- mpfr_mul(x, z, tmp, GMP_RNDN);
- mpfr_set(y, tmp, GMP_RNDD);
+ mpfr_mul(x, z, tmp, MPFR_RNDN);
+ mpfr_set(y, tmp, MPFR_RNDD);
mpfr_nexttoinf (x);
- c = test_div(z2, x, y, GMP_RNDD);
- test_div(z3, x, y, GMP_RNDD);
- mpfr_set(z, z3, GMP_RNDD);
+ c = test_div(z2, x, y, MPFR_RNDD);
+ test_div(z3, x, y, MPFR_RNDD);
+ mpfr_set(z, z3, MPFR_RNDD);
if (c != -1 || mpfr_cmp(z2, z))
{
- printf ("Error in mpfr_div rnd=GMP_RNDD\n");
+ printf ("Error in mpfr_div rnd=MPFR_RNDD\n");
printf ("got "); mpfr_print_binary(z2); puts ("");
printf ("instead of "); mpfr_print_binary(z); puts ("");
printf ("inex flag = %d\n", c);
exit (1);
}
- mpfr_set (y, tmp, GMP_RNDU);
- test_div (z3, x, y, GMP_RNDU);
- mpfr_set (z, z3, GMP_RNDU);
- c = test_div (z2, x, y, GMP_RNDU);
+ mpfr_set (y, tmp, MPFR_RNDU);
+ test_div (z3, x, y, MPFR_RNDU);
+ mpfr_set (z, z3, MPFR_RNDU);
+ c = test_div (z2, x, y, MPFR_RNDU);
if (c != 1 || mpfr_cmp (z2, z))
{
- printf ("Error in mpfr_div rnd=GMP_RNDU\n");
+ printf ("Error in mpfr_div rnd=MPFR_RNDU\n");
printf ("u="); mpfr_dump (x);
printf ("v="); mpfr_dump (y);
printf ("got "); mpfr_print_binary (z2); puts ("");
@@ -528,8 +528,8 @@ check_inexact (void)
mpfr_set_prec (y, 28);
mpfr_set_prec (z, 1023);
mpfr_set_str_binary (x, "0.1000001001101101111100010011E0");
- mpfr_set_str (z, "48284762641021308813686974720835219181653367326353400027913400579340343320519877153813133510034402932651132854764198688352364361009429039801248971901380781746767119334993621199563870113045276395603170432175354501451429471578325545278975153148347684600400321033502982713296919861760382863826626093689036010394", 10, GMP_RNDN);
- mpfr_div (x, x, z, GMP_RNDN);
+ mpfr_set_str (z, "48284762641021308813686974720835219181653367326353400027913400579340343320519877153813133510034402932651132854764198688352364361009429039801248971901380781746767119334993621199563870113045276395603170432175354501451429471578325545278975153148347684600400321033502982713296919861760382863826626093689036010394", 10, MPFR_RNDN);
+ mpfr_div (x, x, z, MPFR_RNDN);
mpfr_set_str_binary (y, "0.1111001011001101001001111100E-1023");
if (mpfr_cmp (x, y))
{
@@ -544,13 +544,13 @@ check_inexact (void)
mpfr_set_prec (u, 127);
mpfr_set_str_binary (u, "0.1000001100110110110101110110101101111000110000001111111110000000011111001010110100110010111111111101000001011011101011101101000E-2");
mpfr_set_prec (y, 95);
- inexact = test_div (y, x, u, GMP_RNDN);
+ inexact = test_div (y, x, u, MPFR_RNDN);
if (inexact != (cmp = get_inexact (y, x, u)))
{
printf ("Wrong inexact flag (0): expected %d, got %d\n", cmp, inexact);
- printf ("x="); mpfr_out_str (stdout, 10, 99, x, GMP_RNDN); printf ("\n");
- printf ("u="); mpfr_out_str (stdout, 10, 99, u, GMP_RNDN); printf ("\n");
- printf ("y="); mpfr_out_str (stdout, 10, 99, y, GMP_RNDN); printf ("\n");
+ printf ("x="); mpfr_out_str (stdout, 10, 99, x, MPFR_RNDN); printf ("\n");
+ printf ("u="); mpfr_out_str (stdout, 10, 99, u, MPFR_RNDN); printf ("\n");
+ printf ("y="); mpfr_out_str (stdout, 10, 99, y, MPFR_RNDN); printf ("\n");
exit (1);
}
@@ -559,7 +559,7 @@ check_inexact (void)
mpfr_set_prec (u, 2);
mpfr_set_str_binary (u, "0.1E0");
mpfr_set_prec (y, 28);
- if ((inexact = test_div (y, x, u, GMP_RNDN) >= 0))
+ if ((inexact = test_div (y, x, u, MPFR_RNDN) >= 0))
{
printf ("Wrong inexact flag (1): expected -1, got %d\n",
inexact);
@@ -571,9 +571,9 @@ check_inexact (void)
mpfr_set_prec (u, 15);
mpfr_set_str_binary (u, "0.101101000001100E-1");
mpfr_set_prec (y, 92);
- if ((inexact = test_div (y, x, u, GMP_RNDN)) <= 0)
+ if ((inexact = test_div (y, x, u, MPFR_RNDN)) <= 0)
{
- printf ("Wrong inexact flag for rnd=GMP_RNDN(1): expected 1, got %d\n",
+ printf ("Wrong inexact flag for rnd=MPFR_RNDN(1): expected 1, got %d\n",
inexact);
mpfr_dump (x);
mpfr_dump (u);
@@ -638,39 +638,39 @@ check_nan (void)
mpfr_init2 (q, 100L);
/* 1/nan == nan */
- mpfr_set_ui (a, 1L, GMP_RNDN);
+ mpfr_set_ui (a, 1L, MPFR_RNDN);
MPFR_SET_NAN (d);
- MPFR_ASSERTN (test_div (q, a, d, GMP_RNDZ) == 0); /* exact */
+ MPFR_ASSERTN (test_div (q, a, d, MPFR_RNDZ) == 0); /* exact */
MPFR_ASSERTN (mpfr_nan_p (q));
/* nan/1 == nan */
MPFR_SET_NAN (a);
- mpfr_set_ui (d, 1L, GMP_RNDN);
- MPFR_ASSERTN (test_div (q, a, d, GMP_RNDZ) == 0); /* exact */
+ mpfr_set_ui (d, 1L, MPFR_RNDN);
+ MPFR_ASSERTN (test_div (q, a, d, MPFR_RNDZ) == 0); /* exact */
MPFR_ASSERTN (mpfr_nan_p (q));
/* +inf/1 == +inf */
MPFR_CLEAR_FLAGS (a);
MPFR_SET_INF (a);
MPFR_SET_POS (a);
- mpfr_set_ui (d, 1L, GMP_RNDN);
- MPFR_ASSERTN (test_div (q, a, d, GMP_RNDZ) == 0); /* exact */
+ mpfr_set_ui (d, 1L, MPFR_RNDN);
+ MPFR_ASSERTN (test_div (q, a, d, MPFR_RNDZ) == 0); /* exact */
MPFR_ASSERTN (mpfr_inf_p (q));
MPFR_ASSERTN (mpfr_sgn (q) > 0);
/* 1/+inf == 0 */
- mpfr_set_ui (a, 1L, GMP_RNDN);
+ mpfr_set_ui (a, 1L, MPFR_RNDN);
MPFR_CLEAR_FLAGS (d);
MPFR_SET_INF (d);
MPFR_SET_POS (d);
- MPFR_ASSERTN (test_div (q, a, d, GMP_RNDZ) == 0); /* exact */
+ MPFR_ASSERTN (test_div (q, a, d, MPFR_RNDZ) == 0); /* exact */
MPFR_ASSERTN (mpfr_number_p (q));
MPFR_ASSERTN (mpfr_sgn (q) == 0);
/* 0/0 == nan */
- mpfr_set_ui (a, 0L, GMP_RNDN);
- mpfr_set_ui (d, 0L, GMP_RNDN);
- MPFR_ASSERTN (test_div (q, a, d, GMP_RNDZ) == 0); /* exact */
+ mpfr_set_ui (a, 0L, MPFR_RNDN);
+ mpfr_set_ui (d, 0L, MPFR_RNDN);
+ MPFR_ASSERTN (test_div (q, a, d, MPFR_RNDZ) == 0); /* exact */
MPFR_ASSERTN (mpfr_nan_p (q));
/* +inf/+inf == nan */
@@ -680,50 +680,50 @@ check_nan (void)
MPFR_CLEAR_FLAGS (d);
MPFR_SET_INF (d);
MPFR_SET_POS (d);
- MPFR_ASSERTN (test_div (q, a, d, GMP_RNDZ) == 0); /* exact */
+ MPFR_ASSERTN (test_div (q, a, d, MPFR_RNDZ) == 0); /* exact */
MPFR_ASSERTN (mpfr_nan_p (q));
/* 1/+0 = +Inf */
- mpfr_set_ui (a, 1, GMP_RNDZ);
- mpfr_set_ui (d, 0, GMP_RNDZ);
- MPFR_ASSERTN (test_div (q, a, d, GMP_RNDZ) == 0); /* exact */
+ mpfr_set_ui (a, 1, MPFR_RNDZ);
+ mpfr_set_ui (d, 0, MPFR_RNDZ);
+ MPFR_ASSERTN (test_div (q, a, d, MPFR_RNDZ) == 0); /* exact */
MPFR_ASSERTN (mpfr_inf_p (q) && mpfr_sgn (q) > 0);
/* 1/-0 = -Inf */
- mpfr_set_ui (a, 1, GMP_RNDZ);
- mpfr_set_ui (d, 0, GMP_RNDZ);
- mpfr_neg (d, d, GMP_RNDZ);
- MPFR_ASSERTN (test_div (q, a, d, GMP_RNDZ) == 0); /* exact */
+ mpfr_set_ui (a, 1, MPFR_RNDZ);
+ mpfr_set_ui (d, 0, MPFR_RNDZ);
+ mpfr_neg (d, d, MPFR_RNDZ);
+ MPFR_ASSERTN (test_div (q, a, d, MPFR_RNDZ) == 0); /* exact */
MPFR_ASSERTN (mpfr_inf_p (q) && mpfr_sgn (q) < 0);
/* -1/+0 = -Inf */
- mpfr_set_si (a, -1, GMP_RNDZ);
- mpfr_set_ui (d, 0, GMP_RNDZ);
- MPFR_ASSERTN (test_div (q, a, d, GMP_RNDZ) == 0); /* exact */
+ mpfr_set_si (a, -1, MPFR_RNDZ);
+ mpfr_set_ui (d, 0, MPFR_RNDZ);
+ MPFR_ASSERTN (test_div (q, a, d, MPFR_RNDZ) == 0); /* exact */
MPFR_ASSERTN (mpfr_inf_p (q) && mpfr_sgn (q) < 0);
/* -1/-0 = +Inf */
- mpfr_set_si (a, -1, GMP_RNDZ);
- mpfr_set_ui (d, 0, GMP_RNDZ);
- mpfr_neg (d, d, GMP_RNDZ);
- MPFR_ASSERTN (test_div (q, a, d, GMP_RNDZ) == 0); /* exact */
+ mpfr_set_si (a, -1, MPFR_RNDZ);
+ mpfr_set_ui (d, 0, MPFR_RNDZ);
+ mpfr_neg (d, d, MPFR_RNDZ);
+ MPFR_ASSERTN (test_div (q, a, d, MPFR_RNDZ) == 0); /* exact */
MPFR_ASSERTN (mpfr_inf_p (q) && mpfr_sgn (q) > 0);
/* check overflow */
emax = mpfr_get_emax ();
set_emax (1);
- mpfr_set_ui (a, 1, GMP_RNDZ);
- mpfr_set_ui (d, 1, GMP_RNDZ);
- mpfr_div_2exp (d, d, 1, GMP_RNDZ);
- test_div (q, a, d, GMP_RNDU); /* 1 / 0.5 = 2 -> overflow */
+ mpfr_set_ui (a, 1, MPFR_RNDZ);
+ mpfr_set_ui (d, 1, MPFR_RNDZ);
+ mpfr_div_2exp (d, d, 1, MPFR_RNDZ);
+ test_div (q, a, d, MPFR_RNDU); /* 1 / 0.5 = 2 -> overflow */
MPFR_ASSERTN (mpfr_inf_p (q) && mpfr_sgn (q) > 0);
set_emax (emax);
/* check underflow */
emin = mpfr_get_emin ();
set_emin (-1);
- mpfr_set_ui (a, 1, GMP_RNDZ);
- mpfr_div_2exp (a, a, 2, GMP_RNDZ);
+ mpfr_set_ui (a, 1, MPFR_RNDZ);
+ mpfr_div_2exp (a, a, 2, MPFR_RNDZ);
mpfr_set_prec (d, mpfr_get_prec (q) + 8);
for (i = -1; i <= 1; i++)
{
@@ -731,8 +731,8 @@ check_nan (void)
/* Test 2^(-2) / (+/- (2 + eps)), with eps < 0, eps = 0, eps > 0.
-> underflow.
- With div.c r5513, this test fails for eps > 0 in GMP_RNDN. */
- mpfr_set_ui (d, 2, GMP_RNDZ);
+ With div.c r5513, this test fails for eps > 0 in MPFR_RNDN. */
+ mpfr_set_ui (d, 2, MPFR_RNDZ);
if (i < 0)
mpfr_nextbelow (d);
if (i > 0)
@@ -740,18 +740,18 @@ check_nan (void)
for (sign = 0; sign <= 1; sign++)
{
mpfr_clear_flags ();
- test_div (q, a, d, GMP_RNDZ); /* result = 0 */
+ test_div (q, a, d, MPFR_RNDZ); /* result = 0 */
MPFR_ASSERTN (mpfr_underflow_p ());
MPFR_ASSERTN (sign ? MPFR_IS_NEG (q) : MPFR_IS_POS (q));
MPFR_ASSERTN (MPFR_IS_ZERO (q));
mpfr_clear_flags ();
- test_div (q, a, d, GMP_RNDN); /* result = 0 iff eps >= 0 */
+ test_div (q, a, d, MPFR_RNDN); /* result = 0 iff eps >= 0 */
MPFR_ASSERTN (mpfr_underflow_p ());
MPFR_ASSERTN (sign ? MPFR_IS_NEG (q) : MPFR_IS_POS (q));
if (i < 0)
mpfr_nexttozero (q);
MPFR_ASSERTN (MPFR_IS_ZERO (q));
- mpfr_neg (d, d, GMP_RNDN);
+ mpfr_neg (d, d, MPFR_RNDN);
}
}
set_emin (emin);
@@ -790,8 +790,8 @@ consistency (void)
inex1 = mpfr_div (z1, x, y, rnd);
MPFR_ASSERTN (!MPFR_IS_NAN (z1));
p = MAX (MAX (px, py), pz);
- if (mpfr_prec_round (x, p, GMP_RNDN) != 0 ||
- mpfr_prec_round (y, p, GMP_RNDN) != 0)
+ if (mpfr_prec_round (x, p, MPFR_RNDN) != 0 ||
+ mpfr_prec_round (y, p, MPFR_RNDN) != 0)
{
printf ("mpfr_prec_round error for i = %d\n", i);
exit (1);
@@ -819,11 +819,11 @@ test_20070603 (void)
mpfr_init2 (q, 31);
mpfr_init2 (c, 31);
- mpfr_set_str (n, "10384593717069655257060992206846485", 10, GMP_RNDN);
- mpfr_set_str (d, "10384593717069655257060992206847132", 10, GMP_RNDN);
- mpfr_div (q, n, d, GMP_RNDU);
+ mpfr_set_str (n, "10384593717069655257060992206846485", 10, MPFR_RNDN);
+ mpfr_set_str (d, "10384593717069655257060992206847132", 10, MPFR_RNDN);
+ mpfr_div (q, n, d, MPFR_RNDU);
- mpfr_set_ui (c, 1, GMP_RNDN);
+ mpfr_set_ui (c, 1, MPFR_RNDN);
if (mpfr_cmp (q, c) != 0)
{
printf ("Error in test_20070603\nGot ");
@@ -837,9 +837,9 @@ test_20070603 (void)
mpfr_set_prec (n, 256);
mpfr_set_prec (d, 256);
mpfr_set_prec (q, 63);
- mpfr_set_str (n, "822752278660603021077484591278675252491367930877209729029898240", 10, GMP_RNDN);
- mpfr_set_str (d, "822752278660603021077484591278675252491367930877212507873738752", 10, GMP_RNDN);
- mpfr_div (q, n, d, GMP_RNDU);
+ mpfr_set_str (n, "822752278660603021077484591278675252491367930877209729029898240", 10, MPFR_RNDN);
+ mpfr_set_str (d, "822752278660603021077484591278675252491367930877212507873738752", 10, MPFR_RNDN);
+ mpfr_div (q, n, d, MPFR_RNDU);
if (mpfr_cmp (q, c) != 0)
{
printf ("Error in test_20070603\nGot ");
@@ -872,10 +872,10 @@ test_20070628 (void)
}
mpfr_inits2 (53, x, y, (mpfr_ptr) 0);
- mpfr_set_si (x, -1, GMP_RNDN);
- mpfr_set_si_2exp (y, 1, -256, GMP_RNDN);
+ mpfr_set_si (x, -1, MPFR_RNDN);
+ mpfr_set_si_2exp (y, 1, -256, MPFR_RNDN);
mpfr_clear_flags ();
- inex = mpfr_div (x, x, y, GMP_RNDD);
+ inex = mpfr_div (x, x, y, MPFR_RNDD);
if (MPFR_SIGN (x) >= 0 || ! mpfr_inf_p (x))
{
printf ("Error in test_20070628: expected -Inf, got\n");
@@ -915,11 +915,11 @@ main (int argc, char *argv[])
check_convergence ();
check_64 ();
- check4("4.0","4.503599627370496e15", GMP_RNDZ, 62,
+ check4("4.0","4.503599627370496e15", MPFR_RNDZ, 62,
"0.10000000000000000000000000000000000000000000000000000000000000E-49");
- check4("1.0","2.10263340267725788209e+187", GMP_RNDU, 65,
+ check4("1.0","2.10263340267725788209e+187", MPFR_RNDU, 65,
"0.11010011111001101011111001100111110100000001101001111100111000000E-622");
- check4("2.44394909079968374564e-150", "2.10263340267725788209e+187",GMP_RNDU,
+ check4("2.44394909079968374564e-150", "2.10263340267725788209e+187",MPFR_RNDU,
65,
"0.11010011111001101011111001100111110100000001101001111100111000000E-1119");
diff --git a/tests/tdiv_d.c b/tests/tdiv_d.c
index 9829dc274..c913172f2 100644
--- a/tests/tdiv_d.c
+++ b/tests/tdiv_d.c
@@ -40,7 +40,7 @@ check_nans (void)
/* nan / 1.0 is nan */
mpfr_set_nan (x);
mpfr_clear_flags ();
- inexact = mpfr_div_d (y, x, 1.0, GMP_RNDN);
+ inexact = mpfr_div_d (y, x, 1.0, MPFR_RNDN);
MPFR_ASSERTN (inexact == 0);
MPFR_ASSERTN ((__gmpfr_flags ^ MPFR_FLAGS_NAN) == 0);
MPFR_ASSERTN (mpfr_nan_p (y));
@@ -48,7 +48,7 @@ check_nans (void)
/* +inf / 1.0 == +inf */
mpfr_set_inf (x, 1);
mpfr_clear_flags ();
- inexact = mpfr_div_d (y, x, 1.0, GMP_RNDN);
+ inexact = mpfr_div_d (y, x, 1.0, MPFR_RNDN);
MPFR_ASSERTN (inexact == 0);
MPFR_ASSERTN (__gmpfr_flags == 0);
MPFR_ASSERTN (mpfr_inf_p (y));
@@ -57,16 +57,16 @@ check_nans (void)
/* -inf / 1.0 == -inf */
mpfr_set_inf (x, -1);
mpfr_clear_flags ();
- inexact = mpfr_div_d (y, x, 1.0, GMP_RNDN);
+ inexact = mpfr_div_d (y, x, 1.0, MPFR_RNDN);
MPFR_ASSERTN (inexact == 0);
MPFR_ASSERTN (__gmpfr_flags == 0);
MPFR_ASSERTN (mpfr_inf_p (y));
MPFR_ASSERTN (MPFR_IS_NEG (y));
/* 0.0 / 0.0 is nan */
- mpfr_set_d (x, 0.0, GMP_RNDN);
+ mpfr_set_d (x, 0.0, MPFR_RNDN);
mpfr_clear_flags ();
- inexact = mpfr_div_d (y, x, 0.0, GMP_RNDN);
+ inexact = mpfr_div_d (y, x, 0.0, MPFR_RNDN);
MPFR_ASSERTN (inexact == 0);
MPFR_ASSERTN ((__gmpfr_flags ^ MPFR_FLAGS_NAN) == 0);
MPFR_ASSERTN (mpfr_nan_p (y));
@@ -94,24 +94,24 @@ main (void)
mpfr_init2 (y, IEEE_DBL_MANT_DIG);
mpfr_init2 (z, IEEE_DBL_MANT_DIG);
- mpfr_set_str (y, "4096", 10, GMP_RNDN);
+ mpfr_set_str (y, "4096", 10, MPFR_RNDN);
d = 0.125;
mpfr_clear_flags ();
- inexact = mpfr_div_d (x, y, d, GMP_RNDN);
+ inexact = mpfr_div_d (x, y, d, MPFR_RNDN);
if (inexact != 0)
{
printf ("Inexact flag error in mpfr_div_d\n");
exit (1);
}
- mpfr_set_str (z, "32768", 10, GMP_RNDN);
+ mpfr_set_str (z, "32768", 10, MPFR_RNDN);
if (mpfr_cmp (z, x))
{
printf ("Error in mpfr_div_d (");
- mpfr_out_str (stdout, 10, 0, y, GMP_RNDN);
+ mpfr_out_str (stdout, 10, 0, y, MPFR_RNDN);
printf (" + %.20g)\nexpected ", d);
- mpfr_out_str (stdout, 10, 0, z, GMP_RNDN);
+ mpfr_out_str (stdout, 10, 0, z, MPFR_RNDN);
printf ("\ngot ");
- mpfr_out_str (stdout, 10, 0, x, GMP_RNDN);
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN);
printf ("\n");
exit (1);
}
diff --git a/tests/tdiv_ui.c b/tests/tdiv_ui.c
index c611b5bdb..6b52e7f9b 100644
--- a/tests/tdiv_ui.c
+++ b/tests/tdiv_ui.c
@@ -40,7 +40,7 @@ check (const char *ds, unsigned long u, mp_rnd_t rnd, const char *es)
printf ("mpfr_div_ui failed for x=%s, u=%lu, rnd=%s\n", ds, u,
mpfr_print_rnd_mode (rnd));
printf ("expected result is %s, got", es);
- mpfr_out_str(stdout, 10, 0, y, GMP_RNDN);
+ mpfr_out_str(stdout, 10, 0, y, MPFR_RNDN);
exit (1);
}
mpfr_clear (x);
@@ -58,15 +58,15 @@ special (void)
mpfr_set_prec (x, 32);
mpfr_set_prec (y, 32);
- mpfr_set_ui (x, 1, GMP_RNDN);
- mpfr_div_ui (y, x, 3, GMP_RNDN);
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_div_ui (y, x, 3, MPFR_RNDN);
mpfr_set_prec (x, 100);
mpfr_set_prec (y, 100);
mpfr_urandomb (x, RANDS);
- mpfr_div_ui (y, x, 123456, GMP_RNDN);
- mpfr_set_ui (x, 0, GMP_RNDN);
- mpfr_div_ui (y, x, 123456789, GMP_RNDN);
+ mpfr_div_ui (y, x, 123456, MPFR_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_div_ui (y, x, 123456789, MPFR_RNDN);
if (mpfr_cmp_ui (y, 0))
{
printf ("mpfr_div_ui gives non-zero for 0/ui\n");
@@ -77,15 +77,15 @@ special (void)
mpfr_set_prec (x, 110);
mpfr_set_prec (y, 60);
mpfr_set_str_binary (x, "0.110101110011111110011111001110011001110111000000111110001000111011000011E-44");
- mpfr_div_ui (y, x, 17, GMP_RNDN);
+ mpfr_div_ui (y, x, 17, MPFR_RNDN);
mpfr_set_str_binary (x, "0.11001010100101100011101110000001100001010110101001010011011E-48");
if (mpfr_cmp (x, y))
{
printf ("Error in x/17 for x=1/16!\n");
printf ("Expected ");
- mpfr_out_str (stdout, 2, 0, x, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN);
printf ("\nGot ");
- mpfr_out_str (stdout, 2, 0, y, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN);
printf ("\n");
exit (1);
}
@@ -93,23 +93,23 @@ special (void)
/* corner case */
mpfr_set_prec (x, 2 * mp_bits_per_limb);
mpfr_set_prec (y, 2);
- mpfr_set_ui (x, 4, GMP_RNDN);
+ mpfr_set_ui (x, 4, MPFR_RNDN);
mpfr_nextabove (x);
- mpfr_div_ui (y, x, 2, GMP_RNDN); /* exactly in the middle */
+ mpfr_div_ui (y, x, 2, MPFR_RNDN); /* exactly in the middle */
MPFR_ASSERTN(mpfr_cmp_ui (y, 2) == 0);
mpfr_set_prec (x, 3 * mp_bits_per_limb);
mpfr_set_prec (y, 2);
- mpfr_set_ui (x, 2, GMP_RNDN);
+ mpfr_set_ui (x, 2, MPFR_RNDN);
mpfr_nextabove (x);
- mpfr_div_ui (y, x, 2, GMP_RNDN);
+ mpfr_div_ui (y, x, 2, MPFR_RNDN);
MPFR_ASSERTN(mpfr_cmp_ui (y, 1) == 0);
mpfr_set_prec (x, 3 * mp_bits_per_limb);
mpfr_set_prec (y, 2);
- mpfr_set_si (x, -4, GMP_RNDN);
+ mpfr_set_si (x, -4, MPFR_RNDN);
mpfr_nextbelow (x);
- mpfr_div_ui (y, x, 2, GMP_RNDD);
+ mpfr_div_ui (y, x, 2, MPFR_RNDD);
MPFR_ASSERTN(mpfr_cmp_si (y, -3) == 0);
for (xprec = 53; xprec <= 128; xprec++)
@@ -119,7 +119,7 @@ special (void)
for (yprec = 53; yprec <= 128; yprec++)
{
mpfr_set_prec (y, yprec);
- mpfr_div_ui (y, x, 1, GMP_RNDN);
+ mpfr_div_ui (y, x, 1, MPFR_RNDN);
if (mpfr_cmp(x,y))
{
printf ("division by 1.0 fails for xprec=%u, yprec=%u\n", xprec, yprec);
@@ -131,9 +131,9 @@ special (void)
}
/* Bug reported by Mark Dickinson, 6 Nov 2007 */
- mpfr_set_si (x, 0, GMP_RNDN);
- mpfr_set_si (y, -1, GMP_RNDN);
- mpfr_div_ui (y, x, 4, GMP_RNDN);
+ mpfr_set_si (x, 0, MPFR_RNDN);
+ mpfr_set_si (y, -1, MPFR_RNDN);
+ mpfr_div_ui (y, x, 4, MPFR_RNDN);
MPFR_ASSERTN(MPFR_IS_ZERO(y) && MPFR_IS_POS(y));
mpfr_clear (x);
@@ -166,7 +166,7 @@ check_inexact (void)
{
mpfr_set_prec (y, py);
mpfr_set_prec (z, py + mp_bits_per_limb);
- for (rnd = 0; rnd < GMP_RND_MAX; rnd++)
+ for (rnd = 0; rnd < MPFR_RND_MAX; rnd++)
{
inexact = mpfr_div_ui (y, x, u, (mp_rnd_t) rnd);
if (mpfr_mul_ui (z, y, u, (mp_rnd_t) rnd))
@@ -212,17 +212,17 @@ main (int argc, char **argv)
check_inexact ();
- check("1.0", 3, GMP_RNDN, "3.3333333333333331483e-1");
- check("1.0", 3, GMP_RNDZ, "3.3333333333333331483e-1");
- check("1.0", 3, GMP_RNDU, "3.3333333333333337034e-1");
- check("1.0", 3, GMP_RNDD, "3.3333333333333331483e-1");
- check("1.0", 2116118, GMP_RNDN, "4.7256343927890600483e-7");
- check("1.098612288668109782", 5, GMP_RNDN, "0.21972245773362195087");
+ check("1.0", 3, MPFR_RNDN, "3.3333333333333331483e-1");
+ check("1.0", 3, MPFR_RNDZ, "3.3333333333333331483e-1");
+ check("1.0", 3, MPFR_RNDU, "3.3333333333333337034e-1");
+ check("1.0", 3, MPFR_RNDD, "3.3333333333333331483e-1");
+ check("1.0", 2116118, MPFR_RNDN, "4.7256343927890600483e-7");
+ check("1.098612288668109782", 5, MPFR_RNDN, "0.21972245773362195087");
mpfr_init2 (x, 53);
- mpfr_set_ui (x, 3, GMP_RNDD);
- mpfr_log (x, x, GMP_RNDD);
- mpfr_div_ui (x, x, 5, GMP_RNDD);
+ mpfr_set_ui (x, 3, MPFR_RNDD);
+ mpfr_log (x, x, MPFR_RNDD);
+ mpfr_div_ui (x, x, 5, MPFR_RNDD);
if (mpfr_cmp_str1 (x, "0.21972245773362189536"))
{
printf ("Error in mpfr_div_ui for x=ln(3), u=5\n");
diff --git a/tests/teint.c b/tests/teint.c
index 5721f20a9..61ee0c43c 100644
--- a/tests/teint.c
+++ b/tests/teint.c
@@ -39,7 +39,7 @@ check_specials (void)
mpfr_init2 (y, 123L);
mpfr_set_nan (x);
- mpfr_eint (y, x, GMP_RNDN);
+ mpfr_eint (y, x, MPFR_RNDN);
if (! mpfr_nan_p (y))
{
printf ("Error: eint(NaN) != NaN\n");
@@ -47,7 +47,7 @@ check_specials (void)
}
mpfr_set_inf (x, 1);
- mpfr_eint (y, x, GMP_RNDN);
+ mpfr_eint (y, x, MPFR_RNDN);
if (! (mpfr_inf_p (y) && mpfr_sgn (y) > 0))
{
printf ("Error: eint(+Inf) != +Inf\n");
@@ -55,7 +55,7 @@ check_specials (void)
}
mpfr_set_inf (x, -1);
- mpfr_eint (y, x, GMP_RNDN);
+ mpfr_eint (y, x, MPFR_RNDN);
if (! mpfr_nan_p (y))
{
printf ("Error: eint(-Inf) != NaN\n");
@@ -63,15 +63,15 @@ check_specials (void)
}
/* eint(+/-0) = -Inf */
- mpfr_set_ui (x, 0, GMP_RNDN);
- mpfr_eint (y, x, GMP_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_eint (y, x, MPFR_RNDN);
if (! (mpfr_inf_p (y) && mpfr_sgn (y) < 0))
{
printf ("Error: eint(+0) != -Inf\n");
exit (1);
}
- mpfr_neg (x, x, GMP_RNDN);
- mpfr_eint (y, x, GMP_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN);
+ mpfr_eint (y, x, MPFR_RNDN);
if (! (mpfr_inf_p (y) && mpfr_sgn (y) < 0))
{
printf ("Error: eint(-0) != -Inf\n");
@@ -79,8 +79,8 @@ check_specials (void)
}
/* eint(x) = NaN for x < 0 */
- mpfr_set_si (x, -1, GMP_RNDN);
- mpfr_eint (y, x, GMP_RNDN);
+ mpfr_set_si (x, -1, MPFR_RNDN);
+ mpfr_eint (y, x, MPFR_RNDN);
if (! mpfr_nan_p (y))
{
printf ("Error: eint(-1) != NaN\n");
@@ -91,10 +91,10 @@ check_specials (void)
mpfr_set_prec (y, 17);
mpfr_set_str_binary (x, "1.0111110100100110e-2");
mpfr_set_str_binary (y, "-1.0010101001110100e-10");
- mpfr_eint (x, x, GMP_RNDZ);
+ mpfr_eint (x, x, MPFR_RNDZ);
if (mpfr_cmp (x, y))
{
- printf ("Error for x=1.0111110100100110e-2, GMP_RNDZ\n");
+ printf ("Error for x=1.0111110100100110e-2, MPFR_RNDZ\n");
printf ("expected "); mpfr_dump (y);
printf ("got "); mpfr_dump (x);
exit (1);
@@ -103,11 +103,11 @@ check_specials (void)
mpfr_set_prec (x, 53);
mpfr_set_prec (y, 53);
mpfr_set_str_binary (x, "0.10E4");
- mpfr_eint (x, x, GMP_RNDN);
- mpfr_set_str (y, "440.37989953483827", 10, GMP_RNDN);
+ mpfr_eint (x, x, MPFR_RNDN);
+ mpfr_set_str (y, "440.37989953483827", 10, MPFR_RNDN);
if (mpfr_cmp (x, y) != 0)
{
- printf ("Error for x=0.10E4, GMP_RNDZ\n");
+ printf ("Error for x=0.10E4, MPFR_RNDZ\n");
printf ("expected "); mpfr_dump (y);
printf ("got "); mpfr_dump (x);
exit (1);
@@ -116,11 +116,11 @@ check_specials (void)
mpfr_set_prec (x, 63);
mpfr_set_prec (y, 63);
mpfr_set_str_binary (x, "1.01111101011100111000011010001000101101011000011001111101011010e-2");
- mpfr_eint (x, x, GMP_RNDZ);
+ mpfr_eint (x, x, MPFR_RNDZ);
mpfr_set_str_binary (y, "1.11010110001101000001010010000100001111001000100100000001011100e-17");
if (mpfr_cmp (x, y) != 0)
{
- printf ("Error (1) for GMP_RNDZ\n");
+ printf ("Error (1) for MPFR_RNDZ\n");
printf ("expected "); mpfr_dump (y);
printf ("got "); mpfr_dump (x);
exit (1);
@@ -130,51 +130,51 @@ check_specials (void)
mpfr_set_prec (x, 53);
mpfr_set_prec (y, 53);
mpfr_set_str_binary (x, "1E6");
- mpfr_eint (x, x, GMP_RNDN);
+ mpfr_eint (x, x, MPFR_RNDN);
mpfr_set_str_binary (y, "10100011110001101001110000110010111000100111010001E37");
if (mpfr_cmp (x, y) != 0)
{
- printf ("Error for x=2^6, GMP_RNDN\n");
+ printf ("Error for x=2^6, MPFR_RNDN\n");
printf ("expected "); mpfr_dump (y);
printf ("got "); mpfr_dump (x);
exit (1);
}
mpfr_set_str_binary (x, "1E7");
- mpfr_eint (x, x, GMP_RNDN);
+ mpfr_eint (x, x, MPFR_RNDN);
mpfr_set_str_binary (y, "11001100100011110000101001011010110111111011110011E128");
if (mpfr_cmp (x, y) != 0)
{
- printf ("Error for x=2^7, GMP_RNDN\n");
+ printf ("Error for x=2^7, MPFR_RNDN\n");
printf ("expected "); mpfr_dump (y);
printf ("got "); mpfr_dump (x);
exit (1);
}
mpfr_set_str_binary (x, "1E8");
- mpfr_eint (x, x, GMP_RNDN);
+ mpfr_eint (x, x, MPFR_RNDN);
mpfr_set_str_binary (y, "1010000110000101111111011011000101001000101011101001E310");
if (mpfr_cmp (x, y) != 0)
{
- printf ("Error for x=2^8, GMP_RNDN\n");
+ printf ("Error for x=2^8, MPFR_RNDN\n");
printf ("expected "); mpfr_dump (y);
printf ("got "); mpfr_dump (x);
exit (1);
}
mpfr_set_str_binary (x, "1E9");
- mpfr_eint (x, x, GMP_RNDN);
+ mpfr_eint (x, x, MPFR_RNDN);
mpfr_set_str_binary (y, "11001010101000001010101101110000010110011101110010101E677");
if (mpfr_cmp (x, y) != 0)
{
- printf ("Error for x=2^9, GMP_RNDN\n");
+ printf ("Error for x=2^9, MPFR_RNDN\n");
printf ("expected "); mpfr_dump (y);
printf ("got "); mpfr_dump (x);
exit (1);
}
mpfr_set_str_binary (x, "1E10");
- mpfr_eint (x, x, GMP_RNDN);
+ mpfr_eint (x, x, MPFR_RNDN);
mpfr_set_str_binary (y, "10011111111010010110110101101000101100101010101101101E1415");
if (mpfr_cmp (x, y) != 0)
{
- printf ("Error for x=2^10, GMP_RNDN\n");
+ printf ("Error for x=2^10, MPFR_RNDN\n");
printf ("expected "); mpfr_dump (y);
printf ("got "); mpfr_dump (x);
exit (1);
@@ -195,12 +195,12 @@ main (int argc, char *argv[])
mp_prec_t p;
p = (argc < 3) ? 53 : atoi (argv[2]);
mpfr_init2 (x, p);
- mpfr_set_str (x, argv[1], 10, GMP_RNDN);
+ mpfr_set_str (x, argv[1], 10, MPFR_RNDN);
printf ("eint(");
- mpfr_out_str (stdout, 10, 0, x, GMP_RNDN);
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN);
printf (")=");
- mpfr_eint (x, x, GMP_RNDN);
- mpfr_out_str (stdout, 10, 0, x, GMP_RNDN);
+ mpfr_eint (x, x, MPFR_RNDN);
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN);
printf ("\n");
mpfr_clear (x);
}
diff --git a/tests/teq.c b/tests/teq.c
index 1d53de71d..06aa84d4e 100644
--- a/tests/teq.c
+++ b/tests/teq.c
@@ -38,7 +38,7 @@ teq (mpfr_t x)
for (k = 2; k < MPFR_PREC(x); k++)
{
- mpfr_set (y, x, GMP_RNDN);
+ mpfr_set (y, x, MPFR_RNDN);
MPFR_MANT(y) [mx] ^= (mp_limb_t) 1 << px;
@@ -78,7 +78,7 @@ special (void)
mpfr_set_str (x, "1", 10, (mp_rnd_t) 0);
mpfr_set_str (y, "1e-10000", 10, (mp_rnd_t) 0);
- mpfr_add (z, x, y, GMP_RNDU);
+ mpfr_add (z, x, y, MPFR_RNDU);
for (i = 1; i <= 52; i++)
if (mpfr_eq (x, z, i) == 0)
@@ -102,7 +102,7 @@ special (void)
mpfr_set_inf (y, 1);
MPFR_ASSERTN(mpfr_eq (x, y, 1) == 0);
- mpfr_set_ui (y, 0, GMP_RNDN);
+ mpfr_set_ui (y, 0, MPFR_RNDN);
MPFR_ASSERTN(mpfr_eq (x, y, 1) == 0);
mpfr_set_inf (x, 1);
@@ -118,32 +118,32 @@ special (void)
MPFR_ASSERTN(mpfr_eq (x, y, 1));
mpfr_set_inf (x, 1);
- mpfr_set_ui (y, 0, GMP_RNDN);
+ mpfr_set_ui (y, 0, MPFR_RNDN);
MPFR_ASSERTN(mpfr_eq (x, y, 1) == 0);
- mpfr_set_ui (x, 1, GMP_RNDN);
- mpfr_set_ui (y, 0, GMP_RNDN);
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_set_ui (y, 0, MPFR_RNDN);
MPFR_ASSERTN(mpfr_eq (x, y, 1) == 0);
MPFR_ASSERTN(mpfr_eq (y, x, 1) == 0);
- mpfr_set_ui (x, 0, GMP_RNDN);
- mpfr_set_ui (y, 0, GMP_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_set_ui (y, 0, MPFR_RNDN);
MPFR_ASSERTN(mpfr_eq (x, y, 1));
- mpfr_neg (y, y, GMP_RNDN);
+ mpfr_neg (y, y, MPFR_RNDN);
MPFR_ASSERTN(mpfr_eq (x, y, 1));
- mpfr_neg (x, x, GMP_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN);
MPFR_ASSERTN(mpfr_eq (x, y, 1));
- mpfr_set_ui (x, 1, GMP_RNDN);
- mpfr_neg (y, x, GMP_RNDN);
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_neg (y, x, MPFR_RNDN);
MPFR_ASSERTN(mpfr_eq (x, y, 1) == 0);
mpfr_set_prec (x, 2 * mp_bits_per_limb);
mpfr_set_prec (y, mp_bits_per_limb);
- mpfr_set_ui (x, 1, GMP_RNDN);
- mpfr_set_ui (y, 1, GMP_RNDN);
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_set_ui (y, 1, MPFR_RNDN);
MPFR_ASSERTN(mpfr_eq (x, y, mp_bits_per_limb - 1));
MPFR_ASSERTN(mpfr_eq (x, y, mp_bits_per_limb));
MPFR_ASSERTN(mpfr_eq (x, y, mp_bits_per_limb + 1));
@@ -165,14 +165,14 @@ special (void)
MPFR_ASSERTN(mpfr_eq (y, x, 2 * mp_bits_per_limb) == 0);
MPFR_ASSERTN(mpfr_eq (y, x, 2 * mp_bits_per_limb + 1) == 0);
- mpfr_set_ui (x, 1, GMP_RNDN);
- mpfr_set_ui (y, 2, GMP_RNDN);
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_set_ui (y, 2, MPFR_RNDN);
MPFR_ASSERTN(mpfr_eq (x, y, 1) == 0);
mpfr_set_prec (x, 2 * mp_bits_per_limb);
mpfr_set_prec (y, 2 * mp_bits_per_limb);
- mpfr_set_ui (x, 2, GMP_RNDN);
- mpfr_set_ui (y, 3, GMP_RNDN);
+ mpfr_set_ui (x, 2, MPFR_RNDN);
+ mpfr_set_ui (y, 3, MPFR_RNDN);
MPFR_ASSERTN(mpfr_eq (x, y, 1));
MPFR_ASSERTN(mpfr_eq (x, y, 2) == 0);
MPFR_ASSERTN(mpfr_eq (x, y, mp_bits_per_limb) == 0);
diff --git a/tests/terf.c b/tests/terf.c
index 9372b504a..2c8726679 100644
--- a/tests/terf.c
+++ b/tests/terf.c
@@ -47,7 +47,7 @@ special_erf (void)
/* erf(NaN) = NaN */
mpfr_set_nan (x);
- mpfr_erf (y, x, GMP_RNDN);
+ mpfr_erf (y, x, MPFR_RNDN);
if (!mpfr_nan_p (y))
{
printf ("mpfr_erf failed for x=NaN\n");
@@ -56,19 +56,19 @@ special_erf (void)
/* erf(+Inf) = 1 */
mpfr_set_inf (x, 1);
- mpfr_erf (y, x, GMP_RNDN);
+ mpfr_erf (y, x, MPFR_RNDN);
if (mpfr_cmp_ui (y, 1))
{
printf ("mpfr_erf failed for x=+Inf\n");
printf ("expected 1.0, got ");
- mpfr_out_str (stdout, 2, 0, y, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN);
printf ("\n");
exit (1);
}
/* erf(-Inf) = -1 */
mpfr_set_inf (x, -1);
- mpfr_erf (y, x, GMP_RNDN);
+ mpfr_erf (y, x, MPFR_RNDN);
if (mpfr_cmp_si (y, -1))
{
printf ("mpfr_erf failed for x=-Inf\n");
@@ -76,8 +76,8 @@ special_erf (void)
}
/* erf(+0) = +0 */
- mpfr_set_ui (x, 0, GMP_RNDN);
- mpfr_erf (y, x, GMP_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_erf (y, x, MPFR_RNDN);
if (mpfr_cmp_ui (y, 0) || mpfr_sgn (y) < 0)
{
printf ("mpfr_erf failed for x=+0\n");
@@ -85,79 +85,79 @@ special_erf (void)
}
/* erf(-0) = -0 */
- mpfr_neg (x, x, GMP_RNDN);
- mpfr_erf (y, x, GMP_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN);
+ mpfr_erf (y, x, MPFR_RNDN);
if (mpfr_cmp_ui (y, 0) || mpfr_sgn (y) > 0)
{
printf ("mpfr_erf failed for x=-0\n");
exit (1);
}
- mpfr_set_ui (x, 1, GMP_RNDN);
- mpfr_erf (x, x, GMP_RNDN);
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_erf (x, x, MPFR_RNDN);
mpfr_set_str_binary (y, "0.11010111101110110011110100111010000010000100010001011");
if (mpfr_cmp (x, y))
{
- printf ("mpfr_erf failed for x=1.0, rnd=GMP_RNDN\n");
+ printf ("mpfr_erf failed for x=1.0, rnd=MPFR_RNDN\n");
printf ("expected ");
- mpfr_out_str (stdout, 2, 0, y, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN);
printf ("\n");
printf ("got ");
- mpfr_out_str (stdout, 2, 0, x, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN);
printf ("\n");
exit (1);
}
- mpfr_set_str (x, "6.6", 10, GMP_RNDN);
- mpfr_erf (x, x, GMP_RNDN);
+ mpfr_set_str (x, "6.6", 10, MPFR_RNDN);
+ mpfr_erf (x, x, MPFR_RNDN);
if (mpfr_cmp_ui (x, 1))
{
- printf ("mpfr_erf failed for x=6.6, rnd=GMP_RNDN\n");
+ printf ("mpfr_erf failed for x=6.6, rnd=MPFR_RNDN\n");
printf ("expected 1\n");
printf ("got ");
- mpfr_out_str (stdout, 2, 0, x, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN);
printf ("\n");
exit (1);
}
- mpfr_set_str (x, "-6.6", 10, GMP_RNDN);
- mpfr_erf (x, x, GMP_RNDN);
+ mpfr_set_str (x, "-6.6", 10, MPFR_RNDN);
+ mpfr_erf (x, x, MPFR_RNDN);
if (mpfr_cmp_si (x, -1))
{
- printf ("mpfr_erf failed for x=-6.6, rnd=GMP_RNDN\n");
+ printf ("mpfr_erf failed for x=-6.6, rnd=MPFR_RNDN\n");
printf ("expected -1\n");
printf ("got ");
- mpfr_out_str (stdout, 2, 0, x, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN);
printf ("\n");
exit (1);
}
- mpfr_set_str (x, "6.6", 10, GMP_RNDN);
- mpfr_erf (x, x, GMP_RNDZ);
+ mpfr_set_str (x, "6.6", 10, MPFR_RNDN);
+ mpfr_erf (x, x, MPFR_RNDZ);
mpfr_set_str_binary (y, "0.11111111111111111111111111111111111111111111111111111");
if (mpfr_cmp (x, y))
{
- printf ("mpfr_erf failed for x=6.6, rnd=GMP_RNDZ\n");
+ printf ("mpfr_erf failed for x=6.6, rnd=MPFR_RNDZ\n");
printf ("expected ");
- mpfr_out_str (stdout, 2, 0, y, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN);
printf ("\n");
printf ("got ");
- mpfr_out_str (stdout, 2, 0, x, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN);
printf ("\n");
exit (1);
}
- mpfr_set_str (x, "4.5", 10, GMP_RNDN);
- mpfr_erf (x, x, GMP_RNDN);
+ mpfr_set_str (x, "4.5", 10, MPFR_RNDN);
+ mpfr_erf (x, x, MPFR_RNDN);
mpfr_set_str_binary (y, "0.1111111111111111111111111111111100100111110100011");
if (mpfr_cmp (x, y))
{
- printf ("mpfr_erf failed for x=4.5, rnd=GMP_RNDN\n");
+ printf ("mpfr_erf failed for x=4.5, rnd=MPFR_RNDN\n");
printf ("expected ");
- mpfr_out_str (stdout, 2, 0, y, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN);
printf ("\n");
printf ("got ");
- mpfr_out_str (stdout, 2, 0, x, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN);
printf ("\n");
exit (1);
}
@@ -165,54 +165,54 @@ special_erf (void)
mpfr_set_prec (x, 120);
mpfr_set_prec (y, 120);
mpfr_set_str_binary (x, "0.110100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011E3");
- mpfr_erf (x, x, GMP_RNDN);
+ mpfr_erf (x, x, MPFR_RNDN);
mpfr_set_str_binary (y, "0.11111111111111111111111111111111111111111111111111111111111111111100111111000100111011111011010000110101111100011001101");
if (mpfr_cmp (x, y))
{
- printf ("mpfr_erf failed for x=6.6, rnd=GMP_RNDN\n");
+ printf ("mpfr_erf failed for x=6.6, rnd=MPFR_RNDN\n");
printf ("expected ");
- mpfr_out_str (stdout, 2, 0, y, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN);
printf ("\n");
printf ("got ");
- mpfr_out_str (stdout, 2, 0, x, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN);
printf ("\n");
exit (1);
}
mpfr_set_prec (x, 8);
mpfr_set_prec (y, 8);
- mpfr_set_ui (x, 50, GMP_RNDN);
- inex = mpfr_erf (y, x, GMP_RNDN);
+ mpfr_set_ui (x, 50, MPFR_RNDN);
+ inex = mpfr_erf (y, x, MPFR_RNDN);
if (mpfr_cmp_ui (y, 1))
{
- printf ("mpfr_erf failed for x=50, rnd=GMP_RNDN\n");
+ printf ("mpfr_erf failed for x=50, rnd=MPFR_RNDN\n");
printf ("expected 1, got ");
- mpfr_out_str (stdout, 2, 0, y, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN);
printf ("\n");
exit (1);
}
if (inex <= 0)
{
- printf ("mpfr_erf failed for x=50, rnd=GMP_RNDN: wrong ternary value\n"
+ printf ("mpfr_erf failed for x=50, rnd=MPFR_RNDN: wrong ternary value\n"
"expected positive, got %d\n", inex);
exit (1);
}
- inex = mpfr_erf (x, x, GMP_RNDZ);
+ inex = mpfr_erf (x, x, MPFR_RNDZ);
mpfr_nextbelow (y);
if (mpfr_cmp (x, y))
{
- printf ("mpfr_erf failed for x=50, rnd=GMP_RNDZ\n");
+ printf ("mpfr_erf failed for x=50, rnd=MPFR_RNDZ\n");
printf ("expected ");
- mpfr_out_str (stdout, 2, 0, y, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN);
printf ("\n");
printf ("got ");
- mpfr_out_str (stdout, 2, 0, x, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN);
printf ("\n");
exit (1);
}
if (inex >= 0)
{
- printf ("mpfr_erf failed for x=50, rnd=GMP_RNDN: wrong ternary value\n"
+ printf ("mpfr_erf failed for x=50, rnd=MPFR_RNDN: wrong ternary value\n"
"expected negative, got %d\n", inex);
exit (1);
}
@@ -222,7 +222,7 @@ special_erf (void)
mpfr_set_str_binary (x, "0.1010100100111011001111100101E-1");
mpfr_set_str_binary (y, "0.10111000001110011010110001101011E-1");
- mpfr_erf (x, x, GMP_RNDN);
+ mpfr_erf (x, x, MPFR_RNDN);
if (mpfr_cmp (x, y))
{
printf ("Error: erf for prec=32 (1)\n");
@@ -231,7 +231,7 @@ special_erf (void)
mpfr_set_str_binary (x, "-0.10110011011010111110010001100001");
mpfr_set_str_binary (y, "-0.1010110110101011100010111000111");
- mpfr_erf (x, x, GMP_RNDN);
+ mpfr_erf (x, x, MPFR_RNDN);
if (mpfr_cmp (x, y))
{
printf ("Error: erf for prec=32 (2)\n");
@@ -241,21 +241,21 @@ special_erf (void)
mpfr_set_str_binary (x, "100.10001110011110100000110000111");
mpfr_set_str_binary (y, "0.11111111111111111111111111111111");
- mpfr_erf (x, x, GMP_RNDN);
+ mpfr_erf (x, x, MPFR_RNDN);
if (mpfr_cmp (x, y))
{
printf ("Error: erf for prec=32 (3)\n");
exit (1);
}
mpfr_set_str_binary (x, "100.10001110011110100000110000111");
- mpfr_erf (x, x, GMP_RNDZ);
+ mpfr_erf (x, x, MPFR_RNDZ);
if (mpfr_cmp (x, y))
{
printf ("Error: erf for prec=32 (4)\n");
exit (1);
}
mpfr_set_str_binary (x, "100.10001110011110100000110000111");
- mpfr_erf (x, x, GMP_RNDU);
+ mpfr_erf (x, x, MPFR_RNDU);
if (mpfr_cmp_ui (x, 1))
{
printf ("Error: erf for prec=32 (5)\n");
@@ -263,7 +263,7 @@ special_erf (void)
}
mpfr_set_str_binary (x, "100.10001110011110100000110001000");
- mpfr_erf (x, x, GMP_RNDN);
+ mpfr_erf (x, x, MPFR_RNDN);
if (mpfr_cmp_ui (x, 1))
{
printf ("Error: erf for prec=32 (6)\n");
@@ -271,44 +271,44 @@ special_erf (void)
}
mpfr_set_str_binary (x, "100.10001110011110100000110001000");
mpfr_set_str_binary (y, "0.11111111111111111111111111111111");
- mpfr_erf (x, x, GMP_RNDZ);
+ mpfr_erf (x, x, MPFR_RNDZ);
if (mpfr_cmp (x, y))
{
printf ("Error: erf for prec=32 (7)\n");
exit (1);
}
mpfr_set_str_binary (x, "100.10001110011110100000110001000");
- mpfr_erf (x, x, GMP_RNDU);
+ mpfr_erf (x, x, MPFR_RNDU);
if (mpfr_cmp_ui (x, 1))
{
printf ("Error: erf for prec=32 (8)\n");
exit (1);
}
- mpfr_set_ui (x, 5, GMP_RNDN);
- mpfr_erf (x, x, GMP_RNDN);
+ mpfr_set_ui (x, 5, MPFR_RNDN);
+ mpfr_erf (x, x, MPFR_RNDN);
if (mpfr_cmp_ui (x, 1))
{
printf ("Error: erf for prec=32 (9)\n");
exit (1);
}
- mpfr_set_ui (x, 5, GMP_RNDN);
- mpfr_erf (x, x, GMP_RNDU);
+ mpfr_set_ui (x, 5, MPFR_RNDN);
+ mpfr_erf (x, x, MPFR_RNDU);
if (mpfr_cmp_ui (x, 1))
{
printf ("Error: erf for prec=32 (10)\n");
exit (1);
}
- mpfr_set_ui (x, 5, GMP_RNDN);
- mpfr_erf (x, x, GMP_RNDZ);
+ mpfr_set_ui (x, 5, MPFR_RNDN);
+ mpfr_erf (x, x, MPFR_RNDZ);
mpfr_set_str_binary (y, "0.11111111111111111111111111111111");
if (mpfr_cmp (x, y))
{
printf ("Error: erf for prec=32 (11)\n");
exit (1);
}
- mpfr_set_ui (x, 5, GMP_RNDN);
- mpfr_erf (x, x, GMP_RNDD);
+ mpfr_set_ui (x, 5, MPFR_RNDN);
+ mpfr_erf (x, x, MPFR_RNDD);
mpfr_set_str_binary (y, "0.11111111111111111111111111111111");
if (mpfr_cmp (x, y))
{
@@ -319,7 +319,7 @@ special_erf (void)
mpfr_set_prec (x, 43);
mpfr_set_prec (y, 64);
mpfr_set_str_binary (x, "-0.1101110110101111100101011101110101101001001e3");
- mpfr_erf (y, x, GMP_RNDU);
+ mpfr_erf (y, x, MPFR_RNDU);
mpfr_set_prec (x, 64);
mpfr_set_str_binary (x, "-0.1111111111111111111111111111111111111111111111111111111111111111");
if (mpfr_cmp (x, y))
@@ -332,7 +332,7 @@ special_erf (void)
mpfr_set_prec (x, 53);
mpfr_set_prec (y, 53);
mpfr_set_str_binary (x, "1.0000000000000000000000000000000000000110000000101101");
- mpfr_erf (y, x, GMP_RNDN);
+ mpfr_erf (y, x, MPFR_RNDN);
mpfr_set_str_binary (x, "0.110101111011101100111101001110100000101011000011001");
if (mpfr_cmp (x, y))
{
@@ -341,7 +341,7 @@ special_erf (void)
}
mpfr_set_str_binary (x, "1.0000000000000000000000000000011000111010101101011010");
- mpfr_erf (y, x, GMP_RNDU);
+ mpfr_erf (y, x, MPFR_RNDU);
mpfr_set_str_binary (x, "0.11010111101110110011110100111100100111100011111000110");
if (mpfr_cmp (x, y))
{
@@ -349,7 +349,7 @@ special_erf (void)
exit (1);
}
mpfr_set_str_binary (x, "1.0000000000000000000000000000011000111010101101011010");
- mpfr_erf (y, x, GMP_RNDD);
+ mpfr_erf (y, x, MPFR_RNDD);
mpfr_set_str_binary (x, "0.11010111101110110011110100111100100111100011111000101");
if (mpfr_cmp (x, y))
{
@@ -370,7 +370,7 @@ special_erfc (void)
/* erfc (NaN) = NaN */
mpfr_set_nan (x);
- mpfr_erfc (y, x, GMP_RNDN);
+ mpfr_erfc (y, x, MPFR_RNDN);
if (!mpfr_nan_p (y))
{
printf ("mpfr_erfc failed for x=NaN\n");
@@ -378,7 +378,7 @@ special_erfc (void)
}
/* erfc(+Inf) = 0+ */
mpfr_set_inf (x, 1);
- mpfr_erfc (y, x, GMP_RNDN);
+ mpfr_erfc (y, x, MPFR_RNDN);
if (!MPFR_IS_ZERO (y) || !MPFR_IS_POS (y))
{
printf ("mpfr_erf failed for x=+Inf\n");
@@ -388,7 +388,7 @@ special_erfc (void)
}
/* erfc(-Inf) = 2 */
mpfr_set_inf (x, -1);
- mpfr_erfc (y, x, GMP_RNDN);
+ mpfr_erfc (y, x, MPFR_RNDN);
if (mpfr_cmp_ui (y, 2))
{
printf ("mpfr_erf failed for x=-Inf\n");
@@ -397,8 +397,8 @@ special_erfc (void)
exit (1);
}
/* erf(+0) = 1 */
- mpfr_set_ui (x, 0, GMP_RNDN);
- mpfr_erfc (y, x, GMP_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_erfc (y, x, MPFR_RNDN);
if (mpfr_cmp_ui (y, 1))
{
printf ("mpfr_erf failed for x=+0\n");
@@ -418,8 +418,8 @@ large_arg (void)
mpfr_init2 (x, 88);
mpfr_init2 (y, 98);
- mpfr_set_si_2exp (x, -1, 173, GMP_RNDN);
- mpfr_erfc (y, x, GMP_RNDN);
+ mpfr_set_si_2exp (x, -1, 173, MPFR_RNDN);
+ mpfr_erfc (y, x, MPFR_RNDN);
if (mpfr_cmp_ui (y, 2) != 0)
{
printf ("mpfr_erfc failed for large x (1)\n");
@@ -430,7 +430,7 @@ large_arg (void)
mpfr_set_prec (x, 33);
mpfr_set_prec (y, 43);
mpfr_set_str_binary (x, "1.11000101010111011000111100101001e6");
- mpfr_erfc (y, x, GMP_RNDD);
+ mpfr_erfc (y, x, MPFR_RNDD);
mpfr_set_prec (x, 43);
mpfr_set_str_binary (x, "100010011100101100001101100101011101101E-18579");
if (mpfr_cmp (x, y) != 0)
@@ -440,8 +440,8 @@ large_arg (void)
}
mpfr_set_prec (y, 43);
- mpfr_set_si_2exp (x, 1, 11, GMP_RNDN);
- mpfr_erfc (y, x, GMP_RNDN);
+ mpfr_set_si_2exp (x, 1, 11, MPFR_RNDN);
+ mpfr_erfc (y, x, MPFR_RNDN);
mpfr_set_str_binary (x, "0.1100000100100010101111001111010010001000110E-6051113");
if (mpfr_cmp (x, y) != 0)
{
@@ -452,7 +452,7 @@ large_arg (void)
mpfr_set_prec (x, 75);
mpfr_set_prec (y, 85);
mpfr_set_str_binary (x, "0.111110111111010011101011001100001010011110101010011111010010111101010001011E15");
- mpfr_erfc (y, x, GMP_RNDN);
+ mpfr_erfc (y, x, MPFR_RNDN);
if (mpfr_cmp_ui (y, 0) || mpfr_sgn (y) < 0)
{
printf ("mpfr_erfc failed for large x (3b)\n");
@@ -462,7 +462,7 @@ large_arg (void)
mpfr_set_prec (x, 2);
mpfr_set_prec (y, 21);
mpfr_set_str_binary (x, "-1.0e3");
- mpfr_erfc (y, x, GMP_RNDZ);
+ mpfr_erfc (y, x, MPFR_RNDZ);
mpfr_set_prec (x, 21);
mpfr_set_str_binary (x, "1.11111111111111111111");
if (mpfr_cmp (x, y) != 0)
@@ -474,7 +474,7 @@ large_arg (void)
mpfr_set_prec (x, 2);
mpfr_set_prec (y, 31);
mpfr_set_str_binary (x, "-1.0e3");
- mpfr_erfc (y, x, GMP_RNDZ);
+ mpfr_erfc (y, x, MPFR_RNDZ);
mpfr_set_prec (x, 31);
mpfr_set_str_binary (x, "1.111111111111111111111111111111");
if (mpfr_cmp (x, y) != 0)
@@ -488,9 +488,9 @@ large_arg (void)
/* Reported by Christopher Creutzig on 2007-07-10. */
mpfr_set_prec (x, 53);
mpfr_set_prec (y, 53);
- mpfr_set_si_2exp (x, 54563, -1, GMP_RNDN);
- mpfr_erfc (y, x, GMP_RNDZ);
- mpfr_set_ui (x, 0, GMP_RNDN);
+ mpfr_set_si_2exp (x, 54563, -1, MPFR_RNDN);
+ mpfr_erfc (y, x, MPFR_RNDZ);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
if (! mpfr_equal_p (y, x))
{
printf ("mpfr_erfc failed for x=27281.5, prec=53 (6)\n");
@@ -500,9 +500,9 @@ large_arg (void)
}
/* same test with rounding away from zero */
- mpfr_set_si_2exp (x, 54563, -1, GMP_RNDN);
- mpfr_erfc (y, x, GMP_RNDU);
- mpfr_set_ui (x, 0, GMP_RNDN);
+ mpfr_set_si_2exp (x, 54563, -1, MPFR_RNDN);
+ mpfr_erfc (y, x, MPFR_RNDU);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
mpfr_nextabove (x);
if (! mpfr_equal_p (y, x))
{
@@ -524,9 +524,9 @@ test_erfc (void)
mpfr_inits2 (40, x, y, z, (mpfr_ptr) 0);
- mpfr_set_si_2exp (x, -1, -10, GMP_RNDN);
+ mpfr_set_si_2exp (x, -1, -10, MPFR_RNDN);
mpfr_set_str_binary (z, "0.1000000000100100000110111010110111100000E1");
- mpfr_erfc (y, x, GMP_RNDN);
+ mpfr_erfc (y, x, MPFR_RNDN);
if (mpfr_cmp (y, z) != 0)
{
printf ("mpfr_erfc failed for x = ");
@@ -540,8 +540,8 @@ test_erfc (void)
/* slowness detected by Kevin Rauch on 26 Oct 2007 */
mpfr_set_prec (x, 128);
- mpfr_set_si (x, -256, GMP_RNDN);
- inex = mpfr_erfc (x, x, GMP_RNDN);
+ mpfr_set_si (x, -256, MPFR_RNDN);
+ inex = mpfr_erfc (x, x, MPFR_RNDN);
MPFR_ASSERTN(inex > 0 && mpfr_cmp_ui (x, 2) == 0);
mpfr_clears (x, y, z, (mpfr_ptr) 0);
diff --git a/tests/tests.c b/tests/tests.c
index 7bc308431..ae2903524 100644
--- a/tests/tests.c
+++ b/tests/tests.c
@@ -520,7 +520,7 @@ tests_default_random (mpfr_ptr x, int pos, mp_exp_t emin, mp_exp_t emax)
}
}
if (randlimb () % 512 < pos)
- mpfr_neg (x, x, GMP_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN);
}
/* The test_one argument is a boolean. If it is true and rnd is a rounding
@@ -530,7 +530,7 @@ tests_default_random (mpfr_ptr x, int pos, mp_exp_t emin, mp_exp_t emax)
zero, then the function is tested twice, first with the provided rounding
mode and second with the rounding mode towards the corresponding infinity
(determined by the sign of the result). If it is false, then the function
- is tested in the 5 rounding modes, and rnd must initially be GMP_RNDZ; thus
+ is tested in the 5 rounding modes, and rnd must initially be MPFR_RNDZ; thus
rndnext will be initialized in the first iteration.
As examples of use, see the calls to test5rm from the data_check and
bad_cases functions. */
@@ -539,60 +539,60 @@ test5rm (int (*fct) (FLIST), mpfr_srcptr x, mpfr_ptr y, mpfr_ptr z,
mp_rnd_t rnd, int test_one, char *name)
{
mp_prec_t yprec = MPFR_PREC (y);
- mp_rnd_t rndnext = GMP_RND_MAX; /* means uninitialized */
+ mp_rnd_t rndnext = MPFR_RND_MAX; /* means uninitialized */
- MPFR_ASSERTN (test_one || rnd == GMP_RNDZ);
+ MPFR_ASSERTN (test_one || rnd == MPFR_RNDZ);
mpfr_set_prec (z, yprec);
while (1)
{
- MPFR_ASSERTN (rnd != GMP_RND_MAX);
+ MPFR_ASSERTN (rnd != MPFR_RND_MAX);
fct (z, x, rnd);
if (! mpfr_equal_p (y, z))
{
printf ("Error for %s with xprec=%lu, yprec=%lu, rnd=%s\nx = ",
name, (unsigned long) MPFR_PREC (x), (unsigned long) yprec,
mpfr_print_rnd_mode (rnd));
- mpfr_out_str (stdout, 16, 0, x, GMP_RNDN);
+ mpfr_out_str (stdout, 16, 0, x, MPFR_RNDN);
printf ("\nexpected ");
- mpfr_out_str (stdout, 16, 0, y, GMP_RNDN);
+ mpfr_out_str (stdout, 16, 0, y, MPFR_RNDN);
printf ("\ngot ");
- mpfr_out_str (stdout, 16, 0, z, GMP_RNDN);
+ mpfr_out_str (stdout, 16, 0, z, MPFR_RNDN);
printf ("\n");
exit (1);
}
- if (rnd == GMP_RNDN)
+ if (rnd == MPFR_RNDN)
break;
if (test_one)
{
- if (rnd == GMP_RNDU || rnd == GMP_RNDD)
+ if (rnd == MPFR_RNDU || rnd == MPFR_RNDD)
break;
if (MPFR_IS_NEG (y))
- rnd = (rnd == GMP_RNDA) ? GMP_RNDD : GMP_RNDU;
+ rnd = (rnd == MPFR_RNDA) ? MPFR_RNDD : MPFR_RNDU;
else
- rnd = (rnd == GMP_RNDA) ? GMP_RNDU : GMP_RNDD;
+ rnd = (rnd == MPFR_RNDA) ? MPFR_RNDU : MPFR_RNDD;
}
- else if (rnd == GMP_RNDZ)
+ else if (rnd == MPFR_RNDZ)
{
- rnd = MPFR_IS_NEG (y) ? GMP_RNDU : GMP_RNDD;
- rndnext = GMP_RNDA;
+ rnd = MPFR_IS_NEG (y) ? MPFR_RNDU : MPFR_RNDD;
+ rndnext = MPFR_RNDA;
}
else
{
rnd = rndnext;
- if (rnd == GMP_RNDA)
+ if (rnd == MPFR_RNDA)
{
mpfr_nexttoinf (y);
- rndnext = (MPFR_IS_NEG (y)) ? GMP_RNDD : GMP_RNDU;
+ rndnext = (MPFR_IS_NEG (y)) ? MPFR_RNDD : MPFR_RNDU;
}
- else if (rndnext != GMP_RNDN)
- rndnext = GMP_RNDN;
+ else if (rndnext != MPFR_RNDN)
+ rndnext = MPFR_RNDN;
else
{
if (yprec == MPFR_PREC_MIN)
break;
- mpfr_prec_round (y, --yprec, GMP_RNDZ);
+ mpfr_prec_round (y, --yprec, MPFR_RNDZ);
mpfr_set_prec (z, yprec);
}
}
@@ -703,16 +703,16 @@ data_check (char *f, int (*foo) (FLIST), char *name)
switch (r)
{
case 'n':
- rnd = GMP_RNDN;
+ rnd = MPFR_RNDN;
break;
case 'z': case 'Z':
- rnd = GMP_RNDZ;
+ rnd = MPFR_RNDZ;
break;
case 'u':
- rnd = GMP_RNDU;
+ rnd = MPFR_RNDU;
break;
case 'd':
- rnd = GMP_RNDD;
+ rnd = MPFR_RNDD;
break;
default:
printf ("Error: unexpected rounding mode"
@@ -721,12 +721,12 @@ data_check (char *f, int (*foo) (FLIST), char *name)
}
mpfr_set_prec (x, xprec);
mpfr_set_prec (y, yprec);
- if (mpfr_inp_str (x, fp, 0, GMP_RNDN) == 0)
+ if (mpfr_inp_str (x, fp, 0, MPFR_RNDN) == 0)
{
printf ("Error: corrupted argument in file '%s'\n", f);
exit (1);
}
- if (mpfr_inp_str (y, fp, 0, GMP_RNDN) == 0)
+ if (mpfr_inp_str (y, fp, 0, MPFR_RNDN) == 0)
{
printf ("Error: corrupted result in file '%s'\n", f);
exit (1);
@@ -792,13 +792,13 @@ bad_cases (int (*fct)(FLIST), int (*inv)(FLIST), char *name,
if (dbg)
{
printf ("bad_cases: yprec =%4ld, y = ", (long) py);
- mpfr_out_str (stdout, 16, 0, y, GMP_RNDN);
+ mpfr_out_str (stdout, 16, 0, y, MPFR_RNDN);
printf ("\n");
}
px = py + psup;
mpfr_set_prec (x, px);
mpfr_clear_flags ();
- inv (x, y, GMP_RNDN);
+ inv (x, y, MPFR_RNDN);
if (mpfr_nanflag_p () || mpfr_overflow_p () || mpfr_underflow_p ())
{
if (dbg)
@@ -808,7 +808,7 @@ bad_cases (int (*fct)(FLIST), int (*inv)(FLIST), char *name,
if (dbg > 1)
{
printf ("bad_cases: x = ");
- mpfr_out_str (stdout, 16, 0, x, GMP_RNDN);
+ mpfr_out_str (stdout, 16, 0, x, MPFR_RNDN);
printf ("\n");
}
pz = px;
@@ -816,7 +816,7 @@ bad_cases (int (*fct)(FLIST), int (*inv)(FLIST), char *name,
{
pz += 32;
mpfr_set_prec (z, pz);
- if (fct (z, x, GMP_RNDN) == 0)
+ if (fct (z, x, MPFR_RNDN) == 0)
{
if (dbg)
printf ("bad_cases: exact case\n");
@@ -827,16 +827,16 @@ bad_cases (int (*fct)(FLIST), int (*inv)(FLIST), char *name,
if (dbg > 1)
{
printf ("bad_cases: %s(x) ~= ", name);
- mpfr_out_str (stdout, 16, 0, z, GMP_RNDN);
+ mpfr_out_str (stdout, 16, 0, z, MPFR_RNDN);
}
else
{
- printf ("bad_cases: [GMP_RNDZ] ~= ");
- mpfr_out_str (stdout, 16, 40, z, GMP_RNDZ);
+ printf ("bad_cases: [MPFR_RNDZ] ~= ");
+ mpfr_out_str (stdout, 16, 40, z, MPFR_RNDZ);
}
printf ("\n");
}
- inex = mpfr_prec_round (z, py, GMP_RNDN);
+ inex = mpfr_prec_round (z, py, MPFR_RNDN);
if (mpfr_nanflag_p () || mpfr_overflow_p () || mpfr_underflow_p ()
|| ! mpfr_equal_p (z, y))
{
@@ -849,11 +849,11 @@ bad_cases (int (*fct)(FLIST), int (*inv)(FLIST), char *name,
/* We really have a bad case. */
do
py--;
- while (py >= MPFR_PREC_MIN && mpfr_prec_round (z, py, GMP_RNDZ) == 0);
+ while (py >= MPFR_PREC_MIN && mpfr_prec_round (z, py, MPFR_RNDZ) == 0);
py++;
/* py is now the smallest output precision such that we have
a bad case in the directed rounding modes. */
- if (mpfr_prec_round (y, py, GMP_RNDZ) != 0)
+ if (mpfr_prec_round (y, py, MPFR_RNDZ) != 0)
{
printf ("Internal error for i = %d\n", i);
exit (1);
@@ -868,11 +868,11 @@ bad_cases (int (*fct)(FLIST), int (*inv)(FLIST), char *name,
if (dbg)
{
printf ("bad_cases: yprec =%4ld, y = ", (long) py);
- mpfr_out_str (stdout, 16, 0, y, GMP_RNDN);
+ mpfr_out_str (stdout, 16, 0, y, MPFR_RNDN);
printf ("\n");
}
/* Note: y is now the expected result rounded towards zero. */
- test5rm (fct, x, y, z, GMP_RNDZ, 0, name);
+ test5rm (fct, x, y, z, MPFR_RNDZ, 0, name);
next_i:
/* In case the exponent range has been changed by
tests_default_random()... */
diff --git a/tests/texceptions.c b/tests/texceptions.c
index a7b9bbb89..561bd78e7 100644
--- a/tests/texceptions.c
+++ b/tests/texceptions.c
@@ -34,9 +34,9 @@ check_powerof2 (void)
mpfr_t x;
mpfr_init (x);
- mpfr_set_ui (x, 1, GMP_RNDN);
+ mpfr_set_ui (x, 1, MPFR_RNDN);
MPFR_ASSERTN (mpfr_powerof2_raw (x));
- mpfr_set_ui (x, 3, GMP_RNDN);
+ mpfr_set_ui (x, 3, MPFR_RNDN);
MPFR_ASSERTN (!mpfr_powerof2_raw (x));
mpfr_clear (x);
}
@@ -47,7 +47,7 @@ check_default_rnd (void)
{
int r;
mp_rnd_t t;
- for(r = 0 ; r < GMP_RND_MAX ; r++)
+ for(r = 0 ; r < MPFR_RND_MAX ; r++)
{
mpfr_set_default_rounding_mode ((mp_rnd_t) r);
t = (mpfr_get_default_rounding_mode) ();
@@ -57,11 +57,11 @@ check_default_rnd (void)
ERROR("ERROR in setting / getting default rounding mode (1)");
}
}
- mpfr_set_default_rounding_mode ((mp_rnd_t) GMP_RND_MAX);
- if (mpfr_get_default_rounding_mode() != GMP_RNDA)
+ mpfr_set_default_rounding_mode ((mp_rnd_t) MPFR_RND_MAX);
+ if (mpfr_get_default_rounding_mode() != MPFR_RNDA)
ERROR("ERROR in setting / getting default rounding mode (2)");
mpfr_set_default_rounding_mode((mp_rnd_t) -1);
- if (mpfr_get_default_rounding_mode() != GMP_RNDA)
+ if (mpfr_get_default_rounding_mode() != MPFR_RNDA)
ERROR("ERROR in setting / getting default rounding mode (3)");
}
@@ -152,34 +152,34 @@ check_flags (void)
(mpfr_clear_flags)();
mpfr_set_double_range ();
- mpfr_set_ui (x, 1, GMP_RNDN);
+ mpfr_set_ui (x, 1, MPFR_RNDN);
(mpfr_clear_overflow)();
- mpfr_mul_2exp (x, x, 1024, GMP_RNDN);
+ mpfr_mul_2exp (x, x, 1024, MPFR_RNDN);
if (!(mpfr_overflow_p)())
ERROR("ERROR: No overflow detected!\n");
(mpfr_clear_underflow)();
- mpfr_set_ui (x, 1, GMP_RNDN);
- mpfr_div_2exp (x, x, 1025, GMP_RNDN);
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_div_2exp (x, x, 1025, MPFR_RNDN);
if (!(mpfr_underflow_p)())
ERROR("ERROR: No underflow detected!\n");
(mpfr_clear_nanflag)();
MPFR_SET_NAN(x);
- mpfr_add (x, x, x, GMP_RNDN);
+ mpfr_add (x, x, x, MPFR_RNDN);
if (!(mpfr_nanflag_p)())
ERROR("ERROR: No NaN flag!\n");
(mpfr_clear_inexflag)();
- mpfr_set_ui(x, 2, GMP_RNDN);
- mpfr_cos(x, x, GMP_RNDN);
+ mpfr_set_ui(x, 2, MPFR_RNDN);
+ mpfr_cos(x, x, MPFR_RNDN);
if (!(mpfr_inexflag_p)())
ERROR("ERROR: No inexact flag!\n");
(mpfr_clear_erangeflag) ();
- mpfr_set_ui (x, 1, GMP_RNDN);
- mpfr_mul_2exp (x, x, 1024, GMP_RNDN);
- mpfr_get_ui (x, GMP_RNDN);
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_mul_2exp (x, x, 1024, MPFR_RNDN);
+ mpfr_get_ui (x, MPFR_RNDN);
if (!(mpfr_erangeflag_p)())
ERROR ("ERROR: No erange flag!\n");
@@ -192,20 +192,20 @@ static void
test_set_underflow (void)
{
mpfr_t x, zero, min;
- mpfr_ptr r[GMP_RND_MAX];
- int t[GMP_RND_MAX] = { 1, -1, 1, -1, 1 }; /* RNDN, RNDZ, RNDU, RNDD, RNDA */
+ mpfr_ptr r[MPFR_RND_MAX];
+ int t[MPFR_RND_MAX] = { 1, -1, 1, -1, 1 }; /* RNDN, RNDZ, RNDU, RNDD, RNDA */
int i;
int s;
mpfr_inits (x, zero, min, (mpfr_ptr) 0);
- mpfr_set_ui (zero, 0, GMP_RNDN);
- mpfr_set_ui (min, 0, GMP_RNDN);
+ mpfr_set_ui (zero, 0, MPFR_RNDN);
+ mpfr_set_ui (min, 0, MPFR_RNDN);
mpfr_nextabove (min);
r[0] = r[2] = r[4] = min; /* RNDN, RNDU, RNDA */
r[1] = r[3] = zero; /* RNDZ, RNDD */
for (s = 1; s > 0; s = -1)
{
- for (i = 0; i < GMP_RND_MAX ; i++)
+ for (i = 0; i < MPFR_RND_MAX ; i++)
{
int j;
int inex;
@@ -217,15 +217,15 @@ test_set_underflow (void)
printf ("Error in test_set_underflow, sign = %d,"
" rnd_mode = %s\n", s, mpfr_print_rnd_mode ((mp_rnd_t) i));
printf ("Got\n");
- mpfr_out_str (stdout, 2, 0, x, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN);
printf (", inex = %d\ninstead of\n", inex);
- mpfr_out_str (stdout, 2, 0, r[j], GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, r[j], MPFR_RNDN);
printf (", inex = %d\n", t[j]);
exit (1);
}
}
- mpfr_neg (zero, zero, GMP_RNDN);
- mpfr_neg (min, min, GMP_RNDN);
+ mpfr_neg (zero, zero, MPFR_RNDN);
+ mpfr_neg (min, min, MPFR_RNDN);
}
mpfr_clears (x, zero, min, (mpfr_ptr) 0);
}
@@ -234,8 +234,8 @@ static void
test_set_overflow (void)
{
mpfr_t x, inf, max;
- mpfr_ptr r[GMP_RND_MAX];
- int t[GMP_RND_MAX] = { 1, -1, 1, -1, 1 }; /* RNDN, RNDZ, RNDU, RNDD, RNDA */
+ mpfr_ptr r[MPFR_RND_MAX];
+ int t[MPFR_RND_MAX] = { 1, -1, 1, -1, 1 }; /* RNDN, RNDZ, RNDU, RNDD, RNDA */
int i;
int s;
@@ -247,7 +247,7 @@ test_set_overflow (void)
r[1] = r[3] = max; /* RNDZ, RNDD */
for (s = 1; s > 0; s = -1)
{
- for (i = 0; i < GMP_RND_MAX ; i++)
+ for (i = 0; i < MPFR_RND_MAX ; i++)
{
int j;
int inex;
@@ -259,15 +259,15 @@ test_set_overflow (void)
printf ("Error in test_set_overflow, sign = %d,"
" rnd_mode = %s\n", s, mpfr_print_rnd_mode ((mp_rnd_t) i));
printf ("Got\n");
- mpfr_out_str (stdout, 2, 0, x, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN);
printf (", inex = %d\ninstead of\n", inex);
- mpfr_out_str (stdout, 2, 0, r[j], GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, r[j], MPFR_RNDN);
printf (", inex = %d\n", t[j]);
exit (1);
}
}
- mpfr_neg (inf, inf, GMP_RNDN);
- mpfr_neg (max, max, GMP_RNDN);
+ mpfr_neg (inf, inf, MPFR_RNDN);
+ mpfr_neg (max, max, MPFR_RNDN);
}
mpfr_clears (x, inf, max, (mpfr_ptr) 0);
}
@@ -314,10 +314,10 @@ main (int argc, char *argv[])
exit (1);
}
- mpfr_set_ui (x, 1, GMP_RNDN);
- mpfr_mul_2exp (x, x, 1024, GMP_RNDN);
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_mul_2exp (x, x, 1024, MPFR_RNDN);
mpfr_set_double_range ();
- mpfr_check_range (x, 0, GMP_RNDN);
+ mpfr_check_range (x, 0, MPFR_RNDN);
if (!mpfr_inf_p (x) || (mpfr_sgn(x) <= 0))
{
printf ("Error: 2^1024 rounded to nearest should give +Inf\n");
@@ -325,19 +325,19 @@ main (int argc, char *argv[])
}
set_emax (1025);
- mpfr_set_ui (x, 1, GMP_RNDN);
- mpfr_mul_2exp (x, x, 1024, GMP_RNDN);
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_mul_2exp (x, x, 1024, MPFR_RNDN);
mpfr_set_double_range ();
- mpfr_check_range (x, 0, GMP_RNDD);
+ mpfr_check_range (x, 0, MPFR_RNDD);
if (!mpfr_number_p (x))
{
printf ("Error: 2^1024 rounded down should give a normal number\n");
exit (1);
}
- mpfr_set_ui (x, 1, GMP_RNDN);
- mpfr_mul_2exp (x, x, 1023, GMP_RNDN);
- mpfr_add (x, x, x, GMP_RNDN);
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_mul_2exp (x, x, 1023, MPFR_RNDN);
+ mpfr_add (x, x, x, MPFR_RNDN);
if (!mpfr_inf_p (x) || (mpfr_sgn(x) <= 0))
{
printf ("Error: x+x rounded to nearest for x=2^1023 should give +Inf\n");
@@ -346,9 +346,9 @@ main (int argc, char *argv[])
exit (1);
}
- mpfr_set_ui (x, 1, GMP_RNDN);
- mpfr_mul_2exp (x, x, 1023, GMP_RNDN);
- mpfr_add (x, x, x, GMP_RNDD);
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_mul_2exp (x, x, 1023, MPFR_RNDN);
+ mpfr_add (x, x, x, MPFR_RNDD);
if (!mpfr_number_p (x))
{
printf ("Error: x+x rounded down for x=2^1023 should give"
@@ -356,10 +356,10 @@ main (int argc, char *argv[])
exit (1);
}
- mpfr_set_ui (x, 1, GMP_RNDN);
- mpfr_div_2exp (x, x, 1022, GMP_RNDN);
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_div_2exp (x, x, 1022, MPFR_RNDN);
mpfr_set_str_binary (y, "1.1e-1022"); /* y = 3/2*x */
- mpfr_sub (y, y, x, GMP_RNDZ);
+ mpfr_sub (y, y, x, MPFR_RNDZ);
if (mpfr_cmp_ui (y, 0))
{
printf ("Error: y-x rounded to zero should give 0"
@@ -369,10 +369,10 @@ main (int argc, char *argv[])
}
set_emin (-1026);
- mpfr_set_ui (x, 1, GMP_RNDN);
- mpfr_div_2exp (x, x, 1025, GMP_RNDN);
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_div_2exp (x, x, 1025, MPFR_RNDN);
mpfr_set_double_range ();
- mpfr_check_range (x, 0, GMP_RNDN);
+ mpfr_check_range (x, 0, MPFR_RNDN);
if (!MPFR_IS_ZERO (x) )
{
printf ("Error: x rounded to nearest for x=2^-1024 should give Zero\n");
diff --git a/tests/texp.c b/tests/texp.c
index ab91a3500..d1d3bb518 100644
--- a/tests/texp.c
+++ b/tests/texp.c
@@ -31,7 +31,7 @@ static int
test_exp (mpfr_ptr a, mpfr_srcptr b, mp_rnd_t rnd_mode)
{
int res;
- int ok = rnd_mode == GMP_RNDN && mpfr_number_p (b) && mpfr_get_prec (a)>=53;
+ int ok = rnd_mode == MPFR_RNDN && mpfr_number_p (b) && mpfr_get_prec (a)>=53;
if (ok)
{
mpfr_print_raw (b);
@@ -57,7 +57,7 @@ check3 (const char *op, mp_rnd_t rnd, const char *res)
mpfr_inits2 (53, x, y, (mpfr_ptr) 0);
/* y negative. If we forget to set the sign in mpfr_exp, we'll see it. */
- mpfr_set_si (y, -1, GMP_RNDN);
+ mpfr_set_si (y, -1, MPFR_RNDN);
mpfr_set_str1 (x, op);
test_exp (y, x, rnd);
if (mpfr_cmp_str1 (y, res) )
@@ -65,7 +65,7 @@ check3 (const char *op, mp_rnd_t rnd, const char *res)
printf ("mpfr_exp failed for x=%s, rnd=%s\n",
op, mpfr_print_rnd_mode (rnd));
printf ("expected result is %s, got ", res);
- mpfr_out_str (stdout, 10, 0, y, GMP_RNDN);
+ mpfr_out_str (stdout, 10, 0, y, MPFR_RNDN);
putchar('\n');
exit (1);
}
@@ -80,14 +80,14 @@ check_worst_case (const char *Xs, const char *expxs)
mpfr_inits2 (53, x, y, (mpfr_ptr) 0);
mpfr_set_str1(x, Xs);
- test_exp(y, x, GMP_RNDD);
+ test_exp(y, x, MPFR_RNDD);
if (mpfr_cmp_str1 (y, expxs))
{
printf ("exp(x) rounded towards -infinity is wrong\n");
exit(1);
}
mpfr_set_str1(x, Xs);
- test_exp(x, x, GMP_RNDU);
+ test_exp(x, x, MPFR_RNDU);
mpfr_nexttoinf (y);
if (mpfr_cmp(x,y))
{
@@ -110,31 +110,31 @@ check_worst_cases (void)
check_worst_case("6.39488462184069720009e-14", "1.00000000000006372680");
check_worst_case("1.84741111297455401935e-12", "1.00000000000184718907");
check_worst_case("1.76177628026265550074e-10", "1.00000000017617751702");
- check3("1.76177628026265550074e-10", GMP_RNDN, "1.00000000017617773906");
+ check3("1.76177628026265550074e-10", MPFR_RNDN, "1.00000000017617773906");
check_worst_case("7.54175277499595900852e-10", "1.00000000075417516676");
- check3("7.54175277499595900852e-10", GMP_RNDN, "1.00000000075417538881");
+ check3("7.54175277499595900852e-10", MPFR_RNDN, "1.00000000075417538881");
/* bug found by Vincent Lefe`vre on December 8, 1999 */
- check3("-5.42410311287441459172e+02", GMP_RNDN, "2.7176584868845723e-236");
+ check3("-5.42410311287441459172e+02", MPFR_RNDN, "2.7176584868845723e-236");
/* further cases communicated by Vincent Lefe`vre on January 27, 2000 */
- check3("-1.32920285897904911589e-10", GMP_RNDN, "0.999999999867079769622");
- check3("-1.44037948245738330735e-10", GMP_RNDN, "0.9999999998559621072757");
- check3("-1.66795910430705305937e-10", GMP_RNDZ, "0.9999999998332040895832");
- check3("-1.64310953745426656203e-10", GMP_RNDN, "0.9999999998356891017792");
- check3("-1.38323574826034659172e-10", GMP_RNDZ, "0.9999999998616764251835");
- check3("-1.23621668465115401498e-10", GMP_RNDZ, "0.9999999998763783315425");
+ check3("-1.32920285897904911589e-10", MPFR_RNDN, "0.999999999867079769622");
+ check3("-1.44037948245738330735e-10", MPFR_RNDN, "0.9999999998559621072757");
+ check3("-1.66795910430705305937e-10", MPFR_RNDZ, "0.9999999998332040895832");
+ check3("-1.64310953745426656203e-10", MPFR_RNDN, "0.9999999998356891017792");
+ check3("-1.38323574826034659172e-10", MPFR_RNDZ, "0.9999999998616764251835");
+ check3("-1.23621668465115401498e-10", MPFR_RNDZ, "0.9999999998763783315425");
mpfr_set_prec (x, 601);
- mpfr_set_str (x, "0.88b6ba510e10450edc258748bc9dfdd466f21b47ed264cdf24aa8f64af1f3fad9ec2301d43c0743f534b5aa20091ff6d352df458ef1ba519811ef6f5b11853534fd8fa32764a0a6d2d0dd20@0", 16, GMP_RNDZ);
+ mpfr_set_str (x, "0.88b6ba510e10450edc258748bc9dfdd466f21b47ed264cdf24aa8f64af1f3fad9ec2301d43c0743f534b5aa20091ff6d352df458ef1ba519811ef6f5b11853534fd8fa32764a0a6d2d0dd20@0", 16, MPFR_RNDZ);
mpfr_init2 (y, 601);
- mpfr_exp_2 (y, x, GMP_RNDD);
- mpfr_exp_3 (x, x, GMP_RNDD);
+ mpfr_exp_2 (y, x, MPFR_RNDD);
+ mpfr_exp_3 (x, x, MPFR_RNDD);
if (mpfr_cmp (x, y))
{
printf ("mpfr_exp_2 and mpfr_exp_3 differ for prec=601\n");
printf ("mpfr_exp_2 gives ");
- mpfr_out_str (stdout, 2, 0, y, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN);
printf ("\nmpfr_exp_3 gives ");
- mpfr_out_str (stdout, 2, 0, x, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN);
printf ("\n");
exit (1);
}
@@ -142,8 +142,8 @@ check_worst_cases (void)
mpfr_set_prec (x, 13001);
mpfr_set_prec (y, 13001);
mpfr_urandomb (x, RANDS);
- mpfr_exp_3 (y, x, GMP_RNDN);
- mpfr_exp_2 (x, x, GMP_RNDN);
+ mpfr_exp_3 (y, x, MPFR_RNDN);
+ mpfr_exp_2 (x, x, MPFR_RNDN);
if (mpfr_cmp (x, y))
{
printf ("mpfr_exp_2 and mpfr_exp_3 differ for prec=13001\n");
@@ -205,10 +205,10 @@ check_large (void)
prec = 203780;
mpfr_init2 (x, prec);
mpfr_init2 (z, prec);
- mpfr_set_ui (x, 3, GMP_RNDN);
- mpfr_sqrt (x, x, GMP_RNDN);
- mpfr_sub_ui (x, x, 1, GMP_RNDN);
- mpfr_exp_3 (z, x, GMP_RNDN);
+ mpfr_set_ui (x, 3, MPFR_RNDN);
+ mpfr_sqrt (x, x, MPFR_RNDN);
+ mpfr_sub_ui (x, x, 1, MPFR_RNDN);
+ mpfr_exp_3 (z, x, MPFR_RNDN);
mpfr_clear (x);
mpfr_clear (z);
}
@@ -233,7 +233,7 @@ check_special (void)
/* check exp(NaN) = NaN */
mpfr_set_nan (x);
- test_exp (y, x, GMP_RNDN);
+ test_exp (y, x, MPFR_RNDN);
if (!mpfr_nan_p (y))
{
printf ("Error for exp(NaN)\n");
@@ -242,7 +242,7 @@ check_special (void)
/* check exp(+inf) = +inf */
mpfr_set_inf (x, 1);
- test_exp (y, x, GMP_RNDN);
+ test_exp (y, x, MPFR_RNDN);
if (!mpfr_inf_p (y) || mpfr_sgn (y) < 0)
{
printf ("Error for exp(+inf)\n");
@@ -251,7 +251,7 @@ check_special (void)
/* check exp(-inf) = +0 */
mpfr_set_inf (x, -1);
- test_exp (y, x, GMP_RNDN);
+ test_exp (y, x, MPFR_RNDN);
if (mpfr_cmp_ui (y, 0) || mpfr_sgn (y) < 0)
{
printf ("Error for exp(-inf)\n");
@@ -264,11 +264,11 @@ check_special (void)
mpfr_set_emin (MPFR_EMIN_DEFAULT);
mpfr_set_str (x,
"0.1011000101110010000101111111010100001100000001110001100111001101E30",
- 2, GMP_RNDN);
- mpfr_exp (x, x, GMP_RNDD);
+ 2, MPFR_RNDN);
+ mpfr_exp (x, x, MPFR_RNDD);
if (mpfr_cmp_str (x,
".1111111111111111111111111111111111111111111111111111111111111111E1073741823",
- 2, GMP_RNDN) != 0)
+ 2, MPFR_RNDN) != 0)
{
printf ("Wrong overflow detection in mpfr_exp\n");
mpfr_dump (x);
@@ -277,9 +277,9 @@ check_special (void)
/* Check underflow. Corner case of mpfr_exp_2 */
mpfr_set_str (x,
"-0.1011000101110010000101111111011111010001110011110111100110101100E30",
- 2, GMP_RNDN);
- mpfr_exp (x, x, GMP_RNDN);
- if (mpfr_cmp_str (x, "0.1E-1073741823", 2, GMP_RNDN) != 0)
+ 2, MPFR_RNDN);
+ mpfr_exp (x, x, MPFR_RNDN);
+ if (mpfr_cmp_str (x, "0.1E-1073741823", 2, MPFR_RNDN) != 0)
{
printf ("Wrong underflow (1) detection in mpfr_exp\n");
mpfr_dump (x);
@@ -287,8 +287,8 @@ check_special (void)
}
mpfr_set_str (x,
"-0.1011001101110010000101111111011111010001110011110111100110111101E30",
- 2, GMP_RNDN);
- mpfr_exp (x, x, GMP_RNDN);
+ 2, MPFR_RNDN);
+ mpfr_exp (x, x, MPFR_RNDN);
if (mpfr_cmp_ui (x, 0) != 0)
{
printf ("Wrong underflow (2) detection in mpfr_exp\n");
@@ -304,9 +304,9 @@ check_special (void)
? MPFR_EXP_THRESHOLD + 10 : 64);
mpfr_set_str (x,
"0.1011000101110010000101111111010100001100000001110001100111001101E30",
- 2, GMP_RNDN);
+ 2, MPFR_RNDN);
mpfr_clear_overflow ();
- mpfr_exp (x, x, GMP_RNDD);
+ mpfr_exp (x, x, MPFR_RNDD);
if (!mpfr_overflow_p ())
{
printf ("Wrong overflow detection in mpfr_exp_3\n");
@@ -316,9 +316,9 @@ check_special (void)
/* Check underflow. Corner case of mpfr_exp_3 */
mpfr_set_str (x,
"-0.1011000101110010000101111111011111010001110011110111100110101100E30",
- 2, GMP_RNDN);
+ 2, MPFR_RNDN);
mpfr_clear_underflow ();
- mpfr_exp (x, x, GMP_RNDN);
+ mpfr_exp (x, x, MPFR_RNDN);
if (!mpfr_underflow_p ())
{
printf ("Wrong underflow detection in mpfr_exp_3\n");
@@ -330,8 +330,8 @@ check_special (void)
/* check overflow */
set_emax (10);
- mpfr_set_ui (x, 7, GMP_RNDN);
- test_exp (y, x, GMP_RNDN);
+ mpfr_set_ui (x, 7, MPFR_RNDN);
+ test_exp (y, x, MPFR_RNDN);
if (!mpfr_inf_p (y) || mpfr_sgn (y) < 0)
{
printf ("Error for exp(7) for emax=10\n");
@@ -341,8 +341,8 @@ check_special (void)
/* check underflow */
set_emin (-10);
- mpfr_set_si (x, -9, GMP_RNDN);
- test_exp (y, x, GMP_RNDN);
+ mpfr_set_si (x, -9, MPFR_RNDN);
+ test_exp (y, x, MPFR_RNDN);
if (mpfr_cmp_ui (y, 0) || mpfr_sgn (y) < 0)
{
printf ("Error for exp(-9) for emin=-10\n");
@@ -355,7 +355,7 @@ check_special (void)
/* check case EXP(x) < -precy */
mpfr_set_prec (y, 2);
mpfr_set_str_binary (x, "-0.1E-3");
- test_exp (y, x, GMP_RNDD);
+ test_exp (y, x, MPFR_RNDD);
if (mpfr_cmp_ui_2exp (y, 3, -2))
{
printf ("Error for exp(-1/16), prec=2, RNDD\n");
@@ -363,7 +363,7 @@ check_special (void)
mpfr_dump (y);
exit (1);
}
- test_exp (y, x, GMP_RNDZ);
+ test_exp (y, x, MPFR_RNDZ);
if (mpfr_cmp_ui_2exp (y, 3, -2))
{
printf ("Error for exp(-1/16), prec=2, RNDZ\n");
@@ -372,13 +372,13 @@ check_special (void)
exit (1);
}
mpfr_set_str_binary (x, "0.1E-3");
- test_exp (y, x, GMP_RNDN);
+ test_exp (y, x, MPFR_RNDN);
if (mpfr_cmp_ui (y, 1))
{
printf ("Error for exp(1/16), prec=2, RNDN\n");
exit (1);
}
- test_exp (y, x, GMP_RNDU);
+ test_exp (y, x, MPFR_RNDU);
if (mpfr_cmp_ui_2exp (y, 3, -1))
{
printf ("Error for exp(1/16), prec=2, RNDU\n");
@@ -389,13 +389,13 @@ check_special (void)
mpfr_set_prec (x, 53);
mpfr_set_prec (y, 53);
mpfr_set_str_binary (x, "1.1101011000111101011110000111010010101001101001110111e28");
- test_exp (y, x, GMP_RNDN);
+ test_exp (y, x, MPFR_RNDN);
mpfr_set_prec (x, 153);
mpfr_set_prec (z, 153);
mpfr_set_str_binary (x, "1.1101011000111101011110000111010010101001101001110111e28");
- test_exp (z, x, GMP_RNDN);
- mpfr_prec_round (z, 53, GMP_RNDN);
+ test_exp (z, x, MPFR_RNDN);
+ mpfr_prec_round (z, 53, MPFR_RNDN);
if (mpfr_cmp (y, z))
{
@@ -405,9 +405,9 @@ check_special (void)
/* corner cases in mpfr_exp_3 */
mpfr_set_prec (x, 2);
- mpfr_set_ui (x, 1, GMP_RNDN);
+ mpfr_set_ui (x, 1, MPFR_RNDN);
mpfr_set_prec (y, 2);
- mpfr_exp_3 (y, x, GMP_RNDN);
+ mpfr_exp_3 (y, x, MPFR_RNDN);
/* Check some little things about overflow detection */
set_emin (-125);
@@ -417,10 +417,10 @@ check_special (void)
mpfr_set_str_binary (x, "0.11110000000000000000000000000000000000000000000"
"0000000000000000000000000000000000000000000000000000"
"00000000E4");
- test_exp (y, x, GMP_RNDN);
+ test_exp (y, x, MPFR_RNDN);
if (mpfr_cmp_str (y, "0.11000111100001100110010101111101011010010101010000"
"1101110111100010111001011111111000110111001011001101010"
- "01E22", 2, GMP_RNDN))
+ "01E22", 2, MPFR_RNDN))
{
printf ("Special overflow error (1)\n");
mpfr_dump (y);
@@ -431,29 +431,29 @@ check_special (void)
set_emax (emax);
/* Check for overflow producing a segfault with HUGE exponent */
- mpfr_set_ui (x, 3, GMP_RNDN);
- mpfr_mul_2ui (x, x, 32, GMP_RNDN);
- test_exp (y, x, GMP_RNDN); /* Can't test return value: May overflow or not*/
+ mpfr_set_ui (x, 3, MPFR_RNDN);
+ mpfr_mul_2ui (x, x, 32, MPFR_RNDN);
+ test_exp (y, x, MPFR_RNDN); /* Can't test return value: May overflow or not*/
/* Bug due to wrong approximation of (x)/log2 */
mpfr_set_prec (x, 163);
mpfr_set_str (x, "-4.28ac8fceeadcda06bb56359017b1c81b85b392e7", 16,
- GMP_RNDN);
- mpfr_exp (x, x, GMP_RNDN);
+ MPFR_RNDN);
+ mpfr_exp (x, x, MPFR_RNDN);
if (mpfr_cmp_str (x, "3.fffffffffffffffffffffffffffffffffffffffe8@-2",
- 16, GMP_RNDN))
+ 16, MPFR_RNDN))
{
printf ("Error for x= -4.28ac8fceeadcda06bb56359017b1c81b85b392e7");
printf ("expected 3.fffffffffffffffffffffffffffffffffffffffe8@-2");
printf ("Got ");
- mpfr_out_str (stdout, 16, 0, x, GMP_RNDN); putchar ('\n');
+ mpfr_out_str (stdout, 16, 0, x, MPFR_RNDN); putchar ('\n');
}
/* bug found by Guillaume Melquiond, 13 Sep 2005 */
mpfr_set_prec (x, 53);
mpfr_set_str_binary (x, "-1E-400");
- mpfr_exp (x, x, GMP_RNDZ);
+ mpfr_exp (x, x, MPFR_RNDZ);
if (mpfr_cmp_ui (x, 1) == 0)
{
printf ("Error for exp(-2^(-400))\n");
@@ -477,7 +477,7 @@ check_inexact (void)
mpfr_set_str_binary (x,
"1.0000000000001001000110100100101000001101101011100101e2");
- inexact = test_exp (y, x, GMP_RNDN);
+ inexact = test_exp (y, x, MPFR_RNDN);
if (inexact <= 0)
{
printf ("Wrong inexact flag (Got %d instead of 1)\n", inexact);
@@ -495,9 +495,9 @@ check_exp10(void)
int inexact;
mpfr_init2 (x, 200);
- mpfr_set_ui(x, 4, GMP_RNDN);
+ mpfr_set_ui(x, 4, MPFR_RNDN);
- inexact = mpfr_exp10 (x, x, GMP_RNDN);
+ inexact = mpfr_exp10 (x, x, MPFR_RNDN);
if (mpfr_cmp_ui(x, 10*10*10*10))
{
printf ("exp10: Wrong returned value\n");
@@ -526,17 +526,17 @@ overflowed_exp0 (void)
for (emax = -1; emax <= 0; emax++)
{
- mpfr_set_ui_2exp (y, 1, emax, GMP_RNDN);
+ mpfr_set_ui_2exp (y, 1, emax, MPFR_RNDN);
mpfr_nextbelow (y);
set_emax (emax); /* 1 is not representable. */
/* and if emax < 0, 1 - eps is not representable either. */
for (i = -1; i <= 1; i++)
RND_LOOP (rnd)
{
- mpfr_set_si_2exp (x, i, -512 * ABS (i), GMP_RNDN);
+ mpfr_set_si_2exp (x, i, -512 * ABS (i), MPFR_RNDN);
mpfr_clear_flags ();
inex = mpfr_exp (x, x, (mp_rnd_t) rnd);
- if ((i >= 0 || emax < 0 || rnd == GMP_RNDN || rnd == GMP_RNDU) &&
+ if ((i >= 0 || emax < 0 || rnd == MPFR_RNDN || rnd == MPFR_RNDU) &&
! mpfr_overflow_p ())
{
printf ("Error in overflowed_exp0 (i = %d, rnd = %s):\n"
@@ -544,7 +544,7 @@ overflowed_exp0 (void)
i, mpfr_print_rnd_mode ((mp_rnd_t) rnd));
err = 1;
}
- if (rnd == GMP_RNDZ || rnd == GMP_RNDD)
+ if (rnd == MPFR_RNDZ || rnd == MPFR_RNDD)
{
if (inex >= 0)
{
@@ -603,22 +603,22 @@ bug20080731 (void)
mpfr_init2 (x, 200);
mpfr_set_str (x, "-2.c5c85fdf473de6af278ece700fcbdabd03cd0cb9ca62d8b62c@7",
- 16, GMP_RNDN);
+ 16, MPFR_RNDN);
mpfr_init2 (y1, prec);
- mpfr_exp (y1, x, GMP_RNDU);
+ mpfr_exp (y1, x, MPFR_RNDU);
/* Compute the result with a higher internal precision. */
mpfr_init2 (y2, 300);
- mpfr_exp (y2, x, GMP_RNDU);
- mpfr_prec_round (y2, prec, GMP_RNDU);
+ mpfr_exp (y2, x, MPFR_RNDU);
+ mpfr_prec_round (y2, prec, MPFR_RNDU);
if (mpfr_cmp0 (y1, y2) != 0)
{
printf ("Error in bug20080731\nExpected ");
- mpfr_out_str (stdout, 16, 0, y2, GMP_RNDN);
+ mpfr_out_str (stdout, 16, 0, y2, MPFR_RNDN);
printf ("\nGot ");
- mpfr_out_str (stdout, 16, 0, y1, GMP_RNDN);
+ mpfr_out_str (stdout, 16, 0, y1, MPFR_RNDN);
printf ("\n");
exit (1);
}
@@ -648,7 +648,7 @@ underflow_up (int extended_emin)
int i, j;
mpfr_init2 (minpos, 2);
- mpfr_set_ui (minpos, 0, GMP_RNDN);
+ mpfr_set_ui (minpos, 0, MPFR_RNDN);
mpfr_nextabove (minpos);
/* Let's test values near the underflow boundary.
@@ -662,15 +662,15 @@ underflow_up (int extended_emin)
* rnd(exp(x)) >= minpos and no underflow.
* So, let's take x1 = rndu(log(minpos)) in some precision.
* 2. If eps < 0, then exp(x) < minpos and the result will be either 0
- * or minpos. An underflow always occurs in GMP_RNDZ and GMP_RNDD,
- * but not necessarily in GMP_RNDN and GMP_RNDU (this is underflow
+ * or minpos. An underflow always occurs in MPFR_RNDZ and MPFR_RNDD,
+ * but not necessarily in MPFR_RNDN and MPFR_RNDU (this is underflow
* after rounding in an unbounded exponent range). If -a < eps < -b,
* minpos * (1 - a) < exp(x) < minpos * (1 - b + b^2).
- * - If eps > -2^(-p), no underflow in GMP_RNDU.
- * - If eps > -2^(-p-1), no underflow in GMP_RNDN.
- * - If eps < - (2^(-p-1) + 2^(-2p-1)), underflow in GMP_RNDN.
- * - If eps < - (2^(-p) + 2^(-2p+1)), underflow in GMP_RNDU.
- * - In GMP_RNDN, result is minpos iff exp(eps) > 1/2, i.e.
+ * - If eps > -2^(-p), no underflow in MPFR_RNDU.
+ * - If eps > -2^(-p-1), no underflow in MPFR_RNDN.
+ * - If eps < - (2^(-p-1) + 2^(-2p-1)), underflow in MPFR_RNDN.
+ * - If eps < - (2^(-p) + 2^(-2p+1)), underflow in MPFR_RNDU.
+ * - In MPFR_RNDN, result is minpos iff exp(eps) > 1/2, i.e.
* - log(2) < eps < ...
*
* Moreover, since precy < MPFR_EXP_THRESHOLD (to avoid tests that take
@@ -682,7 +682,7 @@ underflow_up (int extended_emin)
*/
/* Case eps > 0. In revision 5461 (trunk) on a 64-bit Linux machine:
- * Incorrect flags in underflow_up, eps > 0, GMP_RNDN and extended emin
+ * Incorrect flags in underflow_up, eps > 0, MPFR_RNDN and extended emin
* for precx = 96, precy = 16, mpfr_exp_3
* Got 9 instead of 8.
* Note: testing this case in several precisions for x and y introduces
@@ -692,7 +692,7 @@ underflow_up (int extended_emin)
for (precx = 16; precx <= 128; precx += 16)
{
mpfr_init2 (x, precx);
- mpfr_log (x, minpos, GMP_RNDU);
+ mpfr_log (x, minpos, MPFR_RNDU);
for (precy = 16; precy <= 128; precy += 16)
{
mpfr_init2 (y, precy);
@@ -730,9 +730,9 @@ underflow_up (int extended_emin)
err = 1;
}
MPFR_ASSERTN (inex != 0);
- if (rnd == GMP_RNDD || rnd == GMP_RNDZ)
+ if (rnd == MPFR_RNDD || rnd == MPFR_RNDZ)
MPFR_ASSERTN (inex < 0);
- if (rnd == GMP_RNDU)
+ if (rnd == MPFR_RNDU)
MPFR_ASSERTN (inex > 0);
if (err)
exit (1);
@@ -744,31 +744,31 @@ underflow_up (int extended_emin)
mpfr_clear (x);
}
- /* Case - log(2) < eps < 0 in GMP_RNDN, starting with small-precision x;
+ /* Case - log(2) < eps < 0 in MPFR_RNDN, starting with small-precision x;
* only check the result and the ternary value.
* Previous to r5453 (trunk), on 32-bit and 64-bit machines, this fails
* for precx = 65 and precy = 16, e.g.:
* exp_2.c:264: assertion failed: ...
- * because mpfr_sub (r, x, r, GMP_RNDU); yields a null value. This is
+ * because mpfr_sub (r, x, r, MPFR_RNDU); yields a null value. This is
* fixed in r5453 by going to next Ziv's iteration.
*/
for (precx = sizeof(mp_exp_t) * CHAR_BIT + 1; precx <= 81; precx += 8)
{
mpfr_init2 (x, precx);
- mpfr_log (x, minpos, GMP_RNDD); /* |ulp| <= 1/2 */
+ mpfr_log (x, minpos, MPFR_RNDD); /* |ulp| <= 1/2 */
for (precy = 16; precy <= 128; precy += 16)
{
mpfr_init2 (y, precy);
- inex = mpfr_exp (y, x, GMP_RNDN);
+ inex = mpfr_exp (y, x, MPFR_RNDN);
if (inex <= 0 || mpfr_cmp0 (y, minpos) != 0)
{
printf ("Error in underflow_up, - log(2) < eps < 0");
if (extended_emin)
printf (" and extended emin");
printf (" for prec = %d\nExpected ", precy);
- mpfr_out_str (stdout, 16, 0, minpos, GMP_RNDN);
+ mpfr_out_str (stdout, 16, 0, minpos, MPFR_RNDN);
printf (" (minimum positive MPFR number) and inex > 0\nGot ");
- mpfr_out_str (stdout, 16, 0, y, GMP_RNDN);
+ mpfr_out_str (stdout, 16, 0, y, MPFR_RNDN);
printf ("\nwith inex = %d\n", inex);
exit (1);
}
@@ -785,8 +785,8 @@ underflow_up (int extended_emin)
mpfr_inits2 (2, t, t2, (mpfr_ptr) 0);
for (precy = 16; precy <= 128; precy += 16)
{
- mpfr_set_ui_2exp (t, 1, - precy, GMP_RNDN); /* 2^(-p) */
- mpfr_set_ui_2exp (t2, 1, 1 - 2 * precy, GMP_RNDN); /* 2^(-2p+1) */
+ mpfr_set_ui_2exp (t, 1, - precy, MPFR_RNDN); /* 2^(-p) */
+ mpfr_set_ui_2exp (t2, 1, 1 - 2 * precy, MPFR_RNDN); /* 2^(-2p+1) */
precx = sizeof(mp_exp_t) * CHAR_BIT + 2 * precy + 8;
mpfr_init2 (x, precx);
mpfr_init2 (y, precy);
@@ -797,16 +797,16 @@ underflow_up (int extended_emin)
if (j == 0)
{
/* Case eps > -2^(-(p+i)). */
- mpfr_log (x, minpos, GMP_RNDU);
+ mpfr_log (x, minpos, MPFR_RNDU);
}
else /* j == 1 */
{
/* Case eps < - (2^(-(p+i)) + 2^(1-2(p+i))). */
- mpfr_log (x, minpos, GMP_RNDD);
- inex = mpfr_sub (x, x, t2, GMP_RNDN);
+ mpfr_log (x, minpos, MPFR_RNDD);
+ inex = mpfr_sub (x, x, t2, MPFR_RNDN);
MPFR_ASSERTN (inex == 0);
}
- inex = mpfr_sub (x, x, t, GMP_RNDN);
+ inex = mpfr_sub (x, x, t, MPFR_RNDN);
MPFR_ASSERTN (inex == 0);
RND_LOOP (rnd)
@@ -816,9 +816,9 @@ underflow_up (int extended_emin)
unsigned int flags;
flags = MPFR_FLAGS_INEXACT |
- (((rnd == GMP_RNDU || rnd == GMP_RNDA)
+ (((rnd == MPFR_RNDU || rnd == MPFR_RNDA)
&& (i == 1 || j == 0)) ||
- (rnd == GMP_RNDN && (i == 1 && j == 0)) ?
+ (rnd == MPFR_RNDN && (i == 1 && j == 0)) ?
0 : MPFR_FLAGS_UNDERFLOW);
mpfr_clear_flags ();
inex = e3 ? exp_3 (y, x, (mpfr_rnd_t) rnd)
@@ -841,7 +841,7 @@ underflow_up (int extended_emin)
__gmpfr_flags, flags);
err = 1;
}
- if (rnd == GMP_RNDU || rnd == GMP_RNDA || rnd == GMP_RNDN ?
+ if (rnd == MPFR_RNDU || rnd == MPFR_RNDA || rnd == MPFR_RNDN ?
mpfr_cmp0 (y, minpos) != 0 : MPFR_NOTZERO (y))
{
printf ("Incorrect result in underflow_up, %s",
@@ -863,8 +863,8 @@ underflow_up (int extended_emin)
exit (1);
} /* for (e3 ...) */
} /* for (j ...) */
- mpfr_div_2si (t, t, 1, GMP_RNDN);
- mpfr_div_2si (t2, t2, 2, GMP_RNDN);
+ mpfr_div_2si (t, t, 1, MPFR_RNDN);
+ mpfr_div_2si (t2, t2, 2, MPFR_RNDN);
} /* for (i ...) */
mpfr_clears (x, y, (mpfr_ptr) 0);
} /* for (precy ...) */
@@ -887,9 +887,9 @@ underflow_up (int extended_emin)
mpfr_inits2 (sizeof(mp_exp_t) * CHAR_BIT + 64, x, t, (mpfr_ptr) 0);
for (i = 0; i <= 1; i++)
{
- mpfr_log (x, minpos, i ? GMP_RNDU : GMP_RNDD);
- mpfr_const_log2 (t, i ? GMP_RNDD : GMP_RNDU);
- mpfr_sub (x, x, t, i ? GMP_RNDU : GMP_RNDD);
+ mpfr_log (x, minpos, i ? MPFR_RNDU : MPFR_RNDD);
+ mpfr_const_log2 (t, i ? MPFR_RNDD : MPFR_RNDU);
+ mpfr_sub (x, x, t, i ? MPFR_RNDU : MPFR_RNDD);
for (precy = 16; precy <= 128; precy += 16)
{
mpfr_init2 (y, precy);
@@ -899,7 +899,7 @@ underflow_up (int extended_emin)
MPFR_FLAGS_INEXACT | MPFR_FLAGS_UNDERFLOW;
mpfr_clear_flags ();
- inex = e3 ? exp_3 (y, x, GMP_RNDN) : mpfr_exp (y, x, GMP_RNDN);
+ inex = e3 ? exp_3 (y, x, MPFR_RNDN) : mpfr_exp (y, x, MPFR_RNDN);
flags = __gmpfr_flags;
if (flags != uflags ||
(i ? (inex <= 0 || mpfr_cmp0 (y, minpos) != 0)
@@ -913,7 +913,7 @@ underflow_up (int extended_emin)
e3 ? "mpfr_exp_3" : "mpfr_exp");
if (i)
{
- mpfr_out_str (stdout, 16, 0, minpos, GMP_RNDN);
+ mpfr_out_str (stdout, 16, 0, minpos, MPFR_RNDN);
printf (" (minimum positive MPFR number),\ninex >");
}
else
@@ -921,7 +921,7 @@ underflow_up (int extended_emin)
printf ("+0, inex <");
}
printf (" 0 and flags = %u\nGot ", uflags);
- mpfr_out_str (stdout, 16, 0, y, GMP_RNDN);
+ mpfr_out_str (stdout, 16, 0, y, MPFR_RNDN);
printf ("\nwith inex = %d and flags = %u\n", inex, flags);
exit (1);
}
@@ -965,46 +965,46 @@ main (int argc, char *argv[])
compare_exp2_exp3 (20, 1000);
check_worst_cases();
- check3("0.0", GMP_RNDU, "1.0");
- check3("-1e-170", GMP_RNDU, "1.0");
- check3("-1e-170", GMP_RNDN, "1.0");
- check3("-8.88024741073346941839e-17", GMP_RNDU, "1.0");
- check3("8.70772839244701057915e-01", GMP_RNDN, "2.38875626491680437269");
- check3("1.0", GMP_RNDN, "2.71828182845904509080");
- check3("-3.42135637628104173534e-07", GMP_RNDZ, "0.999999657864420798958");
+ check3("0.0", MPFR_RNDU, "1.0");
+ check3("-1e-170", MPFR_RNDU, "1.0");
+ check3("-1e-170", MPFR_RNDN, "1.0");
+ check3("-8.88024741073346941839e-17", MPFR_RNDU, "1.0");
+ check3("8.70772839244701057915e-01", MPFR_RNDN, "2.38875626491680437269");
+ check3("1.0", MPFR_RNDN, "2.71828182845904509080");
+ check3("-3.42135637628104173534e-07", MPFR_RNDZ, "0.999999657864420798958");
/* worst case for argument reduction, very near from 5*log(2),
thanks to Jean-Michel Muller */
- check3("3.4657359027997265421", GMP_RNDN, "32.0");
- check3("3.4657359027997265421", GMP_RNDU, "32.0");
- check3("3.4657359027997265421", GMP_RNDD, "31.999999999999996447");
- check3("2.26523754332090625496e+01", GMP_RNDD, "6.8833785261699581146e9");
- check3("1.31478962104089092122e+01", GMP_RNDZ, "5.12930793917860137299e+05");
- check3("4.25637507920002378103e-01", GMP_RNDU, "1.53056585656161181497e+00");
- check3("6.26551618962329307459e-16", GMP_RNDU, "1.00000000000000066613e+00");
- check3("-3.35589513871216568383e-03",GMP_RNDD, "9.96649729583626853291e-01");
- check3("1.95151388850007272424e+01", GMP_RNDU, "2.98756340674767792225e+08");
- check3("2.45045953503350730784e+01", GMP_RNDN, "4.38743344916128387451e+10");
- check3("2.58165606081678085104e+01", GMP_RNDD, "1.62925781879432281494e+11");
- check3("-2.36539020084338638128e+01",GMP_RNDZ, "5.33630792749924762447e-11");
- check3("2.39211946135858077866e+01", GMP_RNDU, "2.44817704330214385986e+10");
- check3("-2.78190533055889162029e+01",GMP_RNDZ, "8.2858803483596879512e-13");
- check3("2.64028186174889789584e+01", GMP_RNDD, "2.9281844652878973388e11");
- check3("2.92086338843268329413e+01", GMP_RNDZ, "4.8433797301907177734e12");
- check3("-2.46355324071459982349e+01",GMP_RNDZ, "1.9995129297760994791e-11");
- check3("-2.23509444608605427618e+01",GMP_RNDZ, "1.9638492867489702307e-10");
- check3("-2.41175390197331687148e+01",GMP_RNDD, "3.3564940885530624592e-11");
- check3("2.46363885231578088053e+01", GMP_RNDU, "5.0055014282693267822e10");
- check3("111.1263531080090984914932050742208957672119140625", GMP_RNDN, "1.8262572323517295459e48");
- check3("-3.56196340354684821250e+02",GMP_RNDN, "2.0225297096141478156e-155");
- check3("6.59678273772710895173e+02", GMP_RNDU, "3.1234469273830195529e286");
- check3("5.13772529701934331570e+02", GMP_RNDD, "1.3445427121297197752e223");
- check3("3.57430211008718345056e+02", GMP_RNDD, "1.6981197246857298443e155");
- check3("3.82001814471465536371e+02", GMP_RNDU, "7.9667300591087367805e165");
- check3("5.92396038219384422518e+02", GMP_RNDD, "1.880747529554661989e257");
- check3("-5.02678550462488090034e+02",GMP_RNDU, "4.8919201895446217839e-219");
- check3("5.30015757134837031117e+02", GMP_RNDD, "1.5237672861171573939e230");
- check3("5.16239362447650933063e+02", GMP_RNDZ, "1.5845518406744492105e224");
- check3("6.00812634798592370977e-01", GMP_RNDN, "1.823600119339019443");
+ check3("3.4657359027997265421", MPFR_RNDN, "32.0");
+ check3("3.4657359027997265421", MPFR_RNDU, "32.0");
+ check3("3.4657359027997265421", MPFR_RNDD, "31.999999999999996447");
+ check3("2.26523754332090625496e+01", MPFR_RNDD, "6.8833785261699581146e9");
+ check3("1.31478962104089092122e+01", MPFR_RNDZ, "5.12930793917860137299e+05");
+ check3("4.25637507920002378103e-01", MPFR_RNDU, "1.53056585656161181497e+00");
+ check3("6.26551618962329307459e-16", MPFR_RNDU, "1.00000000000000066613e+00");
+ check3("-3.35589513871216568383e-03",MPFR_RNDD, "9.96649729583626853291e-01");
+ check3("1.95151388850007272424e+01", MPFR_RNDU, "2.98756340674767792225e+08");
+ check3("2.45045953503350730784e+01", MPFR_RNDN, "4.38743344916128387451e+10");
+ check3("2.58165606081678085104e+01", MPFR_RNDD, "1.62925781879432281494e+11");
+ check3("-2.36539020084338638128e+01",MPFR_RNDZ, "5.33630792749924762447e-11");
+ check3("2.39211946135858077866e+01", MPFR_RNDU, "2.44817704330214385986e+10");
+ check3("-2.78190533055889162029e+01",MPFR_RNDZ, "8.2858803483596879512e-13");
+ check3("2.64028186174889789584e+01", MPFR_RNDD, "2.9281844652878973388e11");
+ check3("2.92086338843268329413e+01", MPFR_RNDZ, "4.8433797301907177734e12");
+ check3("-2.46355324071459982349e+01",MPFR_RNDZ, "1.9995129297760994791e-11");
+ check3("-2.23509444608605427618e+01",MPFR_RNDZ, "1.9638492867489702307e-10");
+ check3("-2.41175390197331687148e+01",MPFR_RNDD, "3.3564940885530624592e-11");
+ check3("2.46363885231578088053e+01", MPFR_RNDU, "5.0055014282693267822e10");
+ check3("111.1263531080090984914932050742208957672119140625", MPFR_RNDN, "1.8262572323517295459e48");
+ check3("-3.56196340354684821250e+02",MPFR_RNDN, "2.0225297096141478156e-155");
+ check3("6.59678273772710895173e+02", MPFR_RNDU, "3.1234469273830195529e286");
+ check3("5.13772529701934331570e+02", MPFR_RNDD, "1.3445427121297197752e223");
+ check3("3.57430211008718345056e+02", MPFR_RNDD, "1.6981197246857298443e155");
+ check3("3.82001814471465536371e+02", MPFR_RNDU, "7.9667300591087367805e165");
+ check3("5.92396038219384422518e+02", MPFR_RNDD, "1.880747529554661989e257");
+ check3("-5.02678550462488090034e+02",MPFR_RNDU, "4.8919201895446217839e-219");
+ check3("5.30015757134837031117e+02", MPFR_RNDD, "1.5237672861171573939e230");
+ check3("5.16239362447650933063e+02", MPFR_RNDZ, "1.5845518406744492105e224");
+ check3("6.00812634798592370977e-01", MPFR_RNDN, "1.823600119339019443");
check_exp10 ();
bug20080731 ();
diff --git a/tests/texp10.c b/tests/texp10.c
index baed970d9..27d6b6fa9 100644
--- a/tests/texp10.c
+++ b/tests/texp10.c
@@ -48,7 +48,7 @@ special_overflow (void)
mpfr_init2 (y, 24);
mpfr_set_str_binary (x, "0.101100100000000000110100E15");
- inex = mpfr_exp10 (y, x, GMP_RNDN);
+ inex = mpfr_exp10 (y, x, MPFR_RNDN);
if (!mpfr_inf_p (y) || inex <= 0)
{
printf ("Overflow error.\n");
@@ -73,14 +73,14 @@ emax_m_eps (void)
mpfr_init2 (x, sizeof(mp_exp_t) * CHAR_BIT * 4);
mpfr_init2 (y, 8);
- mpfr_set_si (x, mpfr_get_emax (), GMP_RNDN);
+ mpfr_set_si (x, mpfr_get_emax (), MPFR_RNDN);
mpfr_clear_flags ();
- inex = mpfr_exp10 (y, x, GMP_RNDN);
+ inex = mpfr_exp10 (y, x, MPFR_RNDN);
ov = mpfr_overflow_p ();
if (!ov || !mpfr_inf_p (y) || inex <= 0)
{
- printf ("Overflow error for x = emax, GMP_RNDN.\n");
+ printf ("Overflow error for x = emax, MPFR_RNDN.\n");
mpfr_dump (y);
printf ("inex = %d, %soverflow\n", inex, ov ? "" : "no ");
exit (1);
@@ -100,14 +100,14 @@ exp_range (void)
emin = mpfr_get_emin ();
set_emin (3);
mpfr_init2 (x, 16);
- mpfr_set_ui (x, 4, GMP_RNDN);
- mpfr_exp10 (x, x, GMP_RNDN);
+ mpfr_set_ui (x, 4, MPFR_RNDN);
+ mpfr_exp10 (x, x, MPFR_RNDN);
set_emin (emin);
if (mpfr_nan_p (x) || mpfr_cmp_ui (x, 10000) != 0)
{
printf ("Error in mpfr_exp10 for x = 4, with emin = 3\n");
printf ("Expected 10000, got ");
- mpfr_out_str (stdout, 2, 0, x, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN);
printf ("\n");
exit (1);
}
@@ -128,17 +128,17 @@ overfl_exp10_0 (void)
for (emax = -1; emax <= 0; emax++)
{
- mpfr_set_ui_2exp (y, 1, emax, GMP_RNDN);
+ mpfr_set_ui_2exp (y, 1, emax, MPFR_RNDN);
mpfr_nextbelow (y);
set_emax (emax); /* 1 is not representable. */
/* and if emax < 0, 1 - eps is not representable either. */
for (i = -1; i <= 1; i++)
RND_LOOP (rnd)
{
- mpfr_set_si_2exp (x, i, -512 * ABS (i), GMP_RNDN);
+ mpfr_set_si_2exp (x, i, -512 * ABS (i), MPFR_RNDN);
mpfr_clear_flags ();
inex = mpfr_exp10 (x, x, (mp_rnd_t) rnd);
- if ((i >= 0 || emax < 0 || rnd == GMP_RNDN || rnd == GMP_RNDU) &&
+ if ((i >= 0 || emax < 0 || rnd == MPFR_RNDN || rnd == MPFR_RNDU) &&
! mpfr_overflow_p ())
{
printf ("Error in overfl_exp10_0 (i = %d, rnd = %s):\n"
@@ -146,7 +146,7 @@ overfl_exp10_0 (void)
i, mpfr_print_rnd_mode ((mp_rnd_t) rnd));
err = 1;
}
- if (rnd == GMP_RNDZ || rnd == GMP_RNDD)
+ if (rnd == MPFR_RNDZ || rnd == MPFR_RNDD)
{
if (inex >= 0)
{
@@ -208,23 +208,23 @@ main (int argc, char *argv[])
mpfr_init (x);
mpfr_init (y);
- mpfr_set_ui (x, 4, GMP_RNDN);
- mpfr_exp10 (y, x, GMP_RNDN);
+ mpfr_set_ui (x, 4, MPFR_RNDN);
+ mpfr_exp10 (y, x, MPFR_RNDN);
if (mpfr_cmp_ui (y, 10000) != 0)
{
- printf ("Error for 10^4, GMP_RNDN\n");
+ printf ("Error for 10^4, MPFR_RNDN\n");
exit (1);
}
- mpfr_exp10 (y, x, GMP_RNDD);
+ mpfr_exp10 (y, x, MPFR_RNDD);
if (mpfr_cmp_ui (y, 10000) != 0)
{
- printf ("Error for 10^4, GMP_RNDD\n");
+ printf ("Error for 10^4, MPFR_RNDD\n");
exit (1);
}
- mpfr_exp10 (y, x, GMP_RNDU);
+ mpfr_exp10 (y, x, MPFR_RNDU);
if (mpfr_cmp_ui (y, 10000) != 0)
{
- printf ("Error for 10^4, GMP_RNDU\n");
+ printf ("Error for 10^4, MPFR_RNDU\n");
exit (1);
}
@@ -233,8 +233,8 @@ main (int argc, char *argv[])
/* save emin */
emin = mpfr_get_emin ();
set_emin (-11);
- mpfr_set_si (x, -4, GMP_RNDN);
- mpfr_exp10 (y, x, GMP_RNDN);
+ mpfr_set_si (x, -4, MPFR_RNDN);
+ mpfr_exp10 (y, x, MPFR_RNDN);
if (mpfr_cmp_ui (y, 0) || mpfr_sgn (y) < 0)
{
printf ("Error for emin = -11, x = -4, RNDN\n");
@@ -248,8 +248,8 @@ main (int argc, char *argv[])
/* save emax */
emax = mpfr_get_emax ();
set_emax (13);
- mpfr_set_ui (x, 4, GMP_RNDN);
- mpfr_exp10 (y, x, GMP_RNDN);
+ mpfr_set_ui (x, 4, MPFR_RNDN);
+ mpfr_exp10 (y, x, MPFR_RNDN);
if (!mpfr_inf_p (y) || mpfr_sgn (y) < 0)
{
printf ("Error for emax = 13, x = 4, RNDN\n");
@@ -262,7 +262,7 @@ main (int argc, char *argv[])
MPFR_SET_INF (x);
MPFR_SET_POS (x);
- mpfr_exp10 (y, x, GMP_RNDN);
+ mpfr_exp10 (y, x, MPFR_RNDN);
if (!MPFR_IS_INF (y))
{
printf ("evaluation of function in INF does not return INF\n");
@@ -270,7 +270,7 @@ main (int argc, char *argv[])
}
MPFR_CHANGE_SIGN (x);
- mpfr_exp10 (y, x, GMP_RNDN);
+ mpfr_exp10 (y, x, MPFR_RNDN);
if (!MPFR_IS_ZERO (y))
{
printf ("evaluation of function in -INF does not return 0\n");
@@ -278,7 +278,7 @@ main (int argc, char *argv[])
}
MPFR_SET_NAN (x);
- mpfr_exp10 (y, x, GMP_RNDN);
+ mpfr_exp10 (y, x, MPFR_RNDN);
if (!MPFR_IS_NAN (y))
{
printf ("evaluation of function in NaN does not return NaN\n");
@@ -291,13 +291,13 @@ main (int argc, char *argv[])
/* emax <= 10000000000 */
mpfr_set_prec (x, 40);
mpfr_set_prec (y, 40);
- mpfr_set_str (x, "3010299957", 10, GMP_RNDN);
+ mpfr_set_str (x, "3010299957", 10, MPFR_RNDN);
mpfr_clear_flags ();
- inex = mpfr_exp10 (y, x, GMP_RNDN);
+ inex = mpfr_exp10 (y, x, MPFR_RNDN);
ov = mpfr_overflow_p ();
if (!(MPFR_IS_INF (y) && MPFR_IS_POS (y) && ov))
{
- printf ("Overflow error for x = 3010299957, GMP_RNDN.\n");
+ printf ("Overflow error for x = 3010299957, MPFR_RNDN.\n");
mpfr_dump (y);
printf ("inex = %d, %soverflow\n", inex, ov ? "" : "no ");
exit (1);
diff --git a/tests/texp2.c b/tests/texp2.c
index 0f06863b5..ca4078860 100644
--- a/tests/texp2.c
+++ b/tests/texp2.c
@@ -48,7 +48,7 @@ special_overflow (void)
mpfr_init2 (y, 24);
mpfr_set_str_binary (x, "0.101100100000000000110100E15");
- inex = mpfr_exp2 (y, x, GMP_RNDN);
+ inex = mpfr_exp2 (y, x, MPFR_RNDN);
if (!mpfr_inf_p (y) || inex <= 0)
{
printf ("Overflow error.\n");
@@ -73,14 +73,14 @@ emax_m_eps (void)
mpfr_init2 (x, sizeof(mp_exp_t) * CHAR_BIT * 4);
mpfr_init2 (y, 8);
- mpfr_set_si (x, mpfr_get_emax (), GMP_RNDN);
+ mpfr_set_si (x, mpfr_get_emax (), MPFR_RNDN);
mpfr_clear_flags ();
- inex = mpfr_exp2 (y, x, GMP_RNDN);
+ inex = mpfr_exp2 (y, x, MPFR_RNDN);
ov = mpfr_overflow_p ();
if (!ov || !mpfr_inf_p (y) || inex <= 0)
{
- printf ("Overflow error for x = emax, GMP_RNDN.\n");
+ printf ("Overflow error for x = emax, MPFR_RNDN.\n");
mpfr_dump (y);
printf ("inex = %d, %soverflow\n", inex, ov ? "" : "no ");
exit (1);
@@ -89,23 +89,23 @@ emax_m_eps (void)
mpfr_nextbelow (x);
mpfr_clear_flags ();
- inex = mpfr_exp2 (y, x, GMP_RNDN);
+ inex = mpfr_exp2 (y, x, MPFR_RNDN);
ov = mpfr_overflow_p ();
if (!ov || !mpfr_inf_p (y) || inex <= 0)
{
- printf ("Overflow error for x = emax - eps, GMP_RNDN.\n");
+ printf ("Overflow error for x = emax - eps, MPFR_RNDN.\n");
mpfr_dump (y);
printf ("inex = %d, %soverflow\n", inex, ov ? "" : "no ");
exit (1);
}
mpfr_clear_flags ();
- inex = mpfr_exp2 (y, x, GMP_RNDD);
+ inex = mpfr_exp2 (y, x, MPFR_RNDD);
ov = mpfr_overflow_p ();
if (ov || mpfr_inf_p (y) || inex >= 0 ||
(mpfr_nextabove (y), !mpfr_inf_p (y)))
{
- printf ("Overflow error for x = emax - eps, GMP_RNDD.\n");
+ printf ("Overflow error for x = emax - eps, MPFR_RNDD.\n");
mpfr_dump (y);
printf ("inex = %d, %soverflow\n", inex, ov ? "" : "no ");
exit (1);
@@ -125,14 +125,14 @@ exp_range (void)
emin = mpfr_get_emin ();
set_emin (3);
mpfr_init2 (x, 8);
- mpfr_set_ui (x, 5, GMP_RNDN);
- mpfr_exp2 (x, x, GMP_RNDN);
+ mpfr_set_ui (x, 5, MPFR_RNDN);
+ mpfr_exp2 (x, x, MPFR_RNDN);
set_emin (emin);
if (mpfr_nan_p (x) || mpfr_cmp_ui (x, 32) != 0)
{
printf ("Error in mpfr_exp2 for x = 5, with emin = 3\n");
printf ("Expected 32, got ");
- mpfr_out_str (stdout, 2, 0, x, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN);
printf ("\n");
exit (1);
}
@@ -153,17 +153,17 @@ overflowed_exp2_0 (void)
for (emax = -1; emax <= 0; emax++)
{
- mpfr_set_ui_2exp (y, 1, emax, GMP_RNDN);
+ mpfr_set_ui_2exp (y, 1, emax, MPFR_RNDN);
mpfr_nextbelow (y);
set_emax (emax); /* 1 is not representable. */
/* and if emax < 0, 1 - eps is not representable either. */
for (i = -1; i <= 1; i++)
RND_LOOP (rnd)
{
- mpfr_set_si_2exp (x, i, -512 * ABS (i), GMP_RNDN);
+ mpfr_set_si_2exp (x, i, -512 * ABS (i), MPFR_RNDN);
mpfr_clear_flags ();
inex = mpfr_exp2 (x, x, (mp_rnd_t) rnd);
- if ((i >= 0 || emax < 0 || rnd == GMP_RNDN || rnd == GMP_RNDU) &&
+ if ((i >= 0 || emax < 0 || rnd == MPFR_RNDN || rnd == MPFR_RNDU) &&
! mpfr_overflow_p ())
{
printf ("Error in overflowed_exp2_0 (i = %d, rnd = %s):\n"
@@ -171,7 +171,7 @@ overflowed_exp2_0 (void)
i, mpfr_print_rnd_mode ((mp_rnd_t) rnd));
err = 1;
}
- if (rnd == GMP_RNDZ || rnd == GMP_RNDD)
+ if (rnd == MPFR_RNDZ || rnd == MPFR_RNDD)
{
if (inex >= 0)
{
@@ -232,51 +232,51 @@ main (int argc, char *argv[])
mpfr_init (x);
mpfr_init (y);
- mpfr_set_ui (x, 4, GMP_RNDN);
- mpfr_exp2 (y, x, GMP_RNDN);
+ mpfr_set_ui (x, 4, MPFR_RNDN);
+ mpfr_exp2 (y, x, MPFR_RNDN);
if (mpfr_cmp_ui (y, 16) != 0)
{
- printf ("Error for 2^4, GMP_RNDN\n");
+ printf ("Error for 2^4, MPFR_RNDN\n");
exit (1);
}
- mpfr_exp2 (y, x, GMP_RNDD);
+ mpfr_exp2 (y, x, MPFR_RNDD);
if (mpfr_cmp_ui (y, 16) != 0)
{
- printf ("Error for 2^4, GMP_RNDD\n");
+ printf ("Error for 2^4, MPFR_RNDD\n");
exit (1);
}
- mpfr_exp2 (y, x, GMP_RNDU);
+ mpfr_exp2 (y, x, MPFR_RNDU);
if (mpfr_cmp_ui (y, 16) != 0)
{
- printf ("Error for 2^4, GMP_RNDU\n");
+ printf ("Error for 2^4, MPFR_RNDU\n");
exit (1);
}
- mpfr_set_si (x, -4, GMP_RNDN);
- mpfr_exp2 (y, x, GMP_RNDN);
+ mpfr_set_si (x, -4, MPFR_RNDN);
+ mpfr_exp2 (y, x, MPFR_RNDN);
if (mpfr_cmp_ui_2exp (y, 1, -4) != 0)
{
- printf ("Error for 2^(-4), GMP_RNDN\n");
+ printf ("Error for 2^(-4), MPFR_RNDN\n");
exit (1);
}
- mpfr_exp2 (y, x, GMP_RNDD);
+ mpfr_exp2 (y, x, MPFR_RNDD);
if (mpfr_cmp_ui_2exp (y, 1, -4) != 0)
{
- printf ("Error for 2^(-4), GMP_RNDD\n");
+ printf ("Error for 2^(-4), MPFR_RNDD\n");
exit (1);
}
- mpfr_exp2 (y, x, GMP_RNDU);
+ mpfr_exp2 (y, x, MPFR_RNDU);
if (mpfr_cmp_ui_2exp (y, 1, -4) != 0)
{
- printf ("Error for 2^(-4), GMP_RNDU\n");
+ printf ("Error for 2^(-4), MPFR_RNDU\n");
exit (1);
}
mpfr_set_prec (x, 53);
mpfr_set_prec (y, 53);
mpfr_set_str (x, /*-1683977482443233.0 / 2199023255552.0*/
- "-7.6578429909351734750089235603809357e2", 10, GMP_RNDN);
- mpfr_exp2 (y, x, GMP_RNDN);
+ "-7.6578429909351734750089235603809357e2", 10, MPFR_RNDN);
+ mpfr_exp2 (y, x, MPFR_RNDN);
if (mpfr_cmp_str1 (y, "2.991959870867646566478e-231"))
{
printf ("Error for x=-1683977482443233/2^41\n");
@@ -288,8 +288,8 @@ main (int argc, char *argv[])
/* save emin */
emin = mpfr_get_emin ();
set_emin (-10);
- mpfr_set_si (x, -12, GMP_RNDN);
- mpfr_exp2 (y, x, GMP_RNDN);
+ mpfr_set_si (x, -12, MPFR_RNDN);
+ mpfr_exp2 (y, x, MPFR_RNDN);
if (mpfr_cmp_ui (y, 0) || mpfr_sgn (y) < 0)
{
printf ("Error for x=emin-2, RNDN\n");
@@ -303,8 +303,8 @@ main (int argc, char *argv[])
/* save emax */
emax = mpfr_get_emax ();
set_emax (10);
- mpfr_set_ui (x, 11, GMP_RNDN);
- mpfr_exp2 (y, x, GMP_RNDN);
+ mpfr_set_ui (x, 11, MPFR_RNDN);
+ mpfr_exp2 (y, x, MPFR_RNDN);
if (!mpfr_inf_p (y) || mpfr_sgn (y) < 0)
{
printf ("Error for x=emax+1, RNDN\n");
@@ -315,7 +315,7 @@ main (int argc, char *argv[])
MPFR_SET_INF(x);
MPFR_SET_POS(x);
- mpfr_exp2 (y, x, GMP_RNDN);
+ mpfr_exp2 (y, x, MPFR_RNDN);
if(!MPFR_IS_INF(y))
{
printf ("evaluation of function in INF does not return INF\n");
@@ -323,7 +323,7 @@ main (int argc, char *argv[])
}
MPFR_CHANGE_SIGN(x);
- mpfr_exp2 (y, x, GMP_RNDN);
+ mpfr_exp2 (y, x, MPFR_RNDN);
if(!MPFR_IS_ZERO(y))
{
printf ("evaluation of function in -INF does not return 0\n");
@@ -331,7 +331,7 @@ main (int argc, char *argv[])
}
MPFR_SET_NAN(x);
- mpfr_exp2 (y, x, GMP_RNDN);
+ mpfr_exp2 (y, x, MPFR_RNDN);
if(!MPFR_IS_NAN(y))
{
printf ("evaluation of function in NaN does not return NaN\n");
@@ -344,9 +344,9 @@ main (int argc, char *argv[])
/* emax <= 10000000000 */
mpfr_set_prec (x, 40);
mpfr_set_prec (y, 40);
- mpfr_set_str (x, "10000000000.5", 10, GMP_RNDN);
+ mpfr_set_str (x, "10000000000.5", 10, MPFR_RNDN);
mpfr_clear_flags ();
- mpfr_exp2 (y, x, GMP_RNDN);
+ mpfr_exp2 (y, x, MPFR_RNDN);
if (!(MPFR_IS_INF (y) && MPFR_IS_POS (y) && mpfr_overflow_p ()))
{
printf ("exp2(10000000000.5) should overflow.\n");
@@ -357,7 +357,7 @@ main (int argc, char *argv[])
mpfr_set_prec (x, 2);
mpfr_set_prec (y, 2);
mpfr_set_str_binary (x, "-1.0E-26");
- mpfr_exp2 (y, x, GMP_RNDD);
+ mpfr_exp2 (y, x, MPFR_RNDD);
mpfr_set_str_binary (x, "1.1E-1");
if (mpfr_cmp (x, y))
{
diff --git a/tests/texpm1.c b/tests/texpm1.c
index 862bb6301..21b81bfc5 100644
--- a/tests/texpm1.c
+++ b/tests/texpm1.c
@@ -30,7 +30,7 @@ static int
test_expm1 (mpfr_ptr a, mpfr_srcptr b, mp_rnd_t rnd_mode)
{
int res;
- int ok = rnd_mode == GMP_RNDN && mpfr_number_p (b) && mpfr_get_prec (a)>=53;
+ int ok = rnd_mode == MPFR_RNDN && mpfr_number_p (b) && mpfr_get_prec (a)>=53;
if (ok)
{
mpfr_print_raw (b);
@@ -63,7 +63,7 @@ special (void)
mpfr_init (y);
mpfr_set_nan (x);
- test_expm1 (y, x, GMP_RNDN);
+ test_expm1 (y, x, MPFR_RNDN);
if (!mpfr_nan_p (y))
{
printf ("Error for expm1(NaN)\n");
@@ -71,7 +71,7 @@ special (void)
}
mpfr_set_inf (x, 1);
- test_expm1 (y, x, GMP_RNDN);
+ test_expm1 (y, x, MPFR_RNDN);
if (!mpfr_inf_p (y) || mpfr_sgn (y) < 0)
{
printf ("Error for expm1(+Inf)\n");
@@ -79,23 +79,23 @@ special (void)
}
mpfr_set_inf (x, -1);
- test_expm1 (y, x, GMP_RNDN);
+ test_expm1 (y, x, MPFR_RNDN);
if (mpfr_cmp_si (y, -1))
{
printf ("Error for expm1(-Inf)\n");
exit (1);
}
- mpfr_set_ui (x, 0, GMP_RNDN);
- test_expm1 (y, x, GMP_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ test_expm1 (y, x, MPFR_RNDN);
if (mpfr_cmp_ui (y, 0) || mpfr_sgn (y) < 0)
{
printf ("Error for expm1(+0)\n");
exit (1);
}
- mpfr_neg (x, x, GMP_RNDN);
- test_expm1 (y, x, GMP_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN);
+ test_expm1 (y, x, MPFR_RNDN);
if (mpfr_cmp_ui (y, 0) || mpfr_sgn (y) > 0)
{
printf ("Error for expm1(-0)\n");
@@ -105,21 +105,21 @@ special (void)
/* Check overflow of expm1(x) */
mpfr_clear_flags ();
mpfr_set_str_binary (x, "1.1E1000000000");
- i = test_expm1 (x, x, GMP_RNDN);
+ i = test_expm1 (x, x, MPFR_RNDN);
MPFR_ASSERTN (MPFR_IS_INF (x) && MPFR_SIGN (x) > 0);
MPFR_ASSERTN (mpfr_overflow_p ());
MPFR_ASSERTN (i == 1);
mpfr_clear_flags ();
mpfr_set_str_binary (x, "1.1E1000000000");
- i = test_expm1 (x, x, GMP_RNDU);
+ i = test_expm1 (x, x, MPFR_RNDU);
MPFR_ASSERTN (MPFR_IS_INF (x) && MPFR_SIGN (x) > 0);
MPFR_ASSERTN (mpfr_overflow_p ());
MPFR_ASSERTN (i == 1);
mpfr_clear_flags ();
mpfr_set_str_binary (x, "1.1E1000000000");
- i = test_expm1 (x, x, GMP_RNDD);
+ i = test_expm1 (x, x, MPFR_RNDD);
MPFR_ASSERTN (!MPFR_IS_INF (x) && MPFR_SIGN (x) > 0);
MPFR_ASSERTN (mpfr_overflow_p ());
MPFR_ASSERTN (i == -1);
@@ -128,26 +128,26 @@ special (void)
mpfr_set_prec (x, 2);
mpfr_clear_flags ();
mpfr_set_str_binary (x, "-1.1E1000000000");
- i = test_expm1 (x, x, GMP_RNDN);
+ i = test_expm1 (x, x, MPFR_RNDN);
MPFR_ASSERTN (mpfr_cmp_si (x, -1) == 0);
MPFR_ASSERTN (!mpfr_overflow_p () && !mpfr_underflow_p ());
MPFR_ASSERTN (i == -1);
mpfr_set_str_binary (x, "-1.1E1000000000");
- i = test_expm1 (x, x, GMP_RNDD);
+ i = test_expm1 (x, x, MPFR_RNDD);
MPFR_ASSERTN (mpfr_cmp_si (x, -1) == 0);
MPFR_ASSERTN (!mpfr_overflow_p () && !mpfr_underflow_p ());
MPFR_ASSERTN (i == -1);
mpfr_set_str_binary (x, "-1.1E1000000000");
- i = test_expm1 (x, x, GMP_RNDZ);
- MPFR_ASSERTN (mpfr_cmp_str (x, "-0.11", 2, GMP_RNDN) == 0);
+ i = test_expm1 (x, x, MPFR_RNDZ);
+ MPFR_ASSERTN (mpfr_cmp_str (x, "-0.11", 2, MPFR_RNDN) == 0);
MPFR_ASSERTN (!mpfr_overflow_p () && !mpfr_underflow_p ());
MPFR_ASSERTN (i == 1);
mpfr_set_str_binary (x, "-1.1E1000000000");
- i = test_expm1 (x, x, GMP_RNDU);
- MPFR_ASSERTN (mpfr_cmp_str (x, "-0.11", 2, GMP_RNDN) == 0);
+ i = test_expm1 (x, x, MPFR_RNDU);
+ MPFR_ASSERTN (mpfr_cmp_str (x, "-0.11", 2, MPFR_RNDN) == 0);
MPFR_ASSERTN (!mpfr_overflow_p () && !mpfr_underflow_p ());
MPFR_ASSERTN (i == 1);
diff --git a/tests/tfactorial.c b/tests/tfactorial.c
index 479f59454..a3633d01e 100644
--- a/tests/tfactorial.c
+++ b/tests/tfactorial.c
@@ -38,7 +38,7 @@ special (void)
mpfr_set_prec (x, 21);
mpfr_set_prec (y, 21);
- mpfr_fac_ui (x, 119, GMP_RNDZ);
+ mpfr_fac_ui (x, 119, MPFR_RNDZ);
mpfr_set_str_binary (y, "0.101111101110100110110E654");
if (mpfr_cmp (x, y))
{
@@ -47,7 +47,7 @@ special (void)
}
mpfr_set_prec (y, 206);
- inex = mpfr_fac_ui (y, 767, GMP_RNDN);
+ inex = mpfr_fac_ui (y, 767, MPFR_RNDN);
mpfr_set_prec (x, 206);
mpfr_set_str_binary (x, "0.110111100001000001101010010001000111000100000100111000010011100011011111001100011110101000111101101100110001001100110100001001111110000101010000100100011100010011101110000001000010001100010000101001111E6250");
if (mpfr_cmp (x, y))
@@ -62,7 +62,7 @@ special (void)
}
mpfr_set_prec (y, 202);
- mpfr_fac_ui (y, 69, GMP_RNDU);
+ mpfr_fac_ui (y, 69, MPFR_RNDU);
mpfr_clear (x);
mpfr_clear (y);
@@ -91,7 +91,7 @@ test_int (void)
{
mpfr_set_prec (x, p);
mpfr_set_prec (y, p);
- for (r = 0; r < GMP_RND_MAX; r++)
+ for (r = 0; r < MPFR_RND_MAX; r++)
{
inex1 = mpfr_fac_ui (x, n, (mp_rnd_t) r);
inex2 = mpfr_set_z (y, f, (mp_rnd_t) r);
@@ -129,7 +129,7 @@ overflowed_fac0 (void)
mpfr_init2 (x, 8);
mpfr_init2 (y, 8);
- mpfr_set_ui (y, 1, GMP_RNDN);
+ mpfr_set_ui (y, 1, MPFR_RNDN);
mpfr_nextbelow (y);
set_emax (0); /* 1 is not representable. */
RND_LOOP (rnd)
@@ -143,7 +143,7 @@ overflowed_fac0 (void)
mpfr_print_rnd_mode ((mp_rnd_t) rnd));
err = 1;
}
- if (rnd == GMP_RNDZ || rnd == GMP_RNDD)
+ if (rnd == MPFR_RNDZ || rnd == MPFR_RNDD)
{
if (inex >= 0)
{
@@ -207,7 +207,7 @@ main (int argc, char *argv[])
mpfr_init (z);
mpfr_init (t);
- mpfr_fac_ui (y, 0, GMP_RNDN);
+ mpfr_fac_ui (y, 0, MPFR_RNDN);
if (mpfr_cmp_ui (y, 1))
{
@@ -224,10 +224,10 @@ main (int argc, char *argv[])
mpfr_set_prec (y, yprec);
for (n = 0; n < 50; n++)
- for (rnd = 0; rnd < GMP_RND_MAX; rnd++)
+ for (rnd = 0; rnd < MPFR_RND_MAX; rnd++)
{
inexact = mpfr_fac_ui (y, n, (mp_rnd_t) rnd);
- err = (rnd == GMP_RNDN) ? yprec + 1 : yprec;
+ err = (rnd == MPFR_RNDN) ? yprec + 1 : yprec;
if (mpfr_can_round (y, err, (mp_rnd_t) rnd, (mp_rnd_t) rnd, prec))
{
mpfr_set (t, y, (mp_rnd_t) rnd);
@@ -257,14 +257,14 @@ main (int argc, char *argv[])
if (mpfr_cmp (t, z))
{
printf ("results differ for x=");
- mpfr_out_str (stdout, 2, prec, x, GMP_RNDN);
+ mpfr_out_str (stdout, 2, prec, x, MPFR_RNDN);
printf (" prec=%u rnd_mode=%s\n", prec,
mpfr_print_rnd_mode ((mp_rnd_t) rnd));
printf (" got ");
- mpfr_out_str (stdout, 2, prec, z, GMP_RNDN);
+ mpfr_out_str (stdout, 2, prec, z, MPFR_RNDN);
puts ("");
printf (" expected ");
- mpfr_out_str (stdout, 2, prec, t, GMP_RNDN);
+ mpfr_out_str (stdout, 2, prec, t, MPFR_RNDN);
puts ("");
printf (" approximation was ");
mpfr_print_binary (y);
diff --git a/tests/tfits.c b/tests/tfits.c
index f7a983524..efa9955a3 100644
--- a/tests/tfits.c
+++ b/tests/tfits.c
@@ -63,136 +63,136 @@ main (void)
/* Check NAN */
mpfr_set_nan(x);
- if (mpfr_fits_ulong_p(x, GMP_RNDN))
+ if (mpfr_fits_ulong_p(x, MPFR_RNDN))
ERROR1;
- if (mpfr_fits_slong_p(x, GMP_RNDN))
+ if (mpfr_fits_slong_p(x, MPFR_RNDN))
ERROR1;
- if (mpfr_fits_uint_p(x, GMP_RNDN))
+ if (mpfr_fits_uint_p(x, MPFR_RNDN))
ERROR1;
- if (mpfr_fits_sint_p(x, GMP_RNDN))
+ if (mpfr_fits_sint_p(x, MPFR_RNDN))
ERROR1;
- if (mpfr_fits_ushort_p(x, GMP_RNDN))
+ if (mpfr_fits_ushort_p(x, MPFR_RNDN))
ERROR1;
- if (mpfr_fits_sshort_p(x, GMP_RNDN))
+ if (mpfr_fits_sshort_p(x, MPFR_RNDN))
ERROR1;
/* Check INF */
mpfr_set_inf(x, 1);
- if (mpfr_fits_ulong_p(x, GMP_RNDN))
+ if (mpfr_fits_ulong_p(x, MPFR_RNDN))
ERROR1;
- if (mpfr_fits_slong_p(x, GMP_RNDN))
+ if (mpfr_fits_slong_p(x, MPFR_RNDN))
ERROR1;
- if (mpfr_fits_uint_p(x, GMP_RNDN))
+ if (mpfr_fits_uint_p(x, MPFR_RNDN))
ERROR1;
- if (mpfr_fits_sint_p(x, GMP_RNDN))
+ if (mpfr_fits_sint_p(x, MPFR_RNDN))
ERROR1;
- if (mpfr_fits_ushort_p(x, GMP_RNDN))
+ if (mpfr_fits_ushort_p(x, MPFR_RNDN))
ERROR1;
- if (mpfr_fits_sshort_p(x, GMP_RNDN))
+ if (mpfr_fits_sshort_p(x, MPFR_RNDN))
ERROR1;
/* Check Zero */
MPFR_SET_ZERO(x);
- if (!mpfr_fits_ulong_p(x, GMP_RNDN))
+ if (!mpfr_fits_ulong_p(x, MPFR_RNDN))
ERROR2;
- if (!mpfr_fits_slong_p(x, GMP_RNDN))
+ if (!mpfr_fits_slong_p(x, MPFR_RNDN))
ERROR2;
- if (!mpfr_fits_uint_p(x, GMP_RNDN))
+ if (!mpfr_fits_uint_p(x, MPFR_RNDN))
ERROR2;
- if (!mpfr_fits_sint_p(x, GMP_RNDN))
+ if (!mpfr_fits_sint_p(x, MPFR_RNDN))
ERROR2;
- if (!mpfr_fits_ushort_p(x, GMP_RNDN))
+ if (!mpfr_fits_ushort_p(x, MPFR_RNDN))
ERROR2;
- if (!mpfr_fits_sshort_p(x, GMP_RNDN))
+ if (!mpfr_fits_sshort_p(x, MPFR_RNDN))
ERROR2;
/* Check small op */
mpfr_set_str1 (x, "1@-1");
- if (!mpfr_fits_ulong_p(x, GMP_RNDN))
+ if (!mpfr_fits_ulong_p(x, MPFR_RNDN))
ERROR2;
- if (!mpfr_fits_slong_p(x, GMP_RNDN))
+ if (!mpfr_fits_slong_p(x, MPFR_RNDN))
ERROR2;
- if (!mpfr_fits_uint_p(x, GMP_RNDN))
+ if (!mpfr_fits_uint_p(x, MPFR_RNDN))
ERROR2;
- if (!mpfr_fits_sint_p(x, GMP_RNDN))
+ if (!mpfr_fits_sint_p(x, MPFR_RNDN))
ERROR2;
- if (!mpfr_fits_ushort_p(x, GMP_RNDN))
+ if (!mpfr_fits_ushort_p(x, MPFR_RNDN))
ERROR2;
- if (!mpfr_fits_sshort_p(x, GMP_RNDN))
+ if (!mpfr_fits_sshort_p(x, MPFR_RNDN))
ERROR2;
/* Check 17 */
- mpfr_set_ui (x, 17, GMP_RNDN);
- if (!mpfr_fits_ulong_p(x, GMP_RNDN))
+ mpfr_set_ui (x, 17, MPFR_RNDN);
+ if (!mpfr_fits_ulong_p(x, MPFR_RNDN))
ERROR2;
- if (!mpfr_fits_slong_p(x, GMP_RNDN))
+ if (!mpfr_fits_slong_p(x, MPFR_RNDN))
ERROR2;
- if (!mpfr_fits_uint_p(x, GMP_RNDN))
+ if (!mpfr_fits_uint_p(x, MPFR_RNDN))
ERROR2;
- if (!mpfr_fits_sint_p(x, GMP_RNDN))
+ if (!mpfr_fits_sint_p(x, MPFR_RNDN))
ERROR2;
- if (!mpfr_fits_ushort_p(x, GMP_RNDN))
+ if (!mpfr_fits_ushort_p(x, MPFR_RNDN))
ERROR2;
- if (!mpfr_fits_sshort_p(x, GMP_RNDN))
+ if (!mpfr_fits_sshort_p(x, MPFR_RNDN))
ERROR2;
/* Check all other values */
- mpfr_set_ui(x, ULONG_MAX, GMP_RNDN);
- mpfr_mul_2exp(x, x, 1, GMP_RNDN);
- if (mpfr_fits_ulong_p(x, GMP_RNDN))
+ mpfr_set_ui(x, ULONG_MAX, MPFR_RNDN);
+ mpfr_mul_2exp(x, x, 1, MPFR_RNDN);
+ if (mpfr_fits_ulong_p(x, MPFR_RNDN))
ERROR1;
- if (mpfr_fits_slong_p(x, GMP_RNDN))
+ if (mpfr_fits_slong_p(x, MPFR_RNDN))
ERROR1;
- mpfr_mul_2exp(x, x, 40, GMP_RNDN);
- if (mpfr_fits_ulong_p(x, GMP_RNDN))
+ mpfr_mul_2exp(x, x, 40, MPFR_RNDN);
+ if (mpfr_fits_ulong_p(x, MPFR_RNDN))
ERROR1;
- if (mpfr_fits_uint_p(x, GMP_RNDN))
+ if (mpfr_fits_uint_p(x, MPFR_RNDN))
ERROR1;
- if (mpfr_fits_sint_p(x, GMP_RNDN))
+ if (mpfr_fits_sint_p(x, MPFR_RNDN))
ERROR1;
- if (mpfr_fits_ushort_p(x, GMP_RNDN))
+ if (mpfr_fits_ushort_p(x, MPFR_RNDN))
ERROR1;
- if (mpfr_fits_sshort_p(x, GMP_RNDN))
+ if (mpfr_fits_sshort_p(x, MPFR_RNDN))
ERROR1;
- mpfr_set_ui(x, ULONG_MAX, GMP_RNDN);
- if (!mpfr_fits_ulong_p(x, GMP_RNDN))
+ mpfr_set_ui(x, ULONG_MAX, MPFR_RNDN);
+ if (!mpfr_fits_ulong_p(x, MPFR_RNDN))
ERROR2;
- mpfr_set_ui(x, LONG_MAX, GMP_RNDN);
- if (!mpfr_fits_slong_p(x, GMP_RNDN))
+ mpfr_set_ui(x, LONG_MAX, MPFR_RNDN);
+ if (!mpfr_fits_slong_p(x, MPFR_RNDN))
ERROR2;
- mpfr_set_ui(x, UINT_MAX, GMP_RNDN);
- if (!mpfr_fits_uint_p(x, GMP_RNDN))
+ mpfr_set_ui(x, UINT_MAX, MPFR_RNDN);
+ if (!mpfr_fits_uint_p(x, MPFR_RNDN))
ERROR2;
- mpfr_set_ui(x, INT_MAX, GMP_RNDN);
- if (!mpfr_fits_sint_p(x, GMP_RNDN))
+ mpfr_set_ui(x, INT_MAX, MPFR_RNDN);
+ if (!mpfr_fits_sint_p(x, MPFR_RNDN))
ERROR2;
- mpfr_set_ui(x, USHRT_MAX, GMP_RNDN);
- if (!mpfr_fits_ushort_p(x, GMP_RNDN))
+ mpfr_set_ui(x, USHRT_MAX, MPFR_RNDN);
+ if (!mpfr_fits_ushort_p(x, MPFR_RNDN))
ERROR2;
- mpfr_set_ui(x, SHRT_MAX, GMP_RNDN);
- if (!mpfr_fits_sshort_p(x, GMP_RNDN))
+ mpfr_set_ui(x, SHRT_MAX, MPFR_RNDN);
+ if (!mpfr_fits_sshort_p(x, MPFR_RNDN))
ERROR2;
- mpfr_set_si(x, 1, GMP_RNDN);
- if (!mpfr_fits_sint_p(x, GMP_RNDN))
+ mpfr_set_si(x, 1, MPFR_RNDN);
+ if (!mpfr_fits_sint_p(x, MPFR_RNDN))
ERROR2;
- if (!mpfr_fits_sshort_p(x, GMP_RNDN))
+ if (!mpfr_fits_sshort_p(x, MPFR_RNDN))
ERROR2;
/* Check negative value */
- mpfr_set_si (x, -1, GMP_RNDN);
- if (!mpfr_fits_sint_p(x, GMP_RNDN))
+ mpfr_set_si (x, -1, MPFR_RNDN);
+ if (!mpfr_fits_sint_p(x, MPFR_RNDN))
ERROR2;
- if (!mpfr_fits_sshort_p(x, GMP_RNDN))
+ if (!mpfr_fits_sshort_p(x, MPFR_RNDN))
ERROR2;
- if (!mpfr_fits_slong_p(x, GMP_RNDN))
+ if (!mpfr_fits_slong_p(x, MPFR_RNDN))
ERROR2;
- if (mpfr_fits_uint_p(x, GMP_RNDN))
+ if (mpfr_fits_uint_p(x, MPFR_RNDN))
ERROR1;
- if (mpfr_fits_ushort_p(x, GMP_RNDN))
+ if (mpfr_fits_ushort_p(x, MPFR_RNDN))
ERROR1;
- if (mpfr_fits_ulong_p(x, GMP_RNDN))
+ if (mpfr_fits_ulong_p(x, MPFR_RNDN))
ERROR1;
mpfr_clear (x);
@@ -212,73 +212,73 @@ static void check_intmax (void)
/* Check NAN */
mpfr_set_nan(x);
- if (mpfr_fits_uintmax_p(x, GMP_RNDN))
+ if (mpfr_fits_uintmax_p(x, MPFR_RNDN))
ERROR1;
- if (mpfr_fits_intmax_p(x, GMP_RNDN))
+ if (mpfr_fits_intmax_p(x, MPFR_RNDN))
ERROR1;
/* Check INF */
mpfr_set_inf(x, 1);
- if (mpfr_fits_uintmax_p(x, GMP_RNDN))
+ if (mpfr_fits_uintmax_p(x, MPFR_RNDN))
ERROR1;
- if (mpfr_fits_intmax_p(x, GMP_RNDN))
+ if (mpfr_fits_intmax_p(x, MPFR_RNDN))
ERROR1;
/* Check Zero */
MPFR_SET_ZERO(x);
- if (!mpfr_fits_uintmax_p(x, GMP_RNDN))
+ if (!mpfr_fits_uintmax_p(x, MPFR_RNDN))
ERROR2;
- if (!mpfr_fits_intmax_p(x, GMP_RNDN))
+ if (!mpfr_fits_intmax_p(x, MPFR_RNDN))
ERROR2;
/* Check small op */
mpfr_set_str1 (x, "1@-1");
- if (!mpfr_fits_uintmax_p(x, GMP_RNDN))
+ if (!mpfr_fits_uintmax_p(x, MPFR_RNDN))
ERROR2;
- if (!mpfr_fits_intmax_p(x, GMP_RNDN))
+ if (!mpfr_fits_intmax_p(x, MPFR_RNDN))
ERROR2;
/* Check 17 */
- mpfr_set_ui (x, 17, GMP_RNDN);
- if (!mpfr_fits_uintmax_p(x, GMP_RNDN))
+ mpfr_set_ui (x, 17, MPFR_RNDN);
+ if (!mpfr_fits_uintmax_p(x, MPFR_RNDN))
ERROR2;
- if (!mpfr_fits_intmax_p(x, GMP_RNDN))
+ if (!mpfr_fits_intmax_p(x, MPFR_RNDN))
ERROR2;
/* Check hugest */
- mpfr_set_ui_2exp (x, 42, sizeof (uintmax_t) * 32, GMP_RNDN);
- if (mpfr_fits_uintmax_p (x, GMP_RNDN))
+ mpfr_set_ui_2exp (x, 42, sizeof (uintmax_t) * 32, MPFR_RNDN);
+ if (mpfr_fits_uintmax_p (x, MPFR_RNDN))
ERROR1;
- if (mpfr_fits_intmax_p (x, GMP_RNDN))
+ if (mpfr_fits_intmax_p (x, MPFR_RNDN))
ERROR1;
/* Check all other values */
- mpfr_set_uj (x, UINTMAX_MAX, GMP_RNDN);
- mpfr_add_ui (x, x, 1, GMP_RNDN);
- if (mpfr_fits_uintmax_p (x, GMP_RNDN))
+ mpfr_set_uj (x, UINTMAX_MAX, MPFR_RNDN);
+ mpfr_add_ui (x, x, 1, MPFR_RNDN);
+ if (mpfr_fits_uintmax_p (x, MPFR_RNDN))
ERROR1;
- mpfr_set_uj (x, UINTMAX_MAX, GMP_RNDN);
- if (!mpfr_fits_uintmax_p (x, GMP_RNDN))
+ mpfr_set_uj (x, UINTMAX_MAX, MPFR_RNDN);
+ if (!mpfr_fits_uintmax_p (x, MPFR_RNDN))
ERROR2;
- mpfr_set_sj (x, INTMAX_MAX, GMP_RNDN);
- mpfr_add_ui (x, x, 1, GMP_RNDN);
- if (mpfr_fits_intmax_p (x, GMP_RNDN))
+ mpfr_set_sj (x, INTMAX_MAX, MPFR_RNDN);
+ mpfr_add_ui (x, x, 1, MPFR_RNDN);
+ if (mpfr_fits_intmax_p (x, MPFR_RNDN))
ERROR1;
- mpfr_set_sj (x, INTMAX_MAX, GMP_RNDN);
- if (!mpfr_fits_intmax_p (x, GMP_RNDN))
+ mpfr_set_sj (x, INTMAX_MAX, MPFR_RNDN);
+ if (!mpfr_fits_intmax_p (x, MPFR_RNDN))
ERROR2;
- mpfr_set_sj (x, INTMAX_MIN, GMP_RNDN);
- if (!mpfr_fits_intmax_p (x, GMP_RNDN))
+ mpfr_set_sj (x, INTMAX_MIN, MPFR_RNDN);
+ if (!mpfr_fits_intmax_p (x, MPFR_RNDN))
ERROR2;
- mpfr_sub_ui (x, x, 1, GMP_RNDN);
- if (mpfr_fits_intmax_p (x, GMP_RNDN))
+ mpfr_sub_ui (x, x, 1, MPFR_RNDN);
+ if (mpfr_fits_intmax_p (x, MPFR_RNDN))
ERROR1;
/* Check negative value */
- mpfr_set_si (x, -1, GMP_RNDN);
- if (!mpfr_fits_intmax_p (x, GMP_RNDN))
+ mpfr_set_si (x, -1, MPFR_RNDN);
+ if (!mpfr_fits_intmax_p (x, MPFR_RNDN))
ERROR2;
- if (mpfr_fits_uintmax_p (x, GMP_RNDN))
+ if (mpfr_fits_uintmax_p (x, MPFR_RNDN))
ERROR1;
mpfr_clear (x);
diff --git a/tests/tfma.c b/tests/tfma.c
index 1df784167..3bb3e19b5 100644
--- a/tests/tfma.c
+++ b/tests/tfma.c
@@ -43,9 +43,9 @@ test_exact (void)
for (k = 0; k < sv; k++)
RND_LOOP (rnd)
{
- if (mpfr_set_str (a, val[i], 10, GMP_RNDN) ||
- mpfr_set_str (b, val[j], 10, GMP_RNDN) ||
- mpfr_set_str (c, val[k], 10, GMP_RNDN) ||
+ if (mpfr_set_str (a, val[i], 10, MPFR_RNDN) ||
+ mpfr_set_str (b, val[j], 10, MPFR_RNDN) ||
+ mpfr_set_str (c, val[k], 10, MPFR_RNDN) ||
mpfr_mul (r1, a, b, (mp_rnd_t) rnd) ||
mpfr_add (r1, r1, c, (mp_rnd_t) rnd))
{
@@ -70,9 +70,9 @@ test_exact (void)
if (mpfr_cmp (r1, r2) || MPFR_SIGN (r1) != MPFR_SIGN (r2))
{
printf ("test_exact(%d,%d,%d,%d):\nexpected ", i, j, k, rnd);
- mpfr_out_str (stdout, 10, 0, r1, GMP_RNDN);
+ mpfr_out_str (stdout, 10, 0, r1, MPFR_RNDN);
printf ("\n got ");
- mpfr_out_str (stdout, 10, 0, r2, GMP_RNDN);
+ mpfr_out_str (stdout, 10, 0, r2, MPFR_RNDN);
printf ("\n");
exit (1);
}
@@ -90,18 +90,18 @@ test_overflow1 (void)
mpfr_inits2 (8, x, y, z, r, (mpfr_ptr) 0);
MPFR_SET_POS (x);
mpfr_setmax (x, mpfr_get_emax ()); /* x = 2^emax - ulp */
- mpfr_set_ui (y, 2, GMP_RNDN); /* y = 2 */
- mpfr_neg (z, x, GMP_RNDN); /* z = -x = -(2^emax - ulp) */
+ mpfr_set_ui (y, 2, MPFR_RNDN); /* y = 2 */
+ mpfr_neg (z, x, MPFR_RNDN); /* z = -x = -(2^emax - ulp) */
mpfr_clear_flags ();
/* The intermediate multiplication x * y overflows, but x * y + z = x
is representable. */
- inex = mpfr_fma (r, x, y, z, GMP_RNDN);
+ inex = mpfr_fma (r, x, y, z, MPFR_RNDN);
if (inex || ! mpfr_equal_p (r, x))
{
printf ("Error in test_overflow1\nexpected ");
- mpfr_out_str (stdout, 2, 0, x, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN);
printf (" with inex = 0\n got ");
- mpfr_out_str (stdout, 2, 0, r, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, r, MPFR_RNDN);
printf (" with inex = %d\n", inex);
exit (1);
}
@@ -123,7 +123,7 @@ test_overflow2 (void)
MPFR_SET_POS (x);
mpfr_setmin (x, mpfr_get_emax ()); /* x = 0.1@emax */
- mpfr_set_si (y, -2, GMP_RNDN); /* y = -2 */
+ mpfr_set_si (y, -2, MPFR_RNDN); /* y = -2 */
/* The intermediate multiplication x * y will overflow. */
for (i = -9; i <= 9; i++)
@@ -131,10 +131,10 @@ test_overflow2 (void)
{
int inf, overflow;
- inf = rnd == GMP_RNDN || rnd == GMP_RNDD || rnd == GMP_RNDA;
+ inf = rnd == MPFR_RNDN || rnd == MPFR_RNDD || rnd == MPFR_RNDA;
overflow = inf || i <= 0;
- inex = mpfr_set_si_2exp (z, i, mpfr_get_emin (), GMP_RNDN);
+ inex = mpfr_set_si_2exp (z, i, mpfr_get_emin (), MPFR_RNDN);
MPFR_ASSERTN (inex == 0);
mpfr_clear_flags ();
@@ -209,12 +209,12 @@ test_underflow1 (void)
for (signy = -1; signy <= 1; signy += 2)
{
- mpfr_set_si_2exp (y, signy, -1, GMP_RNDN); /* |y| = 1/2 */
+ mpfr_set_si_2exp (y, signy, -1, MPFR_RNDN); /* |y| = 1/2 */
for (signz = -3; signz <= 3; signz += 2)
{
RND_LOOP (rnd)
{
- mpfr_set_si (z, signz, GMP_RNDN);
+ mpfr_set_si (z, signz, MPFR_RNDN);
if (ABS (signz) != 1)
mpfr_setmax (z, mpfr_get_emax ());
/* |z| = 1 or 2^emax - ulp */
@@ -253,18 +253,18 @@ test_underflow1 (void)
printf ("\n");
err = 1;
}
- if (inex >= 0 && (rnd == GMP_RNDD ||
- (rnd == GMP_RNDZ && signz > 0) ||
- (rnd == GMP_RNDN && signy > 0)))
+ if (inex >= 0 && (rnd == MPFR_RNDD ||
+ (rnd == MPFR_RNDZ && signz > 0) ||
+ (rnd == MPFR_RNDN && signy > 0)))
{
printf (ERRTU1 "ternary value = %d instead of < 0\n",
signy, signz, mpfr_print_rnd_mode ((mp_rnd_t) rnd),
inex);
err = 1;
}
- if (inex <= 0 && (rnd == GMP_RNDU ||
- (rnd == GMP_RNDZ && signz < 0) ||
- (rnd == GMP_RNDN && signy < 0)))
+ if (inex <= 0 && (rnd == MPFR_RNDU ||
+ (rnd == MPFR_RNDZ && signz < 0) ||
+ (rnd == MPFR_RNDN && signy < 0)))
{
printf (ERRTU1 "ternary value = %d instead of > 0\n",
signy, signz, mpfr_print_rnd_mode ((mp_rnd_t) rnd),
@@ -288,21 +288,21 @@ test_underflow2 (void)
mpfr_inits2 (32, x, y, z, r, (mpfr_ptr) 0);
- mpfr_set_si_2exp (z, 1, mpfr_get_emin (), GMP_RNDN); /* z = 2^emin */
- mpfr_set_si_2exp (x, 1, mpfr_get_emin (), GMP_RNDN); /* x = 2^emin */
+ mpfr_set_si_2exp (z, 1, mpfr_get_emin (), MPFR_RNDN); /* z = 2^emin */
+ mpfr_set_si_2exp (x, 1, mpfr_get_emin (), MPFR_RNDN); /* x = 2^emin */
for (b = 0; b <= 1; b++)
{
for (i = 15; i <= 17; i++)
{
- mpfr_set_si_2exp (y, i, -4 - MPFR_PREC (z), GMP_RNDN);
+ mpfr_set_si_2exp (y, i, -4 - MPFR_PREC (z), MPFR_RNDN);
/* z = 1.000...00b
* xy = 01111
* or 10000
* or 10001
*/
mpfr_clear_flags ();
- inex = mpfr_fma (r, x, y, z, GMP_RNDN);
+ inex = mpfr_fma (r, x, y, z, MPFR_RNDN);
#define ERRTU2 "Error in test_underflow2 (b = %d, i = %d)\n "
if (__gmpfr_flags != MPFR_FLAGS_INEXACT)
{
@@ -317,7 +317,7 @@ test_underflow2 (void)
b, i, inex, same ? '<' : '>');
err = 1;
}
- mpfr_set (y, z, GMP_RNDN);
+ mpfr_set (y, z, MPFR_RNDN);
if (!same)
mpfr_nextabove (y);
if (! mpfr_equal_p (r, y))
@@ -355,10 +355,10 @@ main (int argc, char *argv[])
mpfr_set_prec (y, 2);
mpfr_set_prec (z, 2);
mpfr_set_prec (s, 2);
- mpfr_set_str (x, "-0.75", 10, GMP_RNDN);
- mpfr_set_str (y, "0.5", 10, GMP_RNDN);
- mpfr_set_str (z, "0.375", 10, GMP_RNDN);
- mpfr_fma (s, x, y, z, GMP_RNDU); /* result is 0 */
+ mpfr_set_str (x, "-0.75", 10, MPFR_RNDN);
+ mpfr_set_str (y, "0.5", 10, MPFR_RNDN);
+ mpfr_set_str (z, "0.375", 10, MPFR_RNDN);
+ mpfr_fma (s, x, y, z, MPFR_RNDU); /* result is 0 */
if (mpfr_cmp_ui(s, 0))
{
printf("Error: -0.75 * 0.5 + 0.375 should be equal to 0 for prec=2\n");
@@ -370,9 +370,9 @@ main (int argc, char *argv[])
mpfr_set_prec (z, 27);
mpfr_set_prec (s, 27);
mpfr_set_str_binary (x, "1.11111111111111111111111111e-1");
- mpfr_set (y, x, GMP_RNDN);
+ mpfr_set (y, x, MPFR_RNDN);
mpfr_set_str_binary (z, "-1.00011110100011001011001001e-1");
- if (mpfr_fma (s, x, y, z, GMP_RNDN) >= 0)
+ if (mpfr_fma (s, x, y, z, MPFR_RNDN) >= 0)
{
printf ("Wrong inexact flag for x=y=1-2^(-27)\n");
exit (1);
@@ -381,7 +381,7 @@ main (int argc, char *argv[])
mpfr_set_nan (x);
mpfr_urandomb (y, RANDS);
mpfr_urandomb (z, RANDS);
- mpfr_fma (s, x, y, z, GMP_RNDN);
+ mpfr_fma (s, x, y, z, MPFR_RNDN);
if (!mpfr_nan_p (s))
{
printf ("evaluation of function in x=NAN does not return NAN");
@@ -391,7 +391,7 @@ main (int argc, char *argv[])
mpfr_set_nan (y);
mpfr_urandomb (x, RANDS);
mpfr_urandomb (z, RANDS);
- mpfr_fma (s, x, y, z, GMP_RNDN);
+ mpfr_fma (s, x, y, z, MPFR_RNDN);
if (!mpfr_nan_p(s))
{
printf ("evaluation of function in y=NAN does not return NAN");
@@ -401,7 +401,7 @@ main (int argc, char *argv[])
mpfr_set_nan (z);
mpfr_urandomb (y, RANDS);
mpfr_urandomb (x, RANDS);
- mpfr_fma (s, x, y, z, GMP_RNDN);
+ mpfr_fma (s, x, y, z, MPFR_RNDN);
if (!mpfr_nan_p (s))
{
printf ("evaluation of function in z=NAN does not return NAN");
@@ -411,7 +411,7 @@ main (int argc, char *argv[])
mpfr_set_inf (x, 1);
mpfr_set_inf (y, 1);
mpfr_set_inf (z, 1);
- mpfr_fma (s, x, y, z, GMP_RNDN);
+ mpfr_fma (s, x, y, z, MPFR_RNDN);
if (!mpfr_inf_p (s) || mpfr_sgn (s) < 0)
{
printf ("Error for (+inf) * (+inf) + (+inf)\n");
@@ -421,7 +421,7 @@ main (int argc, char *argv[])
mpfr_set_inf (x, -1);
mpfr_set_inf (y, -1);
mpfr_set_inf (z, 1);
- mpfr_fma (s, x, y, z, GMP_RNDN);
+ mpfr_fma (s, x, y, z, MPFR_RNDN);
if (!mpfr_inf_p (s) || mpfr_sgn (s) < 0)
{
printf ("Error for (-inf) * (-inf) + (+inf)\n");
@@ -431,7 +431,7 @@ main (int argc, char *argv[])
mpfr_set_inf (x, 1);
mpfr_set_inf (y, -1);
mpfr_set_inf (z, -1);
- mpfr_fma (s, x, y, z, GMP_RNDN);
+ mpfr_fma (s, x, y, z, MPFR_RNDN);
if (!mpfr_inf_p (s) || mpfr_sgn (s) > 0)
{
printf ("Error for (+inf) * (-inf) + (-inf)\n");
@@ -441,7 +441,7 @@ main (int argc, char *argv[])
mpfr_set_inf (x, -1);
mpfr_set_inf (y, 1);
mpfr_set_inf (z, -1);
- mpfr_fma (s, x, y, z, GMP_RNDN);
+ mpfr_fma (s, x, y, z, MPFR_RNDN);
if (!mpfr_inf_p (s) || mpfr_sgn (s) > 0)
{
printf ("Error for (-inf) * (+inf) + (-inf)\n");
@@ -449,9 +449,9 @@ main (int argc, char *argv[])
}
mpfr_set_inf (x, 1);
- mpfr_set_ui (y, 0, GMP_RNDN);
+ mpfr_set_ui (y, 0, MPFR_RNDN);
mpfr_urandomb (z, RANDS);
- mpfr_fma (s, x, y, z, GMP_RNDN);
+ mpfr_fma (s, x, y, z, MPFR_RNDN);
if (!mpfr_nan_p (s))
{
printf ("evaluation of function in x=INF y=0 does not return NAN");
@@ -459,9 +459,9 @@ main (int argc, char *argv[])
}
mpfr_set_inf (y, 1);
- mpfr_set_ui (x, 0, GMP_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
mpfr_urandomb (z, RANDS);
- mpfr_fma (s, x, y, z, GMP_RNDN);
+ mpfr_fma (s, x, y, z, MPFR_RNDN);
if (!mpfr_nan_p (s))
{
printf ("evaluation of function in x=0 y=INF does not return NAN");
@@ -471,7 +471,7 @@ main (int argc, char *argv[])
mpfr_set_inf (x, 1);
mpfr_urandomb (y, RANDS); /* always positive */
mpfr_set_inf (z, -1);
- mpfr_fma (s, x, y, z, GMP_RNDN);
+ mpfr_fma (s, x, y, z, MPFR_RNDN);
if (!mpfr_nan_p (s))
{
printf ("evaluation of function in x=INF y>0 z=-INF does not return NAN");
@@ -481,7 +481,7 @@ main (int argc, char *argv[])
mpfr_set_inf (y, 1);
mpfr_urandomb (x, RANDS);
mpfr_set_inf (z, -1);
- mpfr_fma (s, x, y, z, GMP_RNDN);
+ mpfr_fma (s, x, y, z, MPFR_RNDN);
if (!mpfr_nan_p (s))
{
printf ("evaluation of function in x>0 y=INF z=-INF does not return NAN");
@@ -491,7 +491,7 @@ main (int argc, char *argv[])
mpfr_set_inf (x, 1);
mpfr_urandomb (y, RANDS);
mpfr_urandomb (z, RANDS);
- mpfr_fma (s, x, y, z, GMP_RNDN);
+ mpfr_fma (s, x, y, z, MPFR_RNDN);
if (!mpfr_inf_p (s) || mpfr_sgn (s) < 0)
{
printf ("evaluation of function in x=INF does not return INF");
@@ -501,7 +501,7 @@ main (int argc, char *argv[])
mpfr_set_inf (y, 1);
mpfr_urandomb (x, RANDS);
mpfr_urandomb (z, RANDS);
- mpfr_fma (s, x, y, z, GMP_RNDN);
+ mpfr_fma (s, x, y, z, MPFR_RNDN);
if (!mpfr_inf_p (s) || mpfr_sgn (s) < 0)
{
printf ("evaluation of function in y=INF does not return INF");
@@ -511,27 +511,27 @@ main (int argc, char *argv[])
mpfr_set_inf (z, 1);
mpfr_urandomb (x, RANDS);
mpfr_urandomb (y, RANDS);
- mpfr_fma (s, x, y, z, GMP_RNDN);
+ mpfr_fma (s, x, y, z, MPFR_RNDN);
if (!mpfr_inf_p (s) || mpfr_sgn (s) < 0)
{
printf ("evaluation of function in z=INF does not return INF");
exit (1);
}
- mpfr_set_ui (x, 0, GMP_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
mpfr_urandomb (y, RANDS);
mpfr_urandomb (z, RANDS);
- mpfr_fma (s, x, y, z, GMP_RNDN);
+ mpfr_fma (s, x, y, z, MPFR_RNDN);
if (mpfr_cmp (s, z))
{
printf ("evaluation of function in x=0 does not return z\n");
exit (1);
}
- mpfr_set_ui (y, 0, GMP_RNDN);
+ mpfr_set_ui (y, 0, MPFR_RNDN);
mpfr_urandomb (x, RANDS);
mpfr_urandomb (z, RANDS);
- mpfr_fma (s, x, y, z, GMP_RNDN);
+ mpfr_fma (s, x, y, z, MPFR_RNDN);
if (mpfr_cmp (s, z))
{
printf ("evaluation of function in y=0 does not return z\n");
@@ -567,11 +567,11 @@ main (int argc, char *argv[])
mpfr_urandomb (z, RANDS);
if (randlimb () % 2)
- mpfr_neg (x, x, GMP_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN);
if (randlimb () % 2)
- mpfr_neg (y, y, GMP_RNDN);
+ mpfr_neg (y, y, MPFR_RNDN);
if (randlimb () % 2)
- mpfr_neg (z, z, GMP_RNDN);
+ mpfr_neg (z, z, MPFR_RNDN);
rnd = RND_RAND ();
mpfr_set_prec (slong, 2 * prec);
@@ -585,18 +585,18 @@ main (int argc, char *argv[])
if (mpfr_cmp (s, t))
{
printf ("results differ for x=");
- mpfr_out_str (stdout, 2, prec, x, GMP_RNDN);
+ mpfr_out_str (stdout, 2, prec, x, MPFR_RNDN);
printf (" y=");
- mpfr_out_str (stdout, 2, prec, y, GMP_RNDN);
+ mpfr_out_str (stdout, 2, prec, y, MPFR_RNDN);
printf (" z=");
- mpfr_out_str (stdout, 2, prec, z, GMP_RNDN);
+ mpfr_out_str (stdout, 2, prec, z, MPFR_RNDN);
printf (" prec=%u rnd_mode=%s\n", (unsigned int) prec,
mpfr_print_rnd_mode (rnd));
printf ("got ");
- mpfr_out_str (stdout, 2, prec, s, GMP_RNDN);
+ mpfr_out_str (stdout, 2, prec, s, MPFR_RNDN);
puts ("");
printf ("expected ");
- mpfr_out_str (stdout, 2, prec, t, GMP_RNDN);
+ mpfr_out_str (stdout, 2, prec, t, MPFR_RNDN);
puts ("");
printf ("approx ");
mpfr_print_binary (slong);
@@ -609,10 +609,10 @@ main (int argc, char *argv[])
{
printf ("Wrong inexact flag for rnd=%s: expected %d, got %d\n",
mpfr_print_rnd_mode (rnd), compare, inexact);
- printf (" x="); mpfr_out_str (stdout, 2, 0, x, GMP_RNDN);
- printf (" y="); mpfr_out_str (stdout, 2, 0, y, GMP_RNDN);
- printf (" z="); mpfr_out_str (stdout, 2, 0, z, GMP_RNDN);
- printf (" s="); mpfr_out_str (stdout, 2, 0, s, GMP_RNDN);
+ printf (" x="); mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN);
+ printf (" y="); mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN);
+ printf (" z="); mpfr_out_str (stdout, 2, 0, z, MPFR_RNDN);
+ printf (" s="); mpfr_out_str (stdout, 2, 0, s, MPFR_RNDN);
printf ("\n");
exit (1);
}
diff --git a/tests/tfmod.c b/tests/tfmod.c
index 32bf0d1d5..fc73a350c 100644
--- a/tests/tfmod.c
+++ b/tests/tfmod.c
@@ -57,10 +57,10 @@ slow_fmod (mpfr_ptr r, mpfr_srcptr x, mpfr_srcptr y, mp_rnd_t rnd)
then |x/y| < 2^(ex-ey+1) */
mpfr_init2 (q,
MAX (MPFR_PREC_MIN, mpfr_get_exp (x) - mpfr_get_exp (y) + 1));
- mpfr_div (q, x, y, GMP_RNDZ);
+ mpfr_div (q, x, y, MPFR_RNDZ);
mpfr_trunc (q, q); /* may change inexact flag */
- mpfr_prec_round (q, mpfr_get_prec (q) + mpfr_get_prec (y), GMP_RNDZ);
- inexact = mpfr_mul (q, q, y, GMP_RNDZ); /* exact */
+ mpfr_prec_round (q, mpfr_get_prec (q) + mpfr_get_prec (y), MPFR_RNDZ);
+ inexact = mpfr_mul (q, q, y, MPFR_RNDZ); /* exact */
inexact = mpfr_sub (r, x, q, rnd);
mpfr_clear (q);
return inexact;
@@ -70,14 +70,14 @@ static void
test_failed (mpfr_t erem, mpfr_t grem, mpfr_t x, mpfr_t y, mp_rnd_t rnd)
{
printf ("error : mpfr_fmod (r, x, y, rnd)\n x = ");
- mpfr_out_str (stdout, 10, 0, x, GMP_RNDD);
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDD);
printf ("\n y = ");
- mpfr_out_str (stdout, 10, 0, y, GMP_RNDD);
+ mpfr_out_str (stdout, 10, 0, y, MPFR_RNDD);
printf ("\nrnd = %s\n", mpfr_print_rnd_mode (rnd));
printf ("\n expected r = ");
- mpfr_out_str (stdout, 10, 0, erem, GMP_RNDD);
+ mpfr_out_str (stdout, 10, 0, erem, MPFR_RNDD);
printf ("\n got r = ");
- mpfr_out_str (stdout, 10, 0, grem, GMP_RNDD);
+ mpfr_out_str (stdout, 10, 0, grem, MPFR_RNDD);
putchar ('\n');
mpfr_clears (erem, grem, x, y, (mpfr_ptr) 0);
@@ -109,9 +109,9 @@ special (void)
/* NaN mod NaN is NaN */
mpfr_set_nan (x);
mpfr_set_nan (y);
- inexact = mpfr_fmod (r, x, y, GMP_RNDN);
+ inexact = mpfr_fmod (r, x, y, MPFR_RNDN);
if (!mpfr_nan_p (r))
- test_failed (r, x, x, y, GMP_RNDN);
+ test_failed (r, x, x, y, MPFR_RNDN);
if (inexact)
{
printf ("error : mpfr_fmod (NaN, NaN) should be exact\n");
@@ -119,10 +119,10 @@ special (void)
}
/* NaN mod +0 is NaN */
- mpfr_set_ui (y, 0, GMP_RNDN);
- inexact = mpfr_fmod (r, x, y, GMP_RNDN);
+ mpfr_set_ui (y, 0, MPFR_RNDN);
+ inexact = mpfr_fmod (r, x, y, MPFR_RNDN);
if (!mpfr_nan_p (r))
- test_failed (r, x, x, y, GMP_RNDN);
+ test_failed (r, x, x, y, MPFR_RNDN);
if (inexact)
{
printf ("error : mpfr_fmod (NaN, +0) should be exact\n");
@@ -130,10 +130,10 @@ special (void)
}
/* 3.1415 mod +0 is NaN */
- mpfr_set_d (x, 3.1415, GMP_RNDN);
- inexact = mpfr_fmod (r, x, y, GMP_RNDN);
+ mpfr_set_d (x, 3.1415, MPFR_RNDN);
+ inexact = mpfr_fmod (r, x, y, MPFR_RNDN);
if (!mpfr_nan_p (r))
- test_failed (r, x, x, y, GMP_RNDN);
+ test_failed (r, x, x, y, MPFR_RNDN);
if (inexact)
{
printf ("error : mpfr_fmod (3.1415, NaN) should be exact\n");
@@ -142,9 +142,9 @@ special (void)
/* 3.1415 mod +Inf is 3.1415 */
mpfr_set_inf (y, 1);
- inexact = mpfr_fmod (r, x, y, GMP_RNDN);
+ inexact = mpfr_fmod (r, x, y, MPFR_RNDN);
if (MPFR_IS_SINGULAR (r))
- test_failed (r, x, x, y, GMP_RNDN);
+ test_failed (r, x, x, y, MPFR_RNDN);
if (inexact)
{
printf ("error : mpfr_fmod (3.1415, +Inf) should be exact\n");
@@ -174,27 +174,27 @@ main (int argc, char *argv[])
special ();
/* remainder = 0 */
- mpfr_set_str (y, "FEDCBA987654321p-64", 16, GMP_RNDN);
- mpfr_pow_ui (x, y, 42, GMP_RNDN);
- check (r, x, y, GMP_RNDN);
+ mpfr_set_str (y, "FEDCBA987654321p-64", 16, MPFR_RNDN);
+ mpfr_pow_ui (x, y, 42, MPFR_RNDN);
+ check (r, x, y, MPFR_RNDN);
/* x < y */
- mpfr_mul_d (x, y, .12345, GMP_RNDN);
- check (r, x, y, GMP_RNDN);
+ mpfr_mul_d (x, y, .12345, MPFR_RNDN);
+ check (r, x, y, MPFR_RNDN);
/* sign(x) = sign (r) */
- mpfr_set_str (x, "123798", 10, GMP_RNDN);
- mpfr_set_str (y, "10", 10, GMP_RNDN);
- check (r, x, y, GMP_RNDN);
+ mpfr_set_str (x, "123798", 10, MPFR_RNDN);
+ mpfr_set_str (y, "10", 10, MPFR_RNDN);
+ check (r, x, y, MPFR_RNDN);
/* huge difference between precisions */
mpfr_set_prec (x, 314);
- mpfr_const_pi (x, GMP_RNDD); /* x = pi */
+ mpfr_const_pi (x, MPFR_RNDD); /* x = pi */
mpfr_set_prec (y, 8);
- mpfr_set_ui (y, 1, GMP_RNDD);
- mpfr_div_2ui (y, y, 3, GMP_RNDD); /* y = 1/8 */
+ mpfr_set_ui (y, 1, MPFR_RNDD);
+ mpfr_div_2ui (y, y, 3, MPFR_RNDD); /* y = 1/8 */
mpfr_set_prec (r, 123);
- check (r, x, y, GMP_RNDD);
+ check (r, x, y, MPFR_RNDD);
mpfr_clears (x, y, r, (mpfr_ptr) 0);
tests_end_mpfr ();
diff --git a/tests/tfms.c b/tests/tfms.c
index b7d9d4827..0cfb3688a 100644
--- a/tests/tfms.c
+++ b/tests/tfms.c
@@ -43,9 +43,9 @@ test_exact (void)
for (k = 0; k < sv; k++)
RND_LOOP (rnd)
{
- if (mpfr_set_str (a, val[i], 10, GMP_RNDN) ||
- mpfr_set_str (b, val[j], 10, GMP_RNDN) ||
- mpfr_set_str (c, val[k], 10, GMP_RNDN) ||
+ if (mpfr_set_str (a, val[i], 10, MPFR_RNDN) ||
+ mpfr_set_str (b, val[j], 10, MPFR_RNDN) ||
+ mpfr_set_str (c, val[k], 10, MPFR_RNDN) ||
mpfr_mul (r1, a, b, (mp_rnd_t) rnd) ||
mpfr_sub (r1, r1, c, (mp_rnd_t) rnd))
{
@@ -70,9 +70,9 @@ test_exact (void)
if (mpfr_cmp (r1, r2) || MPFR_SIGN (r1) != MPFR_SIGN (r2))
{
printf ("test_exact(%d,%d,%d,%d):\nexpected ", i, j, k, rnd);
- mpfr_out_str (stdout, 10, 0, r1, GMP_RNDN);
+ mpfr_out_str (stdout, 10, 0, r1, MPFR_RNDN);
printf ("\n got ");
- mpfr_out_str (stdout, 10, 0, r2, GMP_RNDN);
+ mpfr_out_str (stdout, 10, 0, r2, MPFR_RNDN);
printf ("\n");
exit (1);
}
@@ -90,18 +90,18 @@ test_overflow1 (void)
mpfr_inits2 (8, x, y, z, r, (mpfr_ptr) 0);
MPFR_SET_POS (x);
mpfr_setmax (x, mpfr_get_emax ()); /* x = 2^emax - ulp */
- mpfr_set_ui (y, 2, GMP_RNDN); /* y = 2 */
- mpfr_set (z, x, GMP_RNDN); /* z = x = 2^emax - ulp */
+ mpfr_set_ui (y, 2, MPFR_RNDN); /* y = 2 */
+ mpfr_set (z, x, MPFR_RNDN); /* z = x = 2^emax - ulp */
mpfr_clear_flags ();
/* The intermediate multiplication x * y overflows, but x * y - z = x
is representable. */
- inex = mpfr_fms (r, x, y, z, GMP_RNDN);
+ inex = mpfr_fms (r, x, y, z, MPFR_RNDN);
if (inex || ! mpfr_equal_p (r, x))
{
printf ("Error in test_overflow1\nexpected ");
- mpfr_out_str (stdout, 2, 0, x, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN);
printf (" with inex = 0\n got ");
- mpfr_out_str (stdout, 2, 0, r, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, r, MPFR_RNDN);
printf (" with inex = %d\n", inex);
exit (1);
}
@@ -123,7 +123,7 @@ test_overflow2 (void)
MPFR_SET_POS (x);
mpfr_setmin (x, mpfr_get_emax ()); /* x = 0.1@emax */
- mpfr_set_si (y, -2, GMP_RNDN); /* y = -2 */
+ mpfr_set_si (y, -2, MPFR_RNDN); /* y = -2 */
/* The intermediate multiplication x * y will overflow. */
for (i = -9; i <= 9; i++)
@@ -131,10 +131,10 @@ test_overflow2 (void)
{
int inf, overflow;
- inf = rnd == GMP_RNDN || rnd == GMP_RNDD || rnd == GMP_RNDA;
+ inf = rnd == MPFR_RNDN || rnd == MPFR_RNDD || rnd == MPFR_RNDA;
overflow = inf || i <= 0;
- inex = mpfr_set_si_2exp (z, -i, mpfr_get_emin (), GMP_RNDN);
+ inex = mpfr_set_si_2exp (z, -i, mpfr_get_emin (), MPFR_RNDN);
MPFR_ASSERTN (inex == 0);
mpfr_clear_flags ();
@@ -209,12 +209,12 @@ test_underflow1 (void)
for (signy = -1; signy <= 1; signy += 2)
{
- mpfr_set_si_2exp (y, signy, -1, GMP_RNDN); /* |y| = 1/2 */
+ mpfr_set_si_2exp (y, signy, -1, MPFR_RNDN); /* |y| = 1/2 */
for (signz = -3; signz <= 3; signz += 2)
{
RND_LOOP (rnd)
{
- mpfr_set_si (z, signz, GMP_RNDN);
+ mpfr_set_si (z, signz, MPFR_RNDN);
if (ABS (signz) != 1)
mpfr_setmax (z, mpfr_get_emax ());
/* |z| = 1 or 2^emax - ulp */
@@ -227,7 +227,7 @@ test_underflow1 (void)
mpfr_print_rnd_mode ((mp_rnd_t) rnd));
err = 1;
}
- mpfr_neg (z, z, GMP_RNDN);
+ mpfr_neg (z, z, MPFR_RNDN);
if (signy < 0 && MPFR_IS_LIKE_RNDD(rnd, -signz))
mpfr_nextbelow (z);
if (signy > 0 && MPFR_IS_LIKE_RNDU(rnd, -signz))
@@ -254,18 +254,18 @@ test_underflow1 (void)
printf ("\n");
err = 1;
}
- if (inex >= 0 && (rnd == GMP_RNDD ||
- (rnd == GMP_RNDZ && signz < 0) ||
- (rnd == GMP_RNDN && signy > 0)))
+ if (inex >= 0 && (rnd == MPFR_RNDD ||
+ (rnd == MPFR_RNDZ && signz < 0) ||
+ (rnd == MPFR_RNDN && signy > 0)))
{
printf (ERRTU1 "ternary value = %d instead of < 0\n",
signy, signz, mpfr_print_rnd_mode ((mp_rnd_t) rnd),
inex);
err = 1;
}
- if (inex <= 0 && (rnd == GMP_RNDU ||
- (rnd == GMP_RNDZ && signz > 0) ||
- (rnd == GMP_RNDN && signy < 0)))
+ if (inex <= 0 && (rnd == MPFR_RNDU ||
+ (rnd == MPFR_RNDZ && signz > 0) ||
+ (rnd == MPFR_RNDN && signy < 0)))
{
printf (ERRTU1 "ternary value = %d instead of > 0\n",
signy, signz, mpfr_print_rnd_mode ((mp_rnd_t) rnd),
@@ -289,21 +289,21 @@ test_underflow2 (void)
mpfr_inits2 (32, x, y, z, r, (mpfr_ptr) 0);
- mpfr_set_si_2exp (z, -1, mpfr_get_emin (), GMP_RNDN); /* z = -2^emin */
- mpfr_set_si_2exp (x, 1, mpfr_get_emin (), GMP_RNDN); /* x = 2^emin */
+ mpfr_set_si_2exp (z, -1, mpfr_get_emin (), MPFR_RNDN); /* z = -2^emin */
+ mpfr_set_si_2exp (x, 1, mpfr_get_emin (), MPFR_RNDN); /* x = 2^emin */
for (b = 0; b <= 1; b++)
{
for (i = 15; i <= 17; i++)
{
- mpfr_set_si_2exp (y, i, -4 - MPFR_PREC (z), GMP_RNDN);
+ mpfr_set_si_2exp (y, i, -4 - MPFR_PREC (z), MPFR_RNDN);
/* z = -1.000...00b
* xy = 01111
* or 10000
* or 10001
*/
mpfr_clear_flags ();
- inex = mpfr_fms (r, x, y, z, GMP_RNDN);
+ inex = mpfr_fms (r, x, y, z, MPFR_RNDN);
#define ERRTU2 "Error in test_underflow2 (b = %d, i = %d)\n "
if (__gmpfr_flags != MPFR_FLAGS_INEXACT)
{
@@ -318,7 +318,7 @@ test_underflow2 (void)
b, i, inex, same ? '<' : '>');
err = 1;
}
- mpfr_neg (y, z, GMP_RNDN);
+ mpfr_neg (y, z, MPFR_RNDN);
if (!same)
mpfr_nextabove (y);
if (! mpfr_equal_p (r, y))
@@ -356,10 +356,10 @@ main (int argc, char *argv[])
mpfr_set_prec (y, 2);
mpfr_set_prec (z, 2);
mpfr_set_prec (s, 2);
- mpfr_set_str (x, "-0.75", 10, GMP_RNDN);
- mpfr_set_str (y, "0.5", 10, GMP_RNDN);
- mpfr_set_str (z, "-0.375", 10, GMP_RNDN);
- mpfr_fms (s, x, y, z, GMP_RNDU); /* result is 0 */
+ mpfr_set_str (x, "-0.75", 10, MPFR_RNDN);
+ mpfr_set_str (y, "0.5", 10, MPFR_RNDN);
+ mpfr_set_str (z, "-0.375", 10, MPFR_RNDN);
+ mpfr_fms (s, x, y, z, MPFR_RNDU); /* result is 0 */
if (mpfr_cmp_ui(s, 0))
{
printf("Error: -0.75 * 0.5 - -0.375 should be equal to 0 for prec=2\n");
@@ -371,9 +371,9 @@ main (int argc, char *argv[])
mpfr_set_prec (z, 27);
mpfr_set_prec (s, 27);
mpfr_set_str_binary (x, "1.11111111111111111111111111e-1");
- mpfr_set (y, x, GMP_RNDN);
+ mpfr_set (y, x, MPFR_RNDN);
mpfr_set_str_binary (z, "1.00011110100011001011001001e-1");
- if (mpfr_fms (s, x, y, z, GMP_RNDN) >= 0)
+ if (mpfr_fms (s, x, y, z, MPFR_RNDN) >= 0)
{
printf ("Wrong inexact flag for x=y=1-2^(-27)\n");
exit (1);
@@ -382,7 +382,7 @@ main (int argc, char *argv[])
mpfr_set_nan (x);
mpfr_urandomb (y, RANDS);
mpfr_urandomb (z, RANDS);
- mpfr_fms (s, x, y, z, GMP_RNDN);
+ mpfr_fms (s, x, y, z, MPFR_RNDN);
if (!mpfr_nan_p (s))
{
printf ("evaluation of function in x=NAN does not return NAN");
@@ -392,7 +392,7 @@ main (int argc, char *argv[])
mpfr_set_nan (y);
mpfr_urandomb (x, RANDS);
mpfr_urandomb (z, RANDS);
- mpfr_fms (s, x, y, z, GMP_RNDN);
+ mpfr_fms (s, x, y, z, MPFR_RNDN);
if (!mpfr_nan_p(s))
{
printf ("evaluation of function in y=NAN does not return NAN");
@@ -402,7 +402,7 @@ main (int argc, char *argv[])
mpfr_set_nan (z);
mpfr_urandomb (y, RANDS);
mpfr_urandomb (x, RANDS);
- mpfr_fms (s, x, y, z, GMP_RNDN);
+ mpfr_fms (s, x, y, z, MPFR_RNDN);
if (!mpfr_nan_p (s))
{
printf ("evaluation of function in z=NAN does not return NAN");
@@ -412,7 +412,7 @@ main (int argc, char *argv[])
mpfr_set_inf (x, 1);
mpfr_set_inf (y, 1);
mpfr_set_inf (z, -1);
- mpfr_fms (s, x, y, z, GMP_RNDN);
+ mpfr_fms (s, x, y, z, MPFR_RNDN);
if (!mpfr_inf_p (s) || mpfr_sgn (s) < 0)
{
printf ("Error for (+inf) * (+inf) - (-inf)\n");
@@ -422,7 +422,7 @@ main (int argc, char *argv[])
mpfr_set_inf (x, -1);
mpfr_set_inf (y, -1);
mpfr_set_inf (z, -1);
- mpfr_fms (s, x, y, z, GMP_RNDN);
+ mpfr_fms (s, x, y, z, MPFR_RNDN);
if (!mpfr_inf_p (s) || mpfr_sgn (s) < 0)
{
printf ("Error for (-inf) * (-inf) - (-inf)\n");
@@ -432,7 +432,7 @@ main (int argc, char *argv[])
mpfr_set_inf (x, 1);
mpfr_set_inf (y, -1);
mpfr_set_inf (z, 1);
- mpfr_fms (s, x, y, z, GMP_RNDN);
+ mpfr_fms (s, x, y, z, MPFR_RNDN);
if (!mpfr_inf_p (s) || mpfr_sgn (s) > 0)
{
printf ("Error for (+inf) * (-inf) - (+inf)\n");
@@ -442,7 +442,7 @@ main (int argc, char *argv[])
mpfr_set_inf (x, -1);
mpfr_set_inf (y, 1);
mpfr_set_inf (z, 1);
- mpfr_fms (s, x, y, z, GMP_RNDN);
+ mpfr_fms (s, x, y, z, MPFR_RNDN);
if (!mpfr_inf_p (s) || mpfr_sgn (s) > 0)
{
printf ("Error for (-inf) * (+inf) - (+inf)\n");
@@ -450,9 +450,9 @@ main (int argc, char *argv[])
}
mpfr_set_inf (x, 1);
- mpfr_set_ui (y, 0, GMP_RNDN);
+ mpfr_set_ui (y, 0, MPFR_RNDN);
mpfr_urandomb (z, RANDS);
- mpfr_fms (s, x, y, z, GMP_RNDN);
+ mpfr_fms (s, x, y, z, MPFR_RNDN);
if (!mpfr_nan_p (s))
{
printf ("evaluation of function in x=INF y=0 does not return NAN");
@@ -460,9 +460,9 @@ main (int argc, char *argv[])
}
mpfr_set_inf (y, 1);
- mpfr_set_ui (x, 0, GMP_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
mpfr_urandomb (z, RANDS);
- mpfr_fms (s, x, y, z, GMP_RNDN);
+ mpfr_fms (s, x, y, z, MPFR_RNDN);
if (!mpfr_nan_p (s))
{
printf ("evaluation of function in x=0 y=INF does not return NAN");
@@ -472,7 +472,7 @@ main (int argc, char *argv[])
mpfr_set_inf (x, 1);
mpfr_urandomb (y, RANDS); /* always positive */
mpfr_set_inf (z, 1);
- mpfr_fms (s, x, y, z, GMP_RNDN);
+ mpfr_fms (s, x, y, z, MPFR_RNDN);
if (!mpfr_nan_p (s))
{
printf ("evaluation of function in x=INF y>0 z=INF does not return NAN");
@@ -482,7 +482,7 @@ main (int argc, char *argv[])
mpfr_set_inf (y, 1);
mpfr_urandomb (x, RANDS);
mpfr_set_inf (z, 1);
- mpfr_fms (s, x, y, z, GMP_RNDN);
+ mpfr_fms (s, x, y, z, MPFR_RNDN);
if (!mpfr_nan_p (s))
{
printf ("evaluation of function in x>0 y=INF z=INF does not return NAN");
@@ -492,7 +492,7 @@ main (int argc, char *argv[])
mpfr_set_inf (x, 1);
mpfr_urandomb (y, RANDS);
mpfr_urandomb (z, RANDS);
- mpfr_fms (s, x, y, z, GMP_RNDN);
+ mpfr_fms (s, x, y, z, MPFR_RNDN);
if (!mpfr_inf_p (s) || mpfr_sgn (s) < 0)
{
printf ("evaluation of function in x=INF does not return INF");
@@ -502,7 +502,7 @@ main (int argc, char *argv[])
mpfr_set_inf (y, 1);
mpfr_urandomb (x, RANDS);
mpfr_urandomb (z, RANDS);
- mpfr_fms (s, x, y, z, GMP_RNDN);
+ mpfr_fms (s, x, y, z, MPFR_RNDN);
if (!mpfr_inf_p (s) || mpfr_sgn (s) < 0)
{
printf ("evaluation of function in y=INF does not return INF");
@@ -512,29 +512,29 @@ main (int argc, char *argv[])
mpfr_set_inf (z, -1);
mpfr_urandomb (x, RANDS);
mpfr_urandomb (y, RANDS);
- mpfr_fms (s, x, y, z, GMP_RNDN);
+ mpfr_fms (s, x, y, z, MPFR_RNDN);
if (!mpfr_inf_p (s) || mpfr_sgn (s) < 0)
{
printf ("evaluation of function in z=-INF does not return INF");
exit (1);
}
- mpfr_set_ui (x, 0, GMP_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
mpfr_urandomb (y, RANDS);
mpfr_urandomb (z, RANDS);
- mpfr_fms (s, x, y, z, GMP_RNDN);
- mpfr_neg (z, z, GMP_RNDN);
+ mpfr_fms (s, x, y, z, MPFR_RNDN);
+ mpfr_neg (z, z, MPFR_RNDN);
if (mpfr_cmp (s, z))
{
printf ("evaluation of function in x=0 does not return -z\n");
exit (1);
}
- mpfr_set_ui (y, 0, GMP_RNDN);
+ mpfr_set_ui (y, 0, MPFR_RNDN);
mpfr_urandomb (x, RANDS);
mpfr_urandomb (z, RANDS);
- mpfr_fms (s, x, y, z, GMP_RNDN);
- mpfr_neg (z, z, GMP_RNDN);
+ mpfr_fms (s, x, y, z, MPFR_RNDN);
+ mpfr_neg (z, z, MPFR_RNDN);
if (mpfr_cmp (s, z))
{
printf ("evaluation of function in y=0 does not return -z\n");
@@ -570,11 +570,11 @@ main (int argc, char *argv[])
mpfr_urandomb (z, RANDS);
if (randlimb () % 2)
- mpfr_neg (x, x, GMP_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN);
if (randlimb () % 2)
- mpfr_neg (y, y, GMP_RNDN);
+ mpfr_neg (y, y, MPFR_RNDN);
if (randlimb () % 2)
- mpfr_neg (z, z, GMP_RNDN);
+ mpfr_neg (z, z, MPFR_RNDN);
rnd = RND_RAND ();
mpfr_set_prec (slong, 2 * prec);
@@ -588,18 +588,18 @@ main (int argc, char *argv[])
if (mpfr_cmp (s, t))
{
printf ("results differ for x=");
- mpfr_out_str (stdout, 2, prec, x, GMP_RNDN);
+ mpfr_out_str (stdout, 2, prec, x, MPFR_RNDN);
printf (" y=");
- mpfr_out_str (stdout, 2, prec, y, GMP_RNDN);
+ mpfr_out_str (stdout, 2, prec, y, MPFR_RNDN);
printf (" z=");
- mpfr_out_str (stdout, 2, prec, z, GMP_RNDN);
+ mpfr_out_str (stdout, 2, prec, z, MPFR_RNDN);
printf (" prec=%u rnd_mode=%s\n", (unsigned int) prec,
mpfr_print_rnd_mode (rnd));
printf ("got ");
- mpfr_out_str (stdout, 2, prec, s, GMP_RNDN);
+ mpfr_out_str (stdout, 2, prec, s, MPFR_RNDN);
puts ("");
printf ("expected ");
- mpfr_out_str (stdout, 2, prec, t, GMP_RNDN);
+ mpfr_out_str (stdout, 2, prec, t, MPFR_RNDN);
puts ("");
printf ("approx ");
mpfr_print_binary (slong);
@@ -612,10 +612,10 @@ main (int argc, char *argv[])
{
printf ("Wrong inexact flag for rnd=%s: expected %d, got %d\n",
mpfr_print_rnd_mode (rnd), compare, inexact);
- printf (" x="); mpfr_out_str (stdout, 2, 0, x, GMP_RNDN);
- printf (" y="); mpfr_out_str (stdout, 2, 0, y, GMP_RNDN);
- printf (" z="); mpfr_out_str (stdout, 2, 0, z, GMP_RNDN);
- printf (" s="); mpfr_out_str (stdout, 2, 0, s, GMP_RNDN);
+ printf (" x="); mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN);
+ printf (" y="); mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN);
+ printf (" z="); mpfr_out_str (stdout, 2, 0, z, MPFR_RNDN);
+ printf (" s="); mpfr_out_str (stdout, 2, 0, s, MPFR_RNDN);
printf ("\n");
exit (1);
}
diff --git a/tests/tfprintf.c b/tests/tfprintf.c
index 45fc4b4f3..3ba44a825 100644
--- a/tests/tfprintf.c
+++ b/tests/tfprintf.c
@@ -160,7 +160,7 @@ check_mixed (FILE *fout)
mpz_t mpz;
mpq_t mpq;
mpf_t mpf;
- mp_rnd_t rnd = GMP_RNDN;
+ mp_rnd_t rnd = MPFR_RNDN;
mp_size_t limb_size = 3;
mp_limb_t limb[3];
@@ -176,7 +176,7 @@ check_mixed (FILE *fout)
mpf_set_q (mpf, mpq);
mpfr_init2 (mpfr, prec);
- mpfr_set_f (mpfr, mpf, GMP_RNDN);
+ mpfr_set_f (mpfr, mpf, MPFR_RNDN);
limb[0] = limb[1] = limb[2] = ~ (mp_limb_t) 0;
diff --git a/tests/tfrac.c b/tests/tfrac.c
index 029e3506f..ae8501144 100644
--- a/tests/tfrac.c
+++ b/tests/tfrac.c
@@ -45,7 +45,7 @@ check0 (mpfr_ptr ip, mpfr_ptr fp, mp_prec_t prec, mp_rnd_t rnd)
printf ("Internal error (1)\n");
exit (1);
}
- if (mpfr_add (sum, ip, fp, GMP_RNDZ))
+ if (mpfr_add (sum, ip, fp, MPFR_RNDZ))
{
printf ("Wrong inexact flag in mpfr_add\n");
exit (1);
@@ -61,7 +61,7 @@ check0 (mpfr_ptr ip, mpfr_ptr fp, mp_prec_t prec, mp_rnd_t rnd)
if (inex1 != inex2)
{
printf ("Wrong inexact flag in mpfr_frac for\n");
- mpfr_out_str (stdout, 2, 0, sum, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, sum, MPFR_RNDN);
printf ("\nGot %d instead of %d\n", inex1, inex2);
exit (1);
}
@@ -71,11 +71,11 @@ check0 (mpfr_ptr ip, mpfr_ptr fp, mp_prec_t prec, mp_rnd_t rnd)
{
printf ("Error in mpfr_frac (y, x, %s) with\nx = ",
mpfr_print_rnd_mode (rnd));
- mpfr_out_str (stdout, 2, 0, sum, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, sum, MPFR_RNDN);
printf ("\nGot ");
- mpfr_out_str (stdout, 2, 0, dst, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, dst, MPFR_RNDN);
printf ("\ninstead of ");
- mpfr_out_str (stdout, 2, 0, fp2, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, fp2, MPFR_RNDN);
printf ("\n");
exit (1);
}
@@ -94,12 +94,12 @@ check0 (mpfr_ptr ip, mpfr_ptr fp, mp_prec_t prec, mp_rnd_t rnd)
{
printf ("Error in mpfr_frac (x, x, %s) with\nx = ",
mpfr_print_rnd_mode (rnd));
- mpfr_add (tmp, ip, fp, GMP_RNDZ);
- mpfr_out_str (stdout, 2, 0, tmp, GMP_RNDN);
+ mpfr_add (tmp, ip, fp, MPFR_RNDZ);
+ mpfr_out_str (stdout, 2, 0, tmp, MPFR_RNDN);
printf ("\nGot ");
- mpfr_out_str (stdout, 2, 0, sum, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, sum, MPFR_RNDN);
printf ("\ninstead of ");
- mpfr_out_str (stdout, 2, 0, fp, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, fp, MPFR_RNDN);
printf ("\n");
exit (1);
}
@@ -116,16 +116,16 @@ check1 (mpfr_ptr ip, mpfr_ptr fp)
{
int rnd;
- for (rnd = 0; rnd < GMP_RND_MAX ; rnd++)
+ for (rnd = 0; rnd < MPFR_RND_MAX ; rnd++)
{
check0 (ip, fp, PMAX, (mp_rnd_t) rnd);
check0 (ip, fp, 70, (mp_rnd_t) rnd);
- mpfr_neg (fp, fp, GMP_RNDN);
- mpfr_neg (ip, ip, GMP_RNDN);
+ mpfr_neg (fp, fp, MPFR_RNDN);
+ mpfr_neg (ip, ip, MPFR_RNDN);
check0 (ip, fp, PMAX, (mp_rnd_t) rnd);
check0 (ip, fp, 70, (mp_rnd_t) rnd);
- mpfr_neg (fp, fp, GMP_RNDN);
- mpfr_neg (ip, ip, GMP_RNDN);
+ mpfr_neg (fp, fp, MPFR_RNDN);
+ mpfr_neg (ip, ip, MPFR_RNDN);
}
}
@@ -138,7 +138,7 @@ special (void)
mpfr_init (t);
mpfr_set_nan (z);
- mpfr_frac (t, z, GMP_RNDN);
+ mpfr_frac (t, z, MPFR_RNDN);
if (!mpfr_nan_p (t))
{
printf ("Error for frac(NaN)\n");
@@ -149,7 +149,7 @@ special (void)
mpfr_set_prec (t, 3);
mpfr_set_str_binary (z, "0.101101E3");
- mpfr_frac (t, z, GMP_RNDN);
+ mpfr_frac (t, z, MPFR_RNDN);
mpfr_set_str_binary (z, "0.101");
if (mpfr_cmp (t, z))
{
@@ -160,7 +160,7 @@ special (void)
mpfr_set_prec (z, 34);
mpfr_set_prec (t, 26);
mpfr_set_str_binary (z, "0.101101010000010011110011001101E9");
- mpfr_frac (t, z, GMP_RNDN);
+ mpfr_frac (t, z, MPFR_RNDN);
mpfr_set_str_binary (z, "0.000010011110011001101");
if (mpfr_cmp (t, z))
{
@@ -192,36 +192,36 @@ main (void)
{
if (ni <= 0)
{ /* ni + 1 */
- mpfr_set_si (ip, ni, GMP_RNDN);
- mpfr_add_ui (ip, ip, 1, GMP_RNDN);
+ mpfr_set_si (ip, ni, MPFR_RNDN);
+ mpfr_add_ui (ip, ip, 1, MPFR_RNDN);
}
else
{ /* 2^ni + 1 */
- mpfr_set_ui (ip, 1, GMP_RNDN);
- mpfr_mul_2ui (ip, ip, ni, GMP_RNDN);
- mpfr_add_ui (ip, ip, 1, GMP_RNDN);
+ mpfr_set_ui (ip, 1, MPFR_RNDN);
+ mpfr_mul_2ui (ip, ip, ni, MPFR_RNDN);
+ mpfr_add_ui (ip, ip, 1, MPFR_RNDN);
}
- mpfr_set_ui (fp, 0, GMP_RNDN);
+ mpfr_set_ui (fp, 0, MPFR_RNDN);
check1 (ip, fp);
for (nf1 = 1; nf1 < PFP; nf1++)
{
- mpfr_set_ui (fp, 1, GMP_RNDN);
- mpfr_div_2ui (fp, fp, nf1, GMP_RNDN);
+ mpfr_set_ui (fp, 1, MPFR_RNDN);
+ mpfr_div_2ui (fp, fp, nf1, MPFR_RNDN);
check1 (ip, fp);
nf2 = 1 + (randlimb () % (PFP - 1));
- mpfr_set_ui (fp, 1, GMP_RNDN);
- mpfr_div_2ui (fp, fp, nf2, GMP_RNDN);
- mpfr_add_ui (fp, fp, 1, GMP_RNDN);
- mpfr_div_2ui (fp, fp, nf1, GMP_RNDN);
+ mpfr_set_ui (fp, 1, MPFR_RNDN);
+ mpfr_div_2ui (fp, fp, nf2, MPFR_RNDN);
+ mpfr_add_ui (fp, fp, 1, MPFR_RNDN);
+ mpfr_div_2ui (fp, fp, nf1, MPFR_RNDN);
check1 (ip, fp);
}
}
- mpfr_set_ui (ip, 1, GMP_RNDN);
- mpfr_div_ui (ip, ip, 0, GMP_RNDN);
- mpfr_set_ui (fp, 0, GMP_RNDN);
+ mpfr_set_ui (ip, 1, MPFR_RNDN);
+ mpfr_div_ui (ip, ip, 0, MPFR_RNDN);
+ mpfr_set_ui (fp, 0, MPFR_RNDN);
check1 (ip, fp); /* test infinities */
mpfr_clear (ip);
diff --git a/tests/tgamma.c b/tests/tgamma.c
index 8ccf10c89..54ee2e675 100644
--- a/tests/tgamma.c
+++ b/tests/tgamma.c
@@ -39,7 +39,7 @@ special (void)
mpfr_init (y);
mpfr_set_nan (x);
- mpfr_gamma (y, x, GMP_RNDN);
+ mpfr_gamma (y, x, MPFR_RNDN);
if (!mpfr_nan_p (y))
{
printf ("Error for gamma(NaN)\n");
@@ -47,7 +47,7 @@ special (void)
}
mpfr_set_inf (x, -1);
- mpfr_gamma (y, x, GMP_RNDN);
+ mpfr_gamma (y, x, MPFR_RNDN);
if (!mpfr_nan_p (y))
{
printf ("Error for gamma(-Inf)\n");
@@ -55,40 +55,40 @@ special (void)
}
mpfr_set_inf (x, 1);
- mpfr_gamma (y, x, GMP_RNDN);
+ mpfr_gamma (y, x, MPFR_RNDN);
if (!mpfr_inf_p (y) || mpfr_sgn (y) < 0)
{
printf ("Error for gamma(+Inf)\n");
exit (1);
}
- mpfr_set_ui (x, 0, GMP_RNDN);
- mpfr_gamma (y, x, GMP_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_gamma (y, x, MPFR_RNDN);
if (!mpfr_inf_p (y) || mpfr_sgn (y) < 0)
{
printf ("Error for gamma(+0)\n");
exit (1);
}
- mpfr_set_ui (x, 0, GMP_RNDN);
- mpfr_neg (x, x, GMP_RNDN);
- mpfr_gamma (y, x, GMP_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN);
+ mpfr_gamma (y, x, MPFR_RNDN);
if (!mpfr_inf_p (y) || mpfr_sgn (y) > 0)
{
printf ("Error for gamma(-0)\n");
exit (1);
}
- mpfr_set_ui (x, 1, GMP_RNDN);
- mpfr_gamma (y, x, GMP_RNDN);
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_gamma (y, x, MPFR_RNDN);
if (mpfr_cmp_ui (y, 1))
{
printf ("Error for gamma(1)\n");
exit (1);
}
- mpfr_set_si (x, -1, GMP_RNDN);
- mpfr_gamma (y, x, GMP_RNDN);
+ mpfr_set_si (x, -1, MPFR_RNDN);
+ mpfr_gamma (y, x, MPFR_RNDN);
if (!mpfr_nan_p (y))
{
printf ("Error for gamma(-1)\n");
@@ -101,9 +101,9 @@ special (void)
#define CHECK_X1 "1.0762904832837976166"
#define CHECK_Y1 "0.96134843256452096050"
- mpfr_set_str (x, CHECK_X1, 10, GMP_RNDN);
- mpfr_gamma (y, x, GMP_RNDN);
- mpfr_set_str (x, CHECK_Y1, 10, GMP_RNDN);
+ mpfr_set_str (x, CHECK_X1, 10, MPFR_RNDN);
+ mpfr_gamma (y, x, MPFR_RNDN);
+ mpfr_set_str (x, CHECK_Y1, 10, MPFR_RNDN);
if (mpfr_cmp (y, x))
{
printf ("mpfr_lngamma("CHECK_X1") is wrong:\n"
@@ -116,9 +116,9 @@ special (void)
#define CHECK_X2 "9.23709516716202383435e-01"
#define CHECK_Y2 "1.0502315560291053398"
- mpfr_set_str (x, CHECK_X2, 10, GMP_RNDN);
- mpfr_gamma (y, x, GMP_RNDN);
- mpfr_set_str (x, CHECK_Y2, 10, GMP_RNDN);
+ mpfr_set_str (x, CHECK_X2, 10, MPFR_RNDN);
+ mpfr_gamma (y, x, MPFR_RNDN);
+ mpfr_set_str (x, CHECK_Y2, 10, MPFR_RNDN);
if (mpfr_cmp (y, x))
{
printf ("mpfr_lngamma("CHECK_X2") is wrong:\n"
@@ -131,8 +131,8 @@ special (void)
mpfr_set_prec (x, 8);
mpfr_set_prec (y, 175);
- mpfr_set_ui (x, 33, GMP_RNDN);
- mpfr_gamma (y, x, GMP_RNDU);
+ mpfr_set_ui (x, 33, MPFR_RNDN);
+ mpfr_gamma (y, x, MPFR_RNDU);
mpfr_set_prec (x, 175);
mpfr_set_str_binary (x, "0.110010101011010101101000010101010111000110011101001000101011000001100010111001101001011E118");
if (mpfr_cmp (x, y))
@@ -143,8 +143,8 @@ special (void)
mpfr_set_prec (x, 21);
mpfr_set_prec (y, 8);
- mpfr_set_ui (y, 120, GMP_RNDN);
- mpfr_gamma (x, y, GMP_RNDZ);
+ mpfr_set_ui (y, 120, MPFR_RNDN);
+ mpfr_gamma (x, y, MPFR_RNDZ);
mpfr_set_prec (y, 21);
mpfr_set_str_binary (y, "0.101111101110100110110E654");
if (mpfr_cmp (x, y))
@@ -158,7 +158,7 @@ special (void)
mpfr_set_prec (x, 3);
mpfr_set_prec (y, 206);
mpfr_set_str_binary (x, "0.110e10");
- inex = mpfr_gamma (y, x, GMP_RNDN);
+ inex = mpfr_gamma (y, x, MPFR_RNDN);
mpfr_set_prec (x, 206);
mpfr_set_str_binary (x, "0.110111100001000001101010010001000111000100000100111000010011100011011111001100011110101000111101101100110001001100110100001001111110000101010000100100011100010011101110000001000010001100010000101001111E6250");
if (mpfr_cmp (x, y))
@@ -175,13 +175,13 @@ special (void)
/* worst case to exercise retry */
mpfr_set_prec (x, 1000);
mpfr_set_prec (y, 869);
- mpfr_const_pi (x, GMP_RNDN);
- mpfr_gamma (y, x, GMP_RNDN);
+ mpfr_const_pi (x, MPFR_RNDN);
+ mpfr_gamma (y, x, MPFR_RNDN);
mpfr_set_prec (x, 4);
mpfr_set_prec (y, 4);
mpfr_set_str_binary (x, "-0.1100E-66");
- mpfr_gamma (y, x, GMP_RNDN);
+ mpfr_gamma (y, x, MPFR_RNDN);
mpfr_set_str_binary (x, "-0.1011E67");
if (mpfr_cmp (x, y))
{
@@ -209,7 +209,7 @@ special_overflow (void)
mpfr_init2 (x, 24);
mpfr_init2 (y, 24);
mpfr_set_str_binary (x, "0.101100100000000000110100E7");
- mpfr_gamma (y, x, GMP_RNDN);
+ mpfr_gamma (y, x, MPFR_RNDN);
if (!mpfr_inf_p (y))
{
printf ("Overflow error.\n");
@@ -220,8 +220,8 @@ special_overflow (void)
/* problem mentioned by Kenneth Wilder, 18 Aug 2005 */
mpfr_set_prec (x, 29);
mpfr_set_prec (y, 29);
- mpfr_set_str (x, "-200000000.5", 10, GMP_RNDN); /* exact */
- mpfr_gamma (y, x, GMP_RNDN);
+ mpfr_set_str (x, "-200000000.5", 10, MPFR_RNDN); /* exact */
+ mpfr_gamma (y, x, MPFR_RNDN);
if (!(mpfr_zero_p (y) && MPFR_SIGN (y) < 0))
{
printf ("Error for gamma(-200000000.5)\n");
@@ -233,8 +233,8 @@ special_overflow (void)
mpfr_set_prec (x, 53);
mpfr_set_prec (y, 53);
- mpfr_set_str (x, "-200000000.1", 10, GMP_RNDN);
- mpfr_gamma (y, x, GMP_RNDN);
+ mpfr_set_str (x, "-200000000.1", 10, MPFR_RNDN);
+ mpfr_gamma (y, x, MPFR_RNDN);
if (!(mpfr_zero_p (y) && MPFR_SIGN (y) < 0))
{
printf ("Error for gamma(-200000000.1), prec=53\n");
@@ -247,8 +247,8 @@ special_overflow (void)
/* another problem mentioned by Kenneth Wilder, 29 Aug 2005 */
mpfr_set_prec (x, 333);
mpfr_set_prec (y, 14);
- mpfr_set_str (x, "-2.0000000000000000000000005", 10, GMP_RNDN);
- mpfr_gamma (y, x, GMP_RNDN);
+ mpfr_set_str (x, "-2.0000000000000000000000005", 10, MPFR_RNDN);
+ mpfr_gamma (y, x, MPFR_RNDN);
mpfr_set_prec (x, 14);
mpfr_set_str_binary (x, "-11010011110001E66");
if (mpfr_cmp (x, y))
@@ -265,7 +265,7 @@ special_overflow (void)
mpfr_set_prec (x, 38);
mpfr_set_prec (y, 54);
mpfr_set_str_binary (x, "0.11101111011100111101001001010110101001E-166");
- mpfr_gamma (y, x, GMP_RNDN);
+ mpfr_gamma (y, x, MPFR_RNDN);
mpfr_set_prec (x, 54);
mpfr_set_str_binary (x, "0.100010001101100001110110001010111111010000100101011E167");
if (mpfr_cmp (x, y))
@@ -282,7 +282,7 @@ special_overflow (void)
mpfr_set_prec (y, 71);
mpfr_set_str_binary (x, "10101011011100001111111000010111110010E-1034");
/* 184083777010*2^(-1034) */
- mpfr_gamma (y, x, GMP_RNDN);
+ mpfr_gamma (y, x, MPFR_RNDN);
mpfr_set_prec (x, 71);
mpfr_set_str_binary (x, "10111111001000011110010001000000000000110011110000000011101011111111100E926");
/* 1762885132679550982140*2^926 */
@@ -298,7 +298,7 @@ special_overflow (void)
mpfr_set_prec (y, 88);
mpfr_set_str_binary (x, "10111100111001010000100001100100100101E-104");
/* 202824096037*2^(-104) */
- mpfr_gamma (y, x, GMP_RNDN);
+ mpfr_gamma (y, x, MPFR_RNDN);
mpfr_set_prec (x, 88);
mpfr_set_str_binary (x, "1010110101111000111010111100010110101010100110111000001011000111000011101100001101110010E-21");
/* 209715199999500283894743922*2^(-21) */
@@ -313,12 +313,12 @@ special_overflow (void)
mpfr_set_prec (x, 171);
mpfr_set_prec (y, 38);
mpfr_set_str (x, "-2993155353253689176481146537402947624254601559176535", 10,
- GMP_RNDN);
- mpfr_div_2exp (x, x, 170, GMP_RNDN);
- mpfr_gamma (y, x, GMP_RNDN);
+ MPFR_RNDN);
+ mpfr_div_2exp (x, x, 170, MPFR_RNDN);
+ mpfr_gamma (y, x, MPFR_RNDN);
mpfr_set_prec (x, 38);
- mpfr_set_str (x, "201948391737", 10, GMP_RNDN);
- mpfr_mul_2exp (x, x, 92, GMP_RNDN);
+ mpfr_set_str (x, "201948391737", 10, MPFR_RNDN);
+ mpfr_mul_2exp (x, x, 92, MPFR_RNDN);
if (mpfr_cmp (x, y))
{
printf ("Error for gamma (test 5)\n");
@@ -331,10 +331,10 @@ special_overflow (void)
mpfr_set_prec (x, 337);
mpfr_set_prec (y, 38);
mpfr_set_str (x, "-30000.000000000000000000000000000000000000000000001", 10,
- GMP_RNDN);
- mpfr_gamma (y, x, GMP_RNDN);
+ MPFR_RNDN);
+ mpfr_gamma (y, x, MPFR_RNDN);
mpfr_set_prec (x, 38);
- mpfr_set_str (x, "-3.623795987425E-121243", 10, GMP_RNDN);
+ mpfr_set_str (x, "-3.623795987425E-121243", 10, MPFR_RNDN);
if (mpfr_cmp (x, y))
{
printf ("Error for gamma (test 7)\n");
@@ -347,8 +347,8 @@ special_overflow (void)
set_emin (emin);
mpfr_set_prec (x, 71);
mpfr_set_prec (y, 71);
- mpfr_set_str (x, "-200000000.1", 10, GMP_RNDN);
- mpfr_gamma (y, x, GMP_RNDN);
+ mpfr_set_str (x, "-200000000.1", 10, MPFR_RNDN);
+ mpfr_gamma (y, x, MPFR_RNDN);
if (!(mpfr_zero_p (y) && MPFR_SIGN (y) < 0))
{
printf ("Error for gamma (test 8)\n");
@@ -360,8 +360,8 @@ special_overflow (void)
set_emax (1073741823);
mpfr_set_prec (x, 29);
mpfr_set_prec (y, 29);
- mpfr_set_str (x, "423786866", 10, GMP_RNDN);
- mpfr_gamma (y, x, GMP_RNDN);
+ mpfr_set_str (x, "423786866", 10, MPFR_RNDN);
+ mpfr_gamma (y, x, MPFR_RNDN);
if (!mpfr_inf_p (y) || mpfr_sgn (y) < 0)
{
printf ("Error for gamma(423786866)\n");
@@ -370,8 +370,8 @@ special_overflow (void)
/* check exact result */
mpfr_set_prec (x, 2);
- mpfr_set_ui (x, 3, GMP_RNDN);
- inex = mpfr_gamma (x, x, GMP_RNDN);
+ mpfr_set_ui (x, 3, MPFR_RNDN);
+ inex = mpfr_gamma (x, x, MPFR_RNDN);
if (inex != 0 || mpfr_cmp_ui (x, 2) != 0)
{
printf ("Error for gamma(3)\n");
@@ -382,7 +382,7 @@ special_overflow (void)
mpfr_set_prec (x, 53);
mpfr_set_prec (y, 53);
mpfr_set_str_binary (x, "101010110100110011111010000110001000111100000110101E-43");
- mpfr_gamma (x, x, GMP_RNDU);
+ mpfr_gamma (x, x, MPFR_RNDU);
mpfr_set_str_binary (y, "110000011110001000111110110101011110000100001111111E971");
if (mpfr_cmp (x, y) != 0)
{
@@ -396,8 +396,8 @@ special_overflow (void)
set_emax (emax);
/* bug found by Kevin Rauch, 26 Oct 2007 */
- mpfr_set_str (x, "1e19", 10, GMP_RNDN);
- inex = mpfr_gamma (x, x, GMP_RNDN);
+ mpfr_set_str (x, "1e19", 10, MPFR_RNDN);
+ inex = mpfr_gamma (x, x, MPFR_RNDN);
MPFR_ASSERTN(mpfr_inf_p (x) && inex > 0);
mpfr_clear (y);
@@ -419,9 +419,9 @@ gamma_integer (void)
for (i = 0; i < 100; i++)
{
mpz_fac_ui (n, i);
- mpfr_set_ui (x, i+1, GMP_RNDN);
- mpfr_gamma (y, x, GMP_RNDN);
- mpfr_set_z (x, n, GMP_RNDN);
+ mpfr_set_ui (x, i+1, MPFR_RNDN);
+ mpfr_gamma (y, x, MPFR_RNDN);
+ mpfr_set_z (x, n, MPFR_RNDN);
if (!mpfr_equal_p (x, y))
{
printf ("Error for gamma(%u)\n", i+1);
@@ -447,16 +447,16 @@ test20071231 (void)
mpfr_set_emin (-1000000);
mpfr_init2 (x, 21);
- mpfr_set_str (x, "-1000001.5", 10, GMP_RNDN);
- inex = mpfr_gamma (x, x, GMP_RNDN);
+ mpfr_set_str (x, "-1000001.5", 10, MPFR_RNDN);
+ inex = mpfr_gamma (x, x, MPFR_RNDN);
MPFR_ASSERTN(MPFR_IS_ZERO(x) && MPFR_IS_POS(x) && inex < 0);
mpfr_clear (x);
mpfr_set_emin (emin);
mpfr_init2 (x, 53);
- mpfr_set_str (x, "-1000000001.5", 10, GMP_RNDN);
- inex = mpfr_gamma (x, x, GMP_RNDN);
+ mpfr_set_str (x, "-1000000001.5", 10, MPFR_RNDN);
+ inex = mpfr_gamma (x, x, MPFR_RNDN);
MPFR_ASSERTN(MPFR_IS_ZERO(x) && MPFR_IS_POS(x) && inex < 0);
mpfr_clear (x);
}
diff --git a/tests/tgeneric.c b/tests/tgeneric.c
index 24bfe1d9b..52dced7f2 100644
--- a/tests/tgeneric.c
+++ b/tests/tgeneric.c
@@ -50,12 +50,12 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
do \
{ \
printf ("%s\nx = ", (S)); \
- mpfr_out_str (stdout, 2, 0, (X), GMP_RNDN); \
+ mpfr_out_str (stdout, 2, 0, (X), MPFR_RNDN); \
printf ("\n"); \
if ((void *) U != 0) \
{ \
printf ("u = "); \
- mpfr_out_str (stdout, 2, 0, (U), GMP_RNDN); \
+ mpfr_out_str (stdout, 2, 0, (U), MPFR_RNDN); \
printf ("\n"); \
} \
printf ("yprec = %u, rnd_mode = %s, inexact = %d, flags = %u\n", \
@@ -82,12 +82,12 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
printf ("tgeneric: testing function " STR(F) \
", %s, target prec = %lu\nx = ", \
mpfr_print_rnd_mode (rnd), (unsigned long) (P)); \
- mpfr_out_str (stdout, 2, 0, (X), GMP_RNDN); \
+ mpfr_out_str (stdout, 2, 0, (X), MPFR_RNDN); \
printf ("\n"); \
if (U) \
{ \
printf ("u = "); \
- mpfr_out_str (stdout, 2, 0, (U), GMP_RNDN); \
+ mpfr_out_str (stdout, 2, 0, (U), MPFR_RNDN); \
printf ("\n"); \
} \
} \
@@ -184,10 +184,10 @@ test_generic (mp_prec_t p0, mp_prec_t p1, unsigned int N)
set_emax (MPFR_EMAX_MAX);
if (n <= 1)
{
- mpfr_set_si (x, n == 0 ? 1 : -1, GMP_RNDN);
+ mpfr_set_si (x, n == 0 ? 1 : -1, MPFR_RNDN);
mpfr_set_exp (x, mpfr_get_emin ());
#if defined(TWO_ARGS) || defined(DOUBLE_ARG1) || defined(DOUBLE_ARG2)
- mpfr_set_si (u, randlimb () % 2 == 0 ? 1 : -1, GMP_RNDN);
+ mpfr_set_si (u, randlimb () % 2 == 0 ? 1 : -1, MPFR_RNDN);
mpfr_set_exp (u, mpfr_get_emin ());
#endif
}
@@ -195,10 +195,10 @@ test_generic (mp_prec_t p0, mp_prec_t p1, unsigned int N)
{
if (getenv ("MPFR_CHECK_MAX") == NULL)
goto next_n;
- mpfr_set_si (x, n == 0 ? 1 : -1, GMP_RNDN);
+ mpfr_set_si (x, n == 0 ? 1 : -1, MPFR_RNDN);
mpfr_setmax (x, REDUCE_EMAX);
#if defined(TWO_ARGS) || defined(DOUBLE_ARG1) || defined(DOUBLE_ARG2)
- mpfr_set_si (u, randlimb () % 2 == 0 ? 1 : -1, GMP_RNDN);
+ mpfr_set_si (u, randlimb () % 2 == 0 ? 1 : -1, MPFR_RNDN);
mpfr_setmax (u, mpfr_get_emax ());
#endif
}
@@ -277,21 +277,21 @@ test_generic (mp_prec_t p0, mp_prec_t p1, unsigned int N)
if (mpfr_nan_p (z) || mpfr_cmp (t, z) != 0)
{
printf ("results differ for x=");
- mpfr_out_str (stdout, 2, xprec, x, GMP_RNDN);
+ mpfr_out_str (stdout, 2, xprec, x, MPFR_RNDN);
#ifdef TWO_ARGS
printf ("\nu=");
- mpfr_out_str (stdout, 2, xprec, u, GMP_RNDN);
+ mpfr_out_str (stdout, 2, xprec, u, MPFR_RNDN);
#elif defined(DOUBLE_ARG1) || defined(DOUBLE_ARG2)
printf ("\nu=");
- mpfr_out_str (stdout, 2, IEEE_DBL_MANT_DIG, u, GMP_RNDN);
+ mpfr_out_str (stdout, 2, IEEE_DBL_MANT_DIG, u, MPFR_RNDN);
#endif
printf (" prec=%u rnd_mode=%s\n", (unsigned) prec,
mpfr_print_rnd_mode (rnd));
printf ("got ");
- mpfr_out_str (stdout, 2, prec, z, GMP_RNDN);
+ mpfr_out_str (stdout, 2, prec, z, MPFR_RNDN);
puts ("");
printf ("expected ");
- mpfr_out_str (stdout, 2, prec, t, GMP_RNDN);
+ mpfr_out_str (stdout, 2, prec, t, MPFR_RNDN);
puts ("");
printf ("approx ");
mpfr_print_binary (y);
diff --git a/tests/tgeneric_ui.c b/tests/tgeneric_ui.c
index 643376a7b..0f3ec72f0 100644
--- a/tests/tgeneric_ui.c
+++ b/tests/tgeneric_ui.c
@@ -61,7 +61,7 @@ test_generic_ui (mp_prec_t p0, mp_prec_t p1, unsigned int N)
else
{
/* Special cases tested in precision p1 if n <= 1. */
- mpfr_set_si (x, n == 0 ? 1 : -1, GMP_RNDN);
+ mpfr_set_si (x, n == 0 ? 1 : -1, MPFR_RNDN);
mpfr_set_exp (x, mpfr_get_emin ());
}
u = INT_RAND_FUNCTION ();
@@ -75,7 +75,7 @@ test_generic_ui (mp_prec_t p0, mp_prec_t p1, unsigned int N)
if (mpfr_cmp (t, z))
{
printf ("results differ for x=");
- mpfr_out_str (stdout, 2, prec, x, GMP_RNDN);
+ mpfr_out_str (stdout, 2, prec, x, MPFR_RNDN);
printf ("\nu=%lu", (unsigned long) u);
printf (" prec=%lu rnd_mode=%s\n",
(unsigned long ) prec, mpfr_print_rnd_mode (rnd));
@@ -83,10 +83,10 @@ test_generic_ui (mp_prec_t p0, mp_prec_t p1, unsigned int N)
printf ("Function: %s\n", TEST_FUNCTION_NAME);
#endif
printf ("got ");
- mpfr_out_str (stdout, 2, prec, z, GMP_RNDN);
+ mpfr_out_str (stdout, 2, prec, z, MPFR_RNDN);
puts ("");
printf ("expected ");
- mpfr_out_str (stdout, 2, prec, t, GMP_RNDN);
+ mpfr_out_str (stdout, 2, prec, t, MPFR_RNDN);
puts ("");
printf ("approx ");
mpfr_print_binary (y);
diff --git a/tests/tget_d.c b/tests/tget_d.c
index cda82af93..3c4466fbf 100644
--- a/tests/tget_d.c
+++ b/tests/tget_d.c
@@ -42,13 +42,13 @@ check_denorms (void)
mpfr_init2 (x, BITS_PER_MP_LIMB);
- rnd_mode = GMP_RNDN;
+ rnd_mode = MPFR_RNDN;
for (k = -17; k <= 17; k += 2)
{
d = (double) k * dbl_min; /* k * 2^(-1022) */
f = 1.0;
- mpfr_set_si (x, k, GMP_RNDN);
- mpfr_div_2exp (x, x, 1022, GMP_RNDN); /* k * 2^(-1022) */
+ mpfr_set_si (x, k, MPFR_RNDN);
+ mpfr_div_2exp (x, x, 1022, MPFR_RNDN); /* k * 2^(-1022) */
for (n = 0; n <= 58; n++)
{
d2 = d * f;
@@ -61,7 +61,7 @@ check_denorms (void)
fail = 1;
}
f *= 0.5;
- mpfr_div_2exp (x, x, 1, GMP_RNDN);
+ mpfr_div_2exp (x, x, 1, MPFR_RNDN);
}
}
@@ -80,17 +80,17 @@ check_inf_nan (void)
mpfr_init2 (x, 123);
mpfr_set_inf (x, 1);
- d = mpfr_get_d (x, GMP_RNDZ);
+ d = mpfr_get_d (x, MPFR_RNDZ);
ASSERT_ALWAYS (d > 0);
ASSERT_ALWAYS (DOUBLE_ISINF (d));
mpfr_set_inf (x, -1);
- d = mpfr_get_d (x, GMP_RNDZ);
+ d = mpfr_get_d (x, MPFR_RNDZ);
ASSERT_ALWAYS (d < 0);
ASSERT_ALWAYS (DOUBLE_ISINF (d));
mpfr_set_nan (x);
- d = mpfr_get_d (x, GMP_RNDZ);
+ d = mpfr_get_d (x, MPFR_RNDZ);
ASSERT_ALWAYS (DOUBLE_ISNAN (d));
mpfr_clear (x);
@@ -107,7 +107,7 @@ check_max (void)
while (d < (DBL_MAX / 2.0))
d += d;
mpfr_init (u);
- if (mpfr_set_d (u, d, GMP_RNDN) == 0)
+ if (mpfr_set_d (u, d, MPFR_RNDN) == 0)
{
/* If setting is exact */
e = (mpfr_get_d1) (u);
@@ -119,23 +119,23 @@ check_max (void)
}
mpfr_set_str_binary (u, "-1E1024");
- d = mpfr_get_d (u, GMP_RNDZ);
+ d = mpfr_get_d (u, MPFR_RNDZ);
MPFR_ASSERTN(d == -DBL_MAX);
- d = mpfr_get_d (u, GMP_RNDU);
+ d = mpfr_get_d (u, MPFR_RNDU);
MPFR_ASSERTN(d == -DBL_MAX);
- d = mpfr_get_d (u, GMP_RNDN);
+ d = mpfr_get_d (u, MPFR_RNDN);
MPFR_ASSERTN(DOUBLE_ISINF(d) && d < 0.0);
- d = mpfr_get_d (u, GMP_RNDD);
+ d = mpfr_get_d (u, MPFR_RNDD);
MPFR_ASSERTN(DOUBLE_ISINF(d) && d < 0.0);
mpfr_set_str_binary (u, "1E1024");
- d = mpfr_get_d (u, GMP_RNDZ);
+ d = mpfr_get_d (u, MPFR_RNDZ);
MPFR_ASSERTN(d == DBL_MAX);
- d = mpfr_get_d (u, GMP_RNDD);
+ d = mpfr_get_d (u, MPFR_RNDD);
MPFR_ASSERTN(d == DBL_MAX);
- d = mpfr_get_d (u, GMP_RNDN);
+ d = mpfr_get_d (u, MPFR_RNDN);
MPFR_ASSERTN(DOUBLE_ISINF(d) && d > 0.0);
- d = mpfr_get_d (u, GMP_RNDU);
+ d = mpfr_get_d (u, MPFR_RNDU);
MPFR_ASSERTN(DOUBLE_ISINF(d) && d > 0.0);
mpfr_clear (u);
@@ -149,7 +149,7 @@ check_min(void)
d = 1.0; while (d > (DBL_MIN * 2.0)) d /= 2.0;
mpfr_init(u);
- if (mpfr_set_d(u, d, GMP_RNDN) == 0)
+ if (mpfr_set_d(u, d, MPFR_RNDN) == 0)
{
/* If setting is exact */
e = mpfr_get_d1(u);
diff --git a/tests/tget_d_2exp.c b/tests/tget_d_2exp.c
index 595d14c6b..309304790 100644
--- a/tests/tget_d_2exp.c
+++ b/tests/tget_d_2exp.c
@@ -40,13 +40,13 @@ check_round (void)
mpfr_init2 (f, 1024L);
- for (rnd_mode = 0; rnd_mode < GMP_RND_MAX ; rnd_mode++)
+ for (rnd_mode = 0; rnd_mode < MPFR_RND_MAX ; rnd_mode++)
{
for (i = 0; i < (int) numberof (data); i++)
{
- mpfr_set_ui (f, 1L, GMP_RNDZ);
- mpfr_mul_2exp (f, f, data[i], GMP_RNDZ);
- mpfr_sub_ui (f, f, 1L, GMP_RNDZ);
+ mpfr_set_ui (f, 1L, MPFR_RNDZ);
+ mpfr_mul_2exp (f, f, data[i], MPFR_RNDZ);
+ mpfr_sub_ui (f, f, 1L, MPFR_RNDZ);
for (neg = 0; neg <= 1; neg++)
{
@@ -61,14 +61,14 @@ check_round (void)
printf (" rnd_mode = %d\n", rnd_mode);
printf (" data[i] = %lu\n", data[i]);
printf (" f ");
- mpfr_out_str (stdout, 2, 0, f, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, f, MPFR_RNDN);
printf ("\n");
d_trace (" got ", got);
printf (" got exp %ld\n", got_exp);
exit(1);
}
- mpfr_neg (f, f, GMP_RNDZ);
+ mpfr_neg (f, f, MPFR_RNDZ);
}
}
}
@@ -89,17 +89,17 @@ check_inf_nan (void)
mpfr_init2 (x, 123);
mpfr_set_inf (x, 1);
- d = mpfr_get_d_2exp (&exp, x, GMP_RNDZ);
+ d = mpfr_get_d_2exp (&exp, x, MPFR_RNDZ);
ASSERT_ALWAYS (d > 0);
ASSERT_ALWAYS (DOUBLE_ISINF (d));
mpfr_set_inf (x, -1);
- d = mpfr_get_d_2exp (&exp, x, GMP_RNDZ);
+ d = mpfr_get_d_2exp (&exp, x, MPFR_RNDZ);
ASSERT_ALWAYS (d < 0);
ASSERT_ALWAYS (DOUBLE_ISINF (d));
mpfr_set_nan (x);
- d = mpfr_get_d_2exp (&exp, x, GMP_RNDZ);
+ d = mpfr_get_d_2exp (&exp, x, MPFR_RNDZ);
ASSERT_ALWAYS (DOUBLE_ISNAN (d));
mpfr_clear (x);
diff --git a/tests/tget_f.c b/tests/tget_f.c
index 5e9714f4c..c42dbce98 100644
--- a/tests/tget_f.c
+++ b/tests/tget_f.c
@@ -49,23 +49,23 @@ prec_test (void)
mpf_init (x1);
mpf_init (x2);
mpf_init (x3);
- mpfr_set_ui_2exp (y1, 1, py - 1, GMP_RNDN);
- mpfr_get_f (x1, y1, GMP_RNDN); /* exact (power of 2) */
+ mpfr_set_ui_2exp (y1, 1, py - 1, MPFR_RNDN);
+ mpfr_get_f (x1, y1, MPFR_RNDN); /* exact (power of 2) */
mpf_set (x2, x1);
- mpfr_set (y2, y1, GMP_RNDN);
+ mpfr_set (y2, y1, MPFR_RNDN);
for (e = py - 2; e >= 0; e--)
{
int inex;
mpf_div_2exp (x2, x2, 1);
mpf_add (x1, x1, x2);
- mpfr_div_2exp (y2, y2, 1, GMP_RNDN);
- inex = mpfr_add (y1, y1, y2, GMP_RNDN);
+ mpfr_div_2exp (y2, y2, 1, MPFR_RNDN);
+ inex = mpfr_add (y1, y1, y2, MPFR_RNDN);
MPFR_ASSERTN (inex == 0);
- mpfr_set_f (y3, x1, GMP_RNDN);
+ mpfr_set_f (y3, x1, MPFR_RNDN);
if (! mpfr_equal_p (y1, y3))
break;
- mpfr_get_f (x3, y3, GMP_RNDN);
+ mpfr_get_f (x3, y3, MPFR_RNDN);
if (mpf_cmp (x1, x3) != 0)
{
printf ("Error in prec_test (px = %d, py = %d, e = %d)\n",
@@ -106,36 +106,36 @@ main (void)
mpf_init (x);
mpfr_set_nan (y);
- if (mpfr_get_f (x, y, GMP_RNDN) == 0)
+ if (mpfr_get_f (x, y, MPFR_RNDN) == 0)
{
printf ("Error: mpfr_get_f(NaN) should fail\n");
exit (1);
}
mpfr_set_inf (y, 1);
- if (mpfr_get_f (x, y, GMP_RNDN) == 0)
+ if (mpfr_get_f (x, y, MPFR_RNDN) == 0)
{
printf ("Error: mpfr_get_f(+Inf) should fail\n");
exit (1);
}
mpfr_set_inf (y, -1);
- if (mpfr_get_f (x, y, GMP_RNDN) == 0)
+ if (mpfr_get_f (x, y, MPFR_RNDN) == 0)
{
printf ("Error: mpfr_get_f(-Inf) should fail\n");
exit (1);
}
- mpfr_set_ui (y, 0, GMP_RNDN);
- if (mpfr_get_f (x, y, GMP_RNDN) || mpf_cmp_ui (x, 0))
+ mpfr_set_ui (y, 0, MPFR_RNDN);
+ if (mpfr_get_f (x, y, MPFR_RNDN) || mpf_cmp_ui (x, 0))
{
printf ("Error: mpfr_get_f(+0) fails\n");
exit (1);
}
- mpfr_set_ui (y, 0, GMP_RNDN);
- mpfr_neg (y, y, GMP_RNDN);
- if (mpfr_get_f (x, y, GMP_RNDN) || mpf_cmp_ui (x, 0))
+ mpfr_set_ui (y, 0, MPFR_RNDN);
+ mpfr_neg (y, y, MPFR_RNDN);
+ if (mpfr_get_f (x, y, MPFR_RNDN) || mpf_cmp_ui (x, 0))
{
printf ("Error: mpfr_get_f(-0) fails\n");
exit (1);
@@ -144,8 +144,8 @@ main (void)
i = 1;
while (i)
{
- mpfr_set_ui (y, i, GMP_RNDN);
- if (mpfr_get_f (x, y, GMP_RNDN) || mpf_cmp_ui (x, i))
+ mpfr_set_ui (y, i, MPFR_RNDN);
+ if (mpfr_get_f (x, y, MPFR_RNDN) || mpf_cmp_ui (x, i))
{
printf ("Error: mpfr_get_f(%lu) fails\n", i);
exit (1);
@@ -153,8 +153,8 @@ main (void)
if (i <= - (unsigned long) LONG_MIN)
{
long j = i < - (unsigned long) LONG_MIN ? - (long) i : LONG_MIN;
- mpfr_set_si (y, j, GMP_RNDN);
- if (mpfr_get_f (x, y, GMP_RNDN) || mpf_cmp_si (x, j))
+ mpfr_set_si (y, j, MPFR_RNDN);
+ if (mpfr_get_f (x, y, MPFR_RNDN) || mpf_cmp_si (x, j))
{
printf ("Error: mpfr_get_f(-%lu) fails\n", i);
exit (1);
@@ -169,14 +169,14 @@ main (void)
i = 1;
while (i)
{
- mpfr_set_ui (y, i, GMP_RNDN);
- if (mpfr_get_f (x, y, GMP_RNDN) || mpf_cmp_ui (x, i))
+ mpfr_set_ui (y, i, MPFR_RNDN);
+ if (mpfr_get_f (x, y, MPFR_RNDN) || mpf_cmp_ui (x, i))
{
printf ("Error: mpfr_get_f(%lu) fails\n", i);
exit (1);
}
- mpfr_set_si (y, (signed long) -i, GMP_RNDN);
- if (mpfr_get_f (x, y, GMP_RNDN) || mpf_cmp_si (x, (signed long) -i))
+ mpfr_set_si (y, (signed long) -i, MPFR_RNDN);
+ if (mpfr_get_f (x, y, MPFR_RNDN) || mpf_cmp_si (x, (signed long) -i))
{
printf ("Error: mpfr_get_f(-%lu) fails\n", i);
exit (1);
@@ -188,13 +188,13 @@ main (void)
for (e = 0; e <= 2 * BITS_PER_MP_LIMB; e++)
{
/* test with 2^(-e) */
- mpfr_set_ui (y, 1, GMP_RNDN);
- mpfr_div_2exp (y, y, e, GMP_RNDN);
- mpfr_get_f (x, y, GMP_RNDN);
+ mpfr_set_ui (y, 1, MPFR_RNDN);
+ mpfr_div_2exp (y, y, e, MPFR_RNDN);
+ mpfr_get_f (x, y, MPFR_RNDN);
mpf_mul_2exp (x, x, e);
if (mpf_cmp_ui (x, 1) != 0)
{
- printf ("Error: mpfr_get_f(x,y,GMP_RNDN) fails\n");
+ printf ("Error: mpfr_get_f(x,y,MPFR_RNDN) fails\n");
printf ("y=");
mpfr_dump (y);
printf ("x=");
@@ -204,13 +204,13 @@ main (void)
}
/* test with 2^(e) */
- mpfr_set_ui (y, 1, GMP_RNDN);
- mpfr_mul_2exp (y, y, e, GMP_RNDN);
- mpfr_get_f (x, y, GMP_RNDN);
+ mpfr_set_ui (y, 1, MPFR_RNDN);
+ mpfr_mul_2exp (y, y, e, MPFR_RNDN);
+ mpfr_get_f (x, y, MPFR_RNDN);
mpf_div_2exp (x, x, e);
if (mpf_cmp_ui (x, 1) != 0)
{
- printf ("Error: mpfr_get_f(x,y,GMP_RNDN) fails\n");
+ printf ("Error: mpfr_get_f(x,y,MPFR_RNDN) fails\n");
printf ("y=");
mpfr_dump (y);
printf ("x=");
@@ -224,9 +224,9 @@ main (void)
mpfr_set_prec (y, 32);
mpfr_set_prec (z, 32);
mpf_set_prec (x, 32);
- mpfr_set_ui_2exp (y, 0xc1234567, -30, GMP_RNDN);
- mpfr_get_f (x, y, GMP_RNDN);
- inex = mpfr_set_f (z, x, GMP_RNDN);
+ mpfr_set_ui_2exp (y, 0xc1234567, -30, MPFR_RNDN);
+ mpfr_get_f (x, y, MPFR_RNDN);
+ inex = mpfr_set_f (z, x, MPFR_RNDN);
if (inex || ! mpfr_equal_p (y, z))
{
printf ("Error in mpfr_get_f:\n inex = %d, y = ", inex);
diff --git a/tests/tget_ld_2exp.c b/tests/tget_ld_2exp.c
index 119ed7ecf..b39fee40c 100644
--- a/tests/tget_ld_2exp.c
+++ b/tests/tget_ld_2exp.c
@@ -40,13 +40,13 @@ check_round (void)
mpfr_init2 (f, 1024L);
- for (rnd_mode = 0; rnd_mode < GMP_RND_MAX ; rnd_mode++)
+ for (rnd_mode = 0; rnd_mode < MPFR_RND_MAX ; rnd_mode++)
{
for (i = 0; i < (int) numberof (data); i++)
{
- mpfr_set_ui (f, 1L, GMP_RNDZ);
- mpfr_mul_2exp (f, f, data[i], GMP_RNDZ);
- mpfr_sub_ui (f, f, 1L, GMP_RNDZ);
+ mpfr_set_ui (f, 1L, MPFR_RNDZ);
+ mpfr_mul_2exp (f, f, data[i], MPFR_RNDZ);
+ mpfr_sub_ui (f, f, 1L, MPFR_RNDZ);
for (neg = 0; neg <= 1; neg++)
{
@@ -61,14 +61,14 @@ check_round (void)
printf (" rnd_mode = %d\n", rnd_mode);
printf (" data[i] = %lu\n", data[i]);
printf (" f ");
- mpfr_out_str (stdout, 2, 0, f, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, f, MPFR_RNDN);
printf ("\n");
d_trace (" got ", got);
printf (" got exp %ld\n", got_exp);
exit(1);
}
- mpfr_neg (f, f, GMP_RNDZ);
+ mpfr_neg (f, f, MPFR_RNDZ);
}
}
}
@@ -89,17 +89,17 @@ check_inf_nan (void)
mpfr_init2 (x, 123);
mpfr_set_inf (x, 1);
- d = (double) mpfr_get_ld_2exp (&exp, x, GMP_RNDZ);
+ d = (double) mpfr_get_ld_2exp (&exp, x, MPFR_RNDZ);
ASSERT_ALWAYS (d > 0);
ASSERT_ALWAYS (DOUBLE_ISINF (d));
mpfr_set_inf (x, -1);
- d = (double) mpfr_get_ld_2exp (&exp, x, GMP_RNDZ);
+ d = (double) mpfr_get_ld_2exp (&exp, x, MPFR_RNDZ);
ASSERT_ALWAYS (d < 0);
ASSERT_ALWAYS (DOUBLE_ISINF (d));
mpfr_set_nan (x);
- d = (double) mpfr_get_ld_2exp (&exp, x, GMP_RNDZ);
+ d = (double) mpfr_get_ld_2exp (&exp, x, MPFR_RNDZ);
ASSERT_ALWAYS (DOUBLE_ISNAN (d));
mpfr_clear (x);
diff --git a/tests/tget_set_d64.c b/tests/tget_set_d64.c
index 5b7473898..a3186f9e3 100644
--- a/tests/tget_set_d64.c
+++ b/tests/tget_set_d64.c
@@ -58,107 +58,107 @@ check_inf_nan (void)
mpfr_init2 (y, 123);
mpfr_set_nan (x);
- d = mpfr_get_decimal64 (x, GMP_RNDZ);
- mpfr_set_ui (x, 1, GMP_RNDZ);
- mpfr_set_decimal64 (x, d, GMP_RNDZ);
+ d = mpfr_get_decimal64 (x, MPFR_RNDZ);
+ mpfr_set_ui (x, 1, MPFR_RNDZ);
+ mpfr_set_decimal64 (x, d, MPFR_RNDZ);
ASSERT_ALWAYS (mpfr_nan_p (x));
mpfr_set_inf (x, 1);
- d = mpfr_get_decimal64 (x, GMP_RNDZ);
- mpfr_set_ui (x, 1, GMP_RNDZ);
- mpfr_set_decimal64 (x, d, GMP_RNDZ);
+ d = mpfr_get_decimal64 (x, MPFR_RNDZ);
+ mpfr_set_ui (x, 1, MPFR_RNDZ);
+ mpfr_set_decimal64 (x, d, MPFR_RNDZ);
ASSERT_ALWAYS (mpfr_inf_p (x) && mpfr_sgn (x) > 0);
mpfr_set_inf (x, -1);
- d = mpfr_get_decimal64 (x, GMP_RNDZ);
- mpfr_set_ui (x, 1, GMP_RNDZ);
- mpfr_set_decimal64 (x, d, GMP_RNDZ);
+ d = mpfr_get_decimal64 (x, MPFR_RNDZ);
+ mpfr_set_ui (x, 1, MPFR_RNDZ);
+ mpfr_set_decimal64 (x, d, MPFR_RNDZ);
ASSERT_ALWAYS (mpfr_inf_p (x) && mpfr_sgn (x) < 0);
- mpfr_set_ui (x, 0, GMP_RNDZ);
- d = mpfr_get_decimal64 (x, GMP_RNDZ);
- mpfr_set_ui (x, 1, GMP_RNDZ);
- mpfr_set_decimal64 (x, d, GMP_RNDZ);
+ mpfr_set_ui (x, 0, MPFR_RNDZ);
+ d = mpfr_get_decimal64 (x, MPFR_RNDZ);
+ mpfr_set_ui (x, 1, MPFR_RNDZ);
+ mpfr_set_decimal64 (x, d, MPFR_RNDZ);
ASSERT_ALWAYS (mpfr_cmp_ui (x, 0) == 0 && MPFR_SIGN (x) > 0);
- mpfr_set_ui (x, 0, GMP_RNDZ);
- mpfr_neg (x, x, GMP_RNDZ);
- d = mpfr_get_decimal64 (x, GMP_RNDZ);
- mpfr_set_ui (x, 1, GMP_RNDZ);
- mpfr_set_decimal64 (x, d, GMP_RNDZ);
+ mpfr_set_ui (x, 0, MPFR_RNDZ);
+ mpfr_neg (x, x, MPFR_RNDZ);
+ d = mpfr_get_decimal64 (x, MPFR_RNDZ);
+ mpfr_set_ui (x, 1, MPFR_RNDZ);
+ mpfr_set_decimal64 (x, d, MPFR_RNDZ);
ASSERT_ALWAYS (mpfr_cmp_ui (x, 0) == 0 && MPFR_SIGN (x) < 0);
- mpfr_set_ui (x, 1, GMP_RNDZ);
- d = mpfr_get_decimal64 (x, GMP_RNDZ);
- mpfr_set_ui (x, 0, GMP_RNDZ);
- mpfr_set_decimal64 (x, d, GMP_RNDZ);
+ mpfr_set_ui (x, 1, MPFR_RNDZ);
+ d = mpfr_get_decimal64 (x, MPFR_RNDZ);
+ mpfr_set_ui (x, 0, MPFR_RNDZ);
+ mpfr_set_decimal64 (x, d, MPFR_RNDZ);
ASSERT_ALWAYS (mpfr_cmp_ui (x, 1) == 0);
- mpfr_set_si (x, -1, GMP_RNDZ);
- d = mpfr_get_decimal64 (x, GMP_RNDZ);
- mpfr_set_ui (x, 0, GMP_RNDZ);
- mpfr_set_decimal64 (x, d, GMP_RNDZ);
+ mpfr_set_si (x, -1, MPFR_RNDZ);
+ d = mpfr_get_decimal64 (x, MPFR_RNDZ);
+ mpfr_set_ui (x, 0, MPFR_RNDZ);
+ mpfr_set_decimal64 (x, d, MPFR_RNDZ);
ASSERT_ALWAYS (mpfr_cmp_si (x, -1) == 0);
- mpfr_set_ui (x, 2, GMP_RNDZ);
- d = mpfr_get_decimal64 (x, GMP_RNDZ);
- mpfr_set_ui (x, 0, GMP_RNDZ);
- mpfr_set_decimal64 (x, d, GMP_RNDZ);
+ mpfr_set_ui (x, 2, MPFR_RNDZ);
+ d = mpfr_get_decimal64 (x, MPFR_RNDZ);
+ mpfr_set_ui (x, 0, MPFR_RNDZ);
+ mpfr_set_decimal64 (x, d, MPFR_RNDZ);
ASSERT_ALWAYS (mpfr_cmp_ui (x, 2) == 0);
- mpfr_set_ui (x, 99, GMP_RNDZ);
- d = mpfr_get_decimal64 (x, GMP_RNDZ);
- mpfr_set_ui (x, 0, GMP_RNDZ);
- mpfr_set_decimal64 (x, d, GMP_RNDZ);
+ mpfr_set_ui (x, 99, MPFR_RNDZ);
+ d = mpfr_get_decimal64 (x, MPFR_RNDZ);
+ mpfr_set_ui (x, 0, MPFR_RNDZ);
+ mpfr_set_decimal64 (x, d, MPFR_RNDZ);
ASSERT_ALWAYS (mpfr_cmp_ui (x, 99) == 0);
- mpfr_set_str (x, "9999999999999999", 10, GMP_RNDZ);
- mpfr_set (y, x, GMP_RNDZ);
- d = mpfr_get_decimal64 (x, GMP_RNDZ);
- mpfr_set_ui (x, 0, GMP_RNDZ);
- mpfr_set_decimal64 (x, d, GMP_RNDZ);
+ mpfr_set_str (x, "9999999999999999", 10, MPFR_RNDZ);
+ mpfr_set (y, x, MPFR_RNDZ);
+ d = mpfr_get_decimal64 (x, MPFR_RNDZ);
+ mpfr_set_ui (x, 0, MPFR_RNDZ);
+ mpfr_set_decimal64 (x, d, MPFR_RNDZ);
ASSERT_ALWAYS (mpfr_cmp (x, y) == 0);
/* smallest normal number */
- mpfr_set_str (x, "1E-383", 10, GMP_RNDU);
- mpfr_set (y, x, GMP_RNDZ);
- d = mpfr_get_decimal64 (x, GMP_RNDZ);
- mpfr_set_ui (x, 0, GMP_RNDZ);
- mpfr_set_decimal64 (x, d, GMP_RNDU);
+ mpfr_set_str (x, "1E-383", 10, MPFR_RNDU);
+ mpfr_set (y, x, MPFR_RNDZ);
+ d = mpfr_get_decimal64 (x, MPFR_RNDZ);
+ mpfr_set_ui (x, 0, MPFR_RNDZ);
+ mpfr_set_decimal64 (x, d, MPFR_RNDU);
ASSERT_ALWAYS (mpfr_cmp (x, y) == 0);
/* smallest subnormal number */
- mpfr_set_str (x, "1E-398", 10, GMP_RNDU);
- mpfr_set (y, x, GMP_RNDZ);
- d = mpfr_get_decimal64 (x, GMP_RNDZ);
- mpfr_set_ui (x, 0, GMP_RNDZ);
- mpfr_set_decimal64 (x, d, GMP_RNDU);
+ mpfr_set_str (x, "1E-398", 10, MPFR_RNDU);
+ mpfr_set (y, x, MPFR_RNDZ);
+ d = mpfr_get_decimal64 (x, MPFR_RNDZ);
+ mpfr_set_ui (x, 0, MPFR_RNDZ);
+ mpfr_set_decimal64 (x, d, MPFR_RNDU);
ASSERT_ALWAYS (mpfr_cmp (x, y) == 0);
/* subnormal number with exponent change when we round back
from 16 digits to 1 digit */
- mpfr_set_str (x, "9.9E-398", 10, GMP_RNDN);
- d = mpfr_get_decimal64 (x, GMP_RNDU); /* should be 1E-397 */
- mpfr_set_ui (x, 0, GMP_RNDZ);
- mpfr_set_decimal64 (x, d, GMP_RNDD);
- mpfr_set_str (y, "1E-397", 10, GMP_RNDN);
+ mpfr_set_str (x, "9.9E-398", 10, MPFR_RNDN);
+ d = mpfr_get_decimal64 (x, MPFR_RNDU); /* should be 1E-397 */
+ mpfr_set_ui (x, 0, MPFR_RNDZ);
+ mpfr_set_decimal64 (x, d, MPFR_RNDD);
+ mpfr_set_str (y, "1E-397", 10, MPFR_RNDN);
ASSERT_ALWAYS (mpfr_cmp (x, y) == 0);
/* largest number */
- mpfr_set_str (x, "9.999999999999999E384", 10, GMP_RNDZ);
- mpfr_set (y, x, GMP_RNDZ);
- d = mpfr_get_decimal64 (x, GMP_RNDU);
- mpfr_set_ui (x, 0, GMP_RNDZ);
- mpfr_set_decimal64 (x, d, GMP_RNDZ);
+ mpfr_set_str (x, "9.999999999999999E384", 10, MPFR_RNDZ);
+ mpfr_set (y, x, MPFR_RNDZ);
+ d = mpfr_get_decimal64 (x, MPFR_RNDU);
+ mpfr_set_ui (x, 0, MPFR_RNDZ);
+ mpfr_set_decimal64 (x, d, MPFR_RNDZ);
ASSERT_ALWAYS (mpfr_cmp (x, y) == 0);
mpfr_set_prec (x, 53);
mpfr_set_prec (y, 53);
/* largest number */
- mpfr_set_str (x, "9.999999999999999E384", 10, GMP_RNDZ);
- d = mpfr_get_decimal64 (x, GMP_RNDZ);
- mpfr_set_decimal64 (y, d, GMP_RNDU);
+ mpfr_set_str (x, "9.999999999999999E384", 10, MPFR_RNDZ);
+ d = mpfr_get_decimal64 (x, MPFR_RNDZ);
+ mpfr_set_decimal64 (y, d, MPFR_RNDU);
ASSERT_ALWAYS (mpfr_cmp (x, y) == 0);
mpfr_clear (x);
@@ -179,11 +179,11 @@ check_random (void)
{
mpfr_urandomb (x, RANDS); /* 0 <= x < 1 */
/* the normal decimal64 range contains [2^(-1272), 2^1278] */
- mpfr_mul_2si (x, x, (i % 2550) - 1272, GMP_RNDN);
+ mpfr_mul_2si (x, x, (i % 2550) - 1272, MPFR_RNDN);
if (mpfr_get_exp (x) <= -1272)
- mpfr_mul_2exp (x, x, -1271 - mpfr_get_exp (x), GMP_RNDN);
- d = mpfr_get_decimal64 (x, GMP_RNDN);
- mpfr_set_decimal64 (y, d, GMP_RNDN);
+ mpfr_mul_2exp (x, x, -1271 - mpfr_get_exp (x), MPFR_RNDN);
+ d = mpfr_get_decimal64 (x, MPFR_RNDN);
+ mpfr_set_decimal64 (y, d, MPFR_RNDN);
if (mpfr_cmp (x, y) != 0)
{
printf ("x="); mpfr_dump (x);
@@ -207,18 +207,18 @@ check_native (void)
mpfr_init2 (x, 53);
/* check important constants are correctly converted */
- mpfr_set_ui (x, 17, GMP_RNDN);
- d = mpfr_get_decimal64 (x, GMP_RNDN);
+ mpfr_set_ui (x, 17, MPFR_RNDN);
+ d = mpfr_get_decimal64 (x, MPFR_RNDN);
MPFR_ASSERTN(d == 17.0dd);
- mpfr_set_ui (x, 42, GMP_RNDN);
- d = mpfr_get_decimal64 (x, GMP_RNDN);
+ mpfr_set_ui (x, 42, MPFR_RNDN);
+ d = mpfr_get_decimal64 (x, MPFR_RNDN);
MPFR_ASSERTN(d == 42.0dd);
- mpfr_set_decimal64 (x, 17.0dd, GMP_RNDN);
+ mpfr_set_decimal64 (x, 17.0dd, MPFR_RNDN);
MPFR_ASSERTN(mpfr_cmp_ui (x, 17) == 0);
- mpfr_set_decimal64 (x, 42.0dd, GMP_RNDN);
+ mpfr_set_decimal64 (x, 42.0dd, MPFR_RNDN);
MPFR_ASSERTN(mpfr_cmp_ui (x, 42) == 0);
mpfr_clear (x);
diff --git a/tests/tget_sj.c b/tests/tget_sj.c
index 44142a17b..7f918aad6 100644
--- a/tests/tget_sj.c
+++ b/tests/tget_sj.c
@@ -65,21 +65,21 @@ check_sj (intmax_t s, mpfr_ptr x)
{
int rnd;
- mpfr_set_si_2exp (y, i, -2, GMP_RNDN);
- mpfr_add (y, y, x, GMP_RNDN);
- for (rnd = 0; rnd < GMP_RND_MAX; rnd++)
+ mpfr_set_si_2exp (y, i, -2, MPFR_RNDN);
+ mpfr_add (y, y, x, MPFR_RNDN);
+ for (rnd = 0; rnd < MPFR_RND_MAX; rnd++)
{
intmax_t r;
- if (rnd == GMP_RNDZ && i < 0 && s >= 0)
+ if (rnd == MPFR_RNDZ && i < 0 && s >= 0)
continue;
- if (rnd == GMP_RNDZ && i > 0 && s <= 0)
+ if (rnd == MPFR_RNDZ && i > 0 && s <= 0)
continue;
- if (rnd == GMP_RNDD && i < 0)
+ if (rnd == MPFR_RNDD && i < 0)
continue;
- if (rnd == GMP_RNDU && i > 0)
+ if (rnd == MPFR_RNDU && i > 0)
continue;
- if (rnd == GMP_RNDA && ((MPFR_IS_POS(y) && i > 0) ||
+ if (rnd == MPFR_RNDA && ((MPFR_IS_POS(y) && i > 0) ||
(MPFR_IS_NEG(y) && i < 0)))
continue;
/* rint (y) == x == s */
@@ -87,7 +87,7 @@ check_sj (intmax_t s, mpfr_ptr x)
if (r != s)
{
printf ("Error in check_sj for y = ");
- mpfr_out_str (stdout, 2, 0, y, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN);
printf (" in %s\n", mpfr_print_rnd_mode ((mp_rnd_t) rnd));
printf ("Got %jd instead of %jd.\n", r, s);
exit (1);
@@ -110,19 +110,19 @@ check_uj (uintmax_t u, mpfr_ptr x)
{
int rnd;
- mpfr_set_si_2exp (y, i, -2, GMP_RNDN);
- mpfr_add (y, y, x, GMP_RNDN);
- for (rnd = 0; rnd < GMP_RND_MAX; rnd++)
+ mpfr_set_si_2exp (y, i, -2, MPFR_RNDN);
+ mpfr_add (y, y, x, MPFR_RNDN);
+ for (rnd = 0; rnd < MPFR_RND_MAX; rnd++)
{
uintmax_t r;
- if (rnd == GMP_RNDZ && i < 0)
+ if (rnd == MPFR_RNDZ && i < 0)
continue;
- if (rnd == GMP_RNDD && i < 0)
+ if (rnd == MPFR_RNDD && i < 0)
continue;
- if (rnd == GMP_RNDU && i > 0)
+ if (rnd == MPFR_RNDU && i > 0)
continue;
- if (rnd == GMP_RNDA && ((MPFR_IS_POS(y) && i > 0) ||
+ if (rnd == MPFR_RNDA && ((MPFR_IS_POS(y) && i > 0) ||
(MPFR_IS_NEG(y) && i < 0)))
continue;
/* rint (y) == x == u */
@@ -130,7 +130,7 @@ check_uj (uintmax_t u, mpfr_ptr x)
if (r != u)
{
printf ("Error in check_uj for y = ");
- mpfr_out_str (stdout, 2, 0, y, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN);
printf (" in %s\n", mpfr_print_rnd_mode ((mp_rnd_t) rnd));
printf ("Got %ju instead of %ju.\n", r, u);
exit (1);
@@ -151,54 +151,54 @@ check_erange (void)
/* Test for ERANGE flag + correct behaviour if overflow */
mpfr_init2 (x, 256);
- mpfr_set_uj (x, UINTMAX_MAX, GMP_RNDN);
+ mpfr_set_uj (x, UINTMAX_MAX, MPFR_RNDN);
mpfr_clear_erangeflag ();
- dl = mpfr_get_uj (x, GMP_RNDN);
+ dl = mpfr_get_uj (x, MPFR_RNDN);
if (dl != UINTMAX_MAX || mpfr_erangeflag_p ())
{
printf ("ERROR for get_uj + ERANGE + UINTMAX_MAX (1)\n");
exit (1);
}
- mpfr_add_ui (x, x, 1, GMP_RNDN);
- dl = mpfr_get_uj (x, GMP_RNDN);
+ mpfr_add_ui (x, x, 1, MPFR_RNDN);
+ dl = mpfr_get_uj (x, MPFR_RNDN);
if (dl != UINTMAX_MAX || !mpfr_erangeflag_p ())
{
printf ("ERROR for get_uj + ERANGE + UINTMAX_MAX (2)\n");
exit (1);
}
- mpfr_set_sj (x, -1, GMP_RNDN);
+ mpfr_set_sj (x, -1, MPFR_RNDN);
mpfr_clear_erangeflag ();
- dl = mpfr_get_uj (x, GMP_RNDN);
+ dl = mpfr_get_uj (x, MPFR_RNDN);
if (dl != 0 || !mpfr_erangeflag_p ())
{
printf ("ERROR for get_uj + ERANGE + -1 \n");
exit (1);
}
- mpfr_set_sj (x, INTMAX_MAX, GMP_RNDN);
+ mpfr_set_sj (x, INTMAX_MAX, MPFR_RNDN);
mpfr_clear_erangeflag ();
- d = mpfr_get_sj (x, GMP_RNDN);
+ d = mpfr_get_sj (x, MPFR_RNDN);
if (d != INTMAX_MAX || mpfr_erangeflag_p ())
{
printf ("ERROR for get_sj + ERANGE + INTMAX_MAX (1)\n");
exit (1);
}
- mpfr_add_ui (x, x, 1, GMP_RNDN);
- d = mpfr_get_sj (x, GMP_RNDN);
+ mpfr_add_ui (x, x, 1, MPFR_RNDN);
+ d = mpfr_get_sj (x, MPFR_RNDN);
if (d != INTMAX_MAX || !mpfr_erangeflag_p ())
{
printf ("ERROR for get_sj + ERANGE + INTMAX_MAX (2)\n");
exit (1);
}
- mpfr_set_sj (x, INTMAX_MIN, GMP_RNDN);
+ mpfr_set_sj (x, INTMAX_MIN, MPFR_RNDN);
mpfr_clear_erangeflag ();
- d = mpfr_get_sj (x, GMP_RNDN);
+ d = mpfr_get_sj (x, MPFR_RNDN);
if (d != INTMAX_MIN || mpfr_erangeflag_p ())
{
printf ("ERROR for get_sj + ERANGE + INTMAX_MIN (1)\n");
exit (1);
}
- mpfr_sub_ui (x, x, 1, GMP_RNDN);
- d = mpfr_get_sj (x, GMP_RNDN);
+ mpfr_sub_ui (x, x, 1, MPFR_RNDN);
+ d = mpfr_get_sj (x, MPFR_RNDN);
if (d != INTMAX_MIN || !mpfr_erangeflag_p ())
{
printf ("ERROR for get_sj + ERANGE + INTMAX_MIN (2)\n");
@@ -224,38 +224,38 @@ main (void)
mpfr_init2 (x, prec + 4);
mpfr_init2 (y, prec + 4);
- mpfr_set_ui (x, 0, GMP_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
check_sj (0, x);
check_uj (0, x);
- mpfr_set_si_2exp (x, 1, prec, GMP_RNDN);
- mpfr_sub_ui (x, x, 1, GMP_RNDN); /* UINTMAX_MAX */
+ mpfr_set_si_2exp (x, 1, prec, MPFR_RNDN);
+ mpfr_sub_ui (x, x, 1, MPFR_RNDN); /* UINTMAX_MAX */
- mpfr_div_ui (y, x, 2, GMP_RNDZ);
+ mpfr_div_ui (y, x, 2, MPFR_RNDZ);
mpfr_trunc (y, y); /* INTMAX_MAX */
for (s = INTMAX_MAX; s != 0; s /= 17)
{
check_sj (s, y);
- mpfr_div_ui (y, y, 17, GMP_RNDZ);
+ mpfr_div_ui (y, y, 17, MPFR_RNDZ);
mpfr_trunc (y, y);
}
- mpfr_div_ui (y, x, 2, GMP_RNDZ);
+ mpfr_div_ui (y, x, 2, MPFR_RNDZ);
mpfr_trunc (y, y); /* INTMAX_MAX */
- mpfr_neg (y, y, GMP_RNDN);
+ mpfr_neg (y, y, MPFR_RNDN);
if (INTMAX_MIN + INTMAX_MAX != 0)
- mpfr_sub_ui (y, y, 1, GMP_RNDN); /* INTMAX_MIN */
+ mpfr_sub_ui (y, y, 1, MPFR_RNDN); /* INTMAX_MIN */
for (s = INTMAX_MIN; s != 0; s /= 17)
{
check_sj (s, y);
- mpfr_div_ui (y, y, 17, GMP_RNDZ);
+ mpfr_div_ui (y, y, 17, MPFR_RNDZ);
mpfr_trunc (y, y);
}
for (u = UINTMAX_MAX; u != 0; u /= 17)
{
check_uj (u, x);
- mpfr_div_ui (x, x, 17, GMP_RNDZ);
+ mpfr_div_ui (x, x, 17, MPFR_RNDZ);
mpfr_trunc (x, x);
}
diff --git a/tests/tget_str.c b/tests/tget_str.c
index 245ab42c1..6ef6e6075 100644
--- a/tests/tget_str.c
+++ b/tests/tget_str.c
@@ -57,9 +57,9 @@ check_small (void)
mpfr_init (x);
mpfr_set_prec (x, 20);
- mpfr_set_ui (x, 2, GMP_RNDN);
+ mpfr_set_ui (x, 2, MPFR_RNDN);
mpfr_nexttozero (x);
- s = mpfr_get_str (NULL, &e, 4, 2, x, GMP_RNDU);
+ s = mpfr_get_str (NULL, &e, 4, 2, x, MPFR_RNDU);
if (strcmp (s, "20") || (e != 1))
{
printf ("Error in mpfr_get_str: 2- rounded up with 2 digits"
@@ -70,18 +70,18 @@ check_small (void)
/* check n_digits=0 */
mpfr_set_prec (x, 5);
- mpfr_set_ui (x, 17, GMP_RNDN);
- s = mpfr_get_str (NULL, &e, 3, 0, x, GMP_RNDN);
+ mpfr_set_ui (x, 17, MPFR_RNDN);
+ s = mpfr_get_str (NULL, &e, 3, 0, x, MPFR_RNDN);
mpfr_free_str (s);
- s = mpfr_get_str (NULL, &e, 36, 0, x, GMP_RNDN);
+ s = mpfr_get_str (NULL, &e, 36, 0, x, MPFR_RNDN);
mpfr_free_str (s);
mpfr_set_prec (x, 64);
- mpfr_set_si (x, -1, GMP_RNDN);
- mpfr_div_2exp (x, x, 63, GMP_RNDN); /* x = -2^(-63) */
- mpfr_add_ui (x, x, 1, GMP_RNDN); /* x = 1 - 2^(-63) */
- mpfr_mul_2exp (x, x, 32, GMP_RNDN); /* x = 2^32 - 2^(-31) */
- s = mpfr_get_str (NULL, &e, 3, 21, x, GMP_RNDU);
+ mpfr_set_si (x, -1, MPFR_RNDN);
+ mpfr_div_2exp (x, x, 63, MPFR_RNDN); /* x = -2^(-63) */
+ mpfr_add_ui (x, x, 1, MPFR_RNDN); /* x = 1 - 2^(-63) */
+ mpfr_mul_2exp (x, x, 32, MPFR_RNDN); /* x = 2^32 - 2^(-31) */
+ s = mpfr_get_str (NULL, &e, 3, 21, x, MPFR_RNDU);
if (strcmp (s, "102002022201221111211") || (e != 21))
{
printf ("Error in mpfr_get_str: 2^32-2^(-31) rounded up with"
@@ -89,7 +89,7 @@ check_small (void)
exit (1);
}
mpfr_free_str (s);
- s = mpfr_get_str (NULL, &e, 3, 20, x, GMP_RNDU);
+ s = mpfr_get_str (NULL, &e, 3, 20, x, MPFR_RNDU);
if (strcmp (s, "10200202220122111122") || (e != 21))
{
printf ("Error in mpfr_get_str: 2^32-2^(-31) rounded up with"
@@ -101,7 +101,7 @@ check_small (void)
/* check corner case ret!=0, j0!=0 in mpfr_get_str_aux */
mpfr_set_prec (x, 100);
mpfr_set_str_binary (x, "0.1001011111010001101110010101010101111001010111111101101101100110100011110110000101110110001011110000E-9");
- s = mpfr_get_str (NULL, &e, 3, 2, x, GMP_RNDU);
+ s = mpfr_get_str (NULL, &e, 3, 2, x, MPFR_RNDU);
if (strcmp (s, "22") || (e != -6))
{
printf ("Error in mpfr_get_str: 100-bit number rounded up with"
@@ -113,7 +113,7 @@ check_small (void)
/* check corner case exact=0 in mpfr_get_str_aux */
mpfr_set_prec (x, 100);
mpfr_set_str_binary (x, "0.1001001111101101111000101000110111111010101100000110010001111111011001101011101100001100110000000000E8");
- s = mpfr_get_str (NULL, &e, 10, 2, x, GMP_RNDZ);
+ s = mpfr_get_str (NULL, &e, 10, 2, x, MPFR_RNDZ);
if (strcmp (s, "14") || (e != 3))
{
printf ("Error in mpfr_get_str: 100-bit number rounded to zero with"
@@ -125,9 +125,9 @@ check_small (void)
for (p=4; p<=200; p++)
{
mpfr_set_prec (x, p);
- mpfr_set_str (x, "6.5", 10, GMP_RNDN);
+ mpfr_set_str (x, "6.5", 10, MPFR_RNDN);
- s = mpfr_get_str (NULL, &e, 6, 2, x, GMP_RNDN);
+ s = mpfr_get_str (NULL, &e, 6, 2, x, MPFR_RNDN);
if (strcmp (s, "10") || (e != 2))
{
printf ("Error in mpfr_get_str: 6.5 rounded to nearest with"
@@ -137,7 +137,7 @@ check_small (void)
mpfr_free_str (s);
mpfr_nexttoinf (x);
- s = mpfr_get_str (NULL, &e, 6, 2, x, GMP_RNDN);
+ s = mpfr_get_str (NULL, &e, 6, 2, x, MPFR_RNDN);
if (strcmp (s, "11") || (e != 2))
{
printf ("Error in mpfr_get_str: 6.5+ rounded to nearest with"
@@ -147,9 +147,9 @@ check_small (void)
}
mpfr_free_str (s);
- mpfr_set_str (x, "6.5", 10, GMP_RNDN);
+ mpfr_set_str (x, "6.5", 10, MPFR_RNDN);
mpfr_nexttozero (x);
- s = mpfr_get_str (NULL, &e, 6, 2, x, GMP_RNDN);
+ s = mpfr_get_str (NULL, &e, 6, 2, x, MPFR_RNDN);
if (strcmp (s, "10") || (e != 2))
{
printf ("Error in mpfr_get_str: 6.5- rounded to nearest with"
@@ -160,8 +160,8 @@ check_small (void)
}
mpfr_set_prec (x, 3);
- mpfr_set_ui (x, 7, GMP_RNDN);
- s = mpfr_get_str (NULL, &e, 2, 2, x, GMP_RNDU);
+ mpfr_set_ui (x, 7, MPFR_RNDN);
+ s = mpfr_get_str (NULL, &e, 2, 2, x, MPFR_RNDU);
if (strcmp (s, "10") || (e != 4))
{
printf ("Error in mpfr_get_str: 7 rounded up with 2 bits should"
@@ -172,19 +172,19 @@ check_small (void)
/* problem found by Fabrice Rouillier */
mpfr_set_prec (x, 63);
- mpfr_set_str (x, "5e14", 10, GMP_RNDN);
- s = mpfr_get_str (NULL, &e, 10, 18, x, GMP_RNDU);
+ mpfr_set_str (x, "5e14", 10, MPFR_RNDN);
+ s = mpfr_get_str (NULL, &e, 10, 18, x, MPFR_RNDU);
mpfr_free_str (s);
/* bug found by Johan Vervloet */
mpfr_set_prec (x, 6);
- mpfr_set_str (x, "688.0", 10, GMP_RNDN);
- s = mpfr_get_str (NULL, &e, 2, 4, x, GMP_RNDU);
+ mpfr_set_str (x, "688.0", 10, MPFR_RNDN);
+ s = mpfr_get_str (NULL, &e, 2, 4, x, MPFR_RNDU);
if (strcmp (s, "1011") || (e != 10))
{
printf ("Error in mpfr_get_str: 688 printed up to 4 bits should"
" give 1.011e9\ninstead of ");
- mpfr_out_str (stdout, 2, 4, x, GMP_RNDU);
+ mpfr_out_str (stdout, 2, 4, x, MPFR_RNDU);
puts ("");
exit (1);
}
@@ -192,7 +192,7 @@ check_small (void)
mpfr_set_prec (x, 38);
mpfr_set_str_binary (x, "1.0001110111110100011010100010010100110e-6");
- s = mpfr_get_str (NULL, &e, 8, 10, x, GMP_RNDU);
+ s = mpfr_get_str (NULL, &e, 8, 10, x, MPFR_RNDU);
if (strcmp (s, "1073721522") || (e != -1))
{
printf ("Error in mpfr_get_str (3): s=%s e=%d\n", s, (int) e);
@@ -202,7 +202,7 @@ check_small (void)
mpfr_set_prec (x, 53);
mpfr_set_str_binary (x, "0.11010111011101100010000100010101110001000000010111001E454");
- s = mpfr_get_str (NULL, &e, 19, 12, x, GMP_RNDU);
+ s = mpfr_get_str (NULL, &e, 19, 12, x, MPFR_RNDU);
if (strcmp (s, "b1cgfa4gha0h") || (e != 107))
{
printf ("Error in mpfr_get_str (4): s=%s e=%d\n", s, (int) e);
@@ -212,7 +212,7 @@ check_small (void)
mpfr_set_prec (x, 145);
mpfr_set_str_binary (x, "-0.1000110011000001011000010101101010110110101100101110100011111100011110011001001001010000100001000011000011000000010111011001000111101001110100110e6");
- s = mpfr_get_str (NULL, &e, 4, 53, x, GMP_RNDU);
+ s = mpfr_get_str (NULL, &e, 4, 53, x, MPFR_RNDU);
if (strcmp (s, "-20303001120111222312230232203330132121021100201003003") || (e != 3))
{
printf ("Error in mpfr_get_str (5): s=%s e=%d\n", s, (int) e);
@@ -222,7 +222,7 @@ check_small (void)
mpfr_set_prec (x, 45);
mpfr_set_str_binary (x, "-0.00100111010110010001011001110111010001010010010");
- s = mpfr_get_str (NULL, &e, 32, 9, x, GMP_RNDN);
+ s = mpfr_get_str (NULL, &e, 32, 9, x, MPFR_RNDN);
if (strcmp (s, "-4tchctq54") || (e != 0))
{
printf ("Error in mpfr_get_str (6): s=%s e=%d\n", s, (int) e);
@@ -233,7 +233,7 @@ check_small (void)
/* worst case found by Vincent Lefe`vre */
mpfr_set_prec (x, 53);
mpfr_set_str_binary (x, "10011110111100000000001011011110101100010000011011111E164");
- s = mpfr_get_str (NULL, &e, 10, 17, x, GMP_RNDN);
+ s = mpfr_get_str (NULL, &e, 10, 17, x, MPFR_RNDN);
if (strcmp (s, "13076622631878654") || (e != 66))
{
printf ("Error in mpfr_get_str (7): s=%s e=%d\n", s, (int) e);
@@ -241,7 +241,7 @@ check_small (void)
}
mpfr_free_str (s);
mpfr_set_str_binary (x, "10000001001001001100011101010011011011111000011000100E93");
- s = mpfr_get_str (NULL, &e, 10, 2, x, GMP_RNDU);
+ s = mpfr_get_str (NULL, &e, 10, 2, x, MPFR_RNDU);
if (strcmp (s, "46") || e != 44)
{
printf ("Error in mpfr_get_str (8): s=%s e=%d\n", s, (int) e);
@@ -249,7 +249,7 @@ check_small (void)
}
mpfr_free_str (s);
mpfr_set_str_binary (x, "10010001111100000111001111010101001010000010111010101E55");
- s = mpfr_get_str (NULL, &e, 10, 2, x, GMP_RNDN);
+ s = mpfr_get_str (NULL, &e, 10, 2, x, MPFR_RNDN);
if (strcmp (s, "19") || e != 33)
{
printf ("Error in mpfr_get_str (9): s=%s e=%d\n", s, (int) e);
@@ -257,7 +257,7 @@ check_small (void)
}
mpfr_free_str (s);
mpfr_set_str_binary (x, "11011001010010111110010101101100111110111000010110110E44");
- s = mpfr_get_str (NULL, &e, 10, 3, x, GMP_RNDN);
+ s = mpfr_get_str (NULL, &e, 10, 3, x, MPFR_RNDN);
if (strcmp (s, "135") || e != 30)
{
printf ("Error in mpfr_get_str (10): s=%s e=%d\n", s, (int) e);
@@ -265,7 +265,7 @@ check_small (void)
}
mpfr_free_str (s);
mpfr_set_str_binary (x, "11101111101000001011100001111000011111101111011001100E72");
- s = mpfr_get_str (NULL, &e, 10, 4, x, GMP_RNDN);
+ s = mpfr_get_str (NULL, &e, 10, 4, x, MPFR_RNDN);
if (strcmp (s, "3981") || e != 38)
{
printf ("Error in mpfr_get_str (11): s=%s e=%d\n", s, (int) e);
@@ -273,7 +273,7 @@ check_small (void)
}
mpfr_free_str (s);
mpfr_set_str_binary (x, "10011001001100100010111100001101110101001001111110000E46");
- s = mpfr_get_str (NULL, &e, 10, 5, x, GMP_RNDN);
+ s = mpfr_get_str (NULL, &e, 10, 5, x, MPFR_RNDN);
if (strcmp (s, "37930") || e != 30)
{
printf ("Error in mpfr_get_str (12): s=%s e=%d\n", s, (int) e);
@@ -281,7 +281,7 @@ check_small (void)
}
mpfr_free_str (s);
mpfr_set_str_binary (x, "10001100110111001011011110011011011101100011010001011E-72");
- s = mpfr_get_str (NULL, &e, 10, 6, x, GMP_RNDN);
+ s = mpfr_get_str (NULL, &e, 10, 6, x, MPFR_RNDN);
if (strcmp (s, "104950") || e != -5)
{
printf ("Error in mpfr_get_str (13): s=%s e=%d\n", s, (int) e);
@@ -290,7 +290,7 @@ check_small (void)
mpfr_free_str (s);
mpfr_set_str_binary (x, "10100100001011001000011001101101000110100110000010111E89");
- s = mpfr_get_str (NULL, &e, 10, 7, x, GMP_RNDN);
+ s = mpfr_get_str (NULL, &e, 10, 7, x, MPFR_RNDN);
if (strcmp (s, "3575392") || e != 43)
{
printf ("Error in mpfr_get_str (14): s=%s e=%d\n", s, (int) e);
@@ -299,7 +299,7 @@ check_small (void)
mpfr_free_str (s);
mpfr_set_str_binary (x, "11000011011110110010100110001010000001010011001011001E-73");
- s = mpfr_get_str (NULL, &e, 10, 8, x, GMP_RNDN);
+ s = mpfr_get_str (NULL, &e, 10, 8, x, MPFR_RNDN);
if (strcmp (s, "72822386") || e != -6)
{
printf ("Error in mpfr_get_str (15): s=%s e=%d\n", s, (int) e);
@@ -308,7 +308,7 @@ check_small (void)
mpfr_free_str (s);
mpfr_set_str_binary (x, "10101010001101000111001100001000100011100010010001010E78");
- s = mpfr_get_str (NULL, &e, 10, 9, x, GMP_RNDN);
+ s = mpfr_get_str (NULL, &e, 10, 9, x, MPFR_RNDN);
if (strcmp (s, "180992873") || e != 40)
{
printf ("Error in mpfr_get_str (16): s=%s e=%d\n", s, (int) e);
@@ -317,7 +317,7 @@ check_small (void)
mpfr_free_str (s);
mpfr_set_str_binary (x, "10110111001000100000001101111001100101101110011011101E91");
- s = mpfr_get_str (NULL, &e, 10, 10, x, GMP_RNDN);
+ s = mpfr_get_str (NULL, &e, 10, 10, x, MPFR_RNDN);
if (strcmp (s, "1595312255") || e != 44)
{
printf ("Error in mpfr_get_str (17): s=%s e=%d\n", s, (int) e);
@@ -325,7 +325,7 @@ check_small (void)
}
mpfr_free_str (s);
mpfr_set_str_binary (x, "10011101010111101111000100111011101011110100110110101E93");
- s = mpfr_get_str (NULL, &e, 10, 11, x, GMP_RNDN);
+ s = mpfr_get_str (NULL, &e, 10, 11, x, MPFR_RNDN);
if (strcmp (s, "54835744350") || e != 44)
{
printf ("Error in mpfr_get_str (18): s=%s e=%d\n", s, (int) e);
@@ -333,7 +333,7 @@ check_small (void)
}
mpfr_free_str (s);
mpfr_set_str_binary (x, "10011101010111101111000100111011101011110100110110101E92");
- s = mpfr_get_str (NULL, &e, 10, 12, x, GMP_RNDN);
+ s = mpfr_get_str (NULL, &e, 10, 12, x, MPFR_RNDN);
if (strcmp (s, "274178721752") || e != 44)
{
printf ("Error in mpfr_get_str (19): s=%s e=%d\n", s, (int) e);
@@ -341,7 +341,7 @@ check_small (void)
}
mpfr_free_str (s);
mpfr_set_str_binary (x, "10011101010111101111000100111011101011110100110110101E91");
- s = mpfr_get_str (NULL, &e, 10, 13, x, GMP_RNDN);
+ s = mpfr_get_str (NULL, &e, 10, 13, x, MPFR_RNDN);
if (strcmp (s, "1370893608762") || e != 44)
{
printf ("Error in mpfr_get_str (20): s=%s e=%d\n", s, (int) e);
@@ -350,7 +350,7 @@ check_small (void)
mpfr_free_str (s);
mpfr_set_str_binary (x, "10010011010110011100010010100101100011101000011111111E92");
- s = mpfr_get_str (NULL, &e, 10, 14, x, GMP_RNDN);
+ s = mpfr_get_str (NULL, &e, 10, 14, x, MPFR_RNDN);
if (strcmp (s, "25672105101864") || e != 44)
{
printf ("Error in mpfr_get_str (21): s=%s e=%d\n", s, (int) e);
@@ -359,7 +359,7 @@ check_small (void)
mpfr_free_str (s);
mpfr_set_str_binary (x, "100110111110110001000101110100100101101000011111001E87");
- s = mpfr_get_str (NULL, &e, 10, 15, x, GMP_RNDN);
+ s = mpfr_get_str (NULL, &e, 10, 15, x, MPFR_RNDN);
if (strcmp (s, "212231308858721") || e != 42)
{
printf ("Error in mpfr_get_str (22): s=%s e=%d\n", s, (int) e);
@@ -367,7 +367,7 @@ check_small (void)
}
mpfr_free_str (s);
mpfr_set_str_binary (x, "10111010110000111000101100101111001011011100101001111E-128");
- s = mpfr_get_str (NULL, &e, 10, 15, x, GMP_RNDN);
+ s = mpfr_get_str (NULL, &e, 10, 15, x, MPFR_RNDN);
if (strcmp (s, "193109287087290") || e != -22)
{
printf ("Error in mpfr_get_str (22b): s=%s e=%d\n", s, (int) e);
@@ -376,7 +376,7 @@ check_small (void)
mpfr_free_str (s);
mpfr_set_str_binary (x, "10001101101011010001111110000111010111010000110101010E80");
- s = mpfr_get_str (NULL, &e, 10, 16, x, GMP_RNDN);
+ s = mpfr_get_str (NULL, &e, 10, 16, x, MPFR_RNDN);
if (strcmp (s, "6026241735727920") || e != 40)
{
printf ("Error in mpfr_get_str (23): s=%s e=%d\n", s, (int) e);
@@ -385,7 +385,7 @@ check_small (void)
mpfr_free_str (s);
mpfr_set_str_binary (x, "100010001011101001110101000110011001001000110001001E-81");
- s = mpfr_get_str (NULL, &e, 10, 17, x, GMP_RNDN);
+ s = mpfr_get_str (NULL, &e, 10, 17, x, MPFR_RNDN);
if (strcmp (s, "49741483709103481") || e != -9)
{
printf ("Error in mpfr_get_str (24): s=%s e=%d\n", s, (int) e);
@@ -393,7 +393,7 @@ check_small (void)
}
mpfr_free_str (s);
mpfr_set_str_binary (x, "11000100001001001110111010011001111001001010110101111E-101");
- s = mpfr_get_str (NULL, &e, 10, 7, x, GMP_RNDN);
+ s = mpfr_get_str (NULL, &e, 10, 7, x, MPFR_RNDN);
if (strcmp (s, "2722049") || e != -14)
{
printf ("Error in mpfr_get_str (25): s=%s e=%d\n", s, (int) e);
@@ -401,7 +401,7 @@ check_small (void)
}
mpfr_free_str (s);
mpfr_set_str_binary (x, "11111001010011100101000001111111110001001001110110001E-135");
- s = mpfr_get_str (NULL, &e, 10, 8, x, GMP_RNDN);
+ s = mpfr_get_str (NULL, &e, 10, 8, x, MPFR_RNDN);
if (strcmp (s, "20138772") || e != -24)
{
printf ("Error in mpfr_get_str (26): s=%s e=%d\n", s, (int) e);
@@ -410,7 +410,7 @@ check_small (void)
mpfr_free_str (s);
mpfr_set_str_binary (x, "11111001010011100101000001111111110001001001110110001E-136");
- s = mpfr_get_str (NULL, &e, 10, 9, x, GMP_RNDN);
+ s = mpfr_get_str (NULL, &e, 10, 9, x, MPFR_RNDN);
if (strcmp (s, "100693858") || e != -24)
{
printf ("Error in mpfr_get_str (27): s=%s e=%d\n", s, (int) e);
@@ -418,7 +418,7 @@ check_small (void)
}
mpfr_free_str (s);
mpfr_set_str_binary (x, "10001000001110010110001011111011111011011010000110001E-110");
- s = mpfr_get_str (NULL, &e, 10, 14, x, GMP_RNDN);
+ s = mpfr_get_str (NULL, &e, 10, 14, x, MPFR_RNDN);
if (strcmp (s, "36923634350619") || e != -17)
{
printf ("Error in mpfr_get_str (28): s=%s e=%d\n", s, (int) e);
@@ -426,7 +426,7 @@ check_small (void)
}
mpfr_free_str (s);
mpfr_set_str_binary (x, "11001100010111000111100010000110011101110001000101111E-87");
- s = mpfr_get_str (NULL, &e, 10, 16, x, GMP_RNDN);
+ s = mpfr_get_str (NULL, &e, 10, 16, x, MPFR_RNDN);
if (strcmp (s, "4646636036100804") || e != -10)
{
printf ("Error in mpfr_get_str (29): s=%s e=%d\n", s, (int) e);
@@ -434,7 +434,7 @@ check_small (void)
}
mpfr_free_str (s);
mpfr_set_str_binary (x, "10011111001111110100001001010111111011010101111111000E-99");
- s = mpfr_get_str (NULL, &e, 10, 17, x, GMP_RNDN);
+ s = mpfr_get_str (NULL, &e, 10, 17, x, MPFR_RNDN);
if (strcmp (s, "88399901882446712") || e != -14)
{
printf ("Error in mpfr_get_str (30): s=%s e=%d\n", s, (int) e);
@@ -444,14 +444,14 @@ check_small (void)
/* 8116315218207718*2^(-293) ~ 0.5100000000000000000015*10^(-72) */
mpfr_set_str_binary (x, "11100110101011011111011100101011101110110001111100110E-293");
- s = mpfr_get_str (NULL, &e, 10, 2, x, GMP_RNDU);
+ s = mpfr_get_str (NULL, &e, 10, 2, x, MPFR_RNDU);
if (strcmp (s, "52") || e != -72)
{
printf ("Error in mpfr_get_str (31u): s=%s e=%d\n", s, (int) e);
exit (1);
}
mpfr_free_str (s);
- s = mpfr_get_str (NULL, &e, 10, 2, x, GMP_RNDD);
+ s = mpfr_get_str (NULL, &e, 10, 2, x, MPFR_RNDD);
if (strcmp (s, "51") || e != -72)
{
printf ("Error in mpfr_get_str (31d): s=%s e=%d\n", s, (int) e);
@@ -461,14 +461,14 @@ check_small (void)
/* 6712731423444934*2^536 ~ .151000000000000000000067*10^178 */
mpfr_set_str_binary (x, "10111110110010011000110010011111101111000111111000110E536");
- s = mpfr_get_str (NULL, &e, 10, 3, x, GMP_RNDU);
+ s = mpfr_get_str (NULL, &e, 10, 3, x, MPFR_RNDU);
if (strcmp (s, "152") || e != 178)
{
printf ("Error in mpfr_get_str (32u): s=%s e=%d\n", s, (int) e);
exit (1);
}
mpfr_free_str (s);
- s = mpfr_get_str (NULL, &e, 10, 3, x, GMP_RNDD);
+ s = mpfr_get_str (NULL, &e, 10, 3, x, MPFR_RNDD);
if (strcmp (s, "151") || e != 178)
{
printf ("Error in mpfr_get_str (32d): s=%s e=%d\n", s, (int) e);
@@ -478,14 +478,14 @@ check_small (void)
/* 3356365711722467*2^540 ~ .120800000000000000000054*10^179 */
mpfr_set_str_binary (x, "1011111011001001100011001001111110111100011111100011E540");
- s = mpfr_get_str (NULL, &e, 10, 4, x, GMP_RNDU);
+ s = mpfr_get_str (NULL, &e, 10, 4, x, MPFR_RNDU);
if (strcmp (s, "1209") || e != 179)
{
printf ("Error in mpfr_get_str (33u): s=%s e=%d\n", s, (int) e);
exit (1);
}
mpfr_free_str (s);
- s = mpfr_get_str (NULL, &e, 10, 4, x, GMP_RNDD);
+ s = mpfr_get_str (NULL, &e, 10, 4, x, MPFR_RNDD);
if (strcmp (s, "1208") || e != 179)
{
printf ("Error in mpfr_get_str (33d): s=%s e=%d\n", s, (int) e);
@@ -495,14 +495,14 @@ check_small (void)
/* 6475049196144587*2^100 ~ .8208099999999999999999988*10^46 */
mpfr_set_str_binary (x, "10111000000010000010111011111001111010100011111001011E100");
- s = mpfr_get_str (NULL, &e, 10, 5, x, GMP_RNDU);
+ s = mpfr_get_str (NULL, &e, 10, 5, x, MPFR_RNDU);
if (strcmp (s, "82081") || e != 46)
{
printf ("Error in mpfr_get_str (34u): s=%s e=%d\n", s, (int) e);
exit (1);
}
mpfr_free_str (s);
- s = mpfr_get_str (NULL, &e, 10, 5, x, GMP_RNDD);
+ s = mpfr_get_str (NULL, &e, 10, 5, x, MPFR_RNDD);
if (strcmp (s, "82080") || e != 46)
{
printf ("Error in mpfr_get_str (34d): s=%s e=%d\n", s, (int) e);
@@ -512,14 +512,14 @@ check_small (void)
/* 6722280709661868*2^364 ~ .25260100000000000000000012*10^126 */
mpfr_set_str_binary (x, "10111111000011110000011110001110001111010010010101100E364");
- s = mpfr_get_str (NULL, &e, 10, 6, x, GMP_RNDU);
+ s = mpfr_get_str (NULL, &e, 10, 6, x, MPFR_RNDU);
if (strcmp (s, "252602") || e != 126)
{
printf ("Error in mpfr_get_str (35u): s=%s e=%d\n", s, (int) e);
exit (1);
}
mpfr_free_str (s);
- s = mpfr_get_str (NULL, &e, 10, 6, x, GMP_RNDD);
+ s = mpfr_get_str (NULL, &e, 10, 6, x, MPFR_RNDD);
if (strcmp (s, "252601") || e != 126)
{
printf ("Error in mpfr_get_str (35d): s=%s e=%d\n", s, (int) e);
@@ -529,14 +529,14 @@ check_small (void)
/* 5381065484265332*2^(-455) ~ .578389299999999999999999982*10^(-121) */
mpfr_set_str_binary (x, "10011000111100000110011110000101100111110011101110100E-455");
- s = mpfr_get_str (NULL, &e, 10, 7, x, GMP_RNDU);
+ s = mpfr_get_str (NULL, &e, 10, 7, x, MPFR_RNDU);
if (strcmp (s, "5783893") || e != -121)
{
printf ("Error in mpfr_get_str (36u): s=%s e=%d\n", s, (int) e);
exit (1);
}
mpfr_free_str (s);
- s = mpfr_get_str (NULL, &e, 10, 7, x, GMP_RNDD);
+ s = mpfr_get_str (NULL, &e, 10, 7, x, MPFR_RNDD);
if (strcmp (s, "5783892") || e != -121)
{
printf ("Error in mpfr_get_str (36d): s=%s e=%d\n", s, (int) e);
@@ -546,14 +546,14 @@ check_small (void)
/* 8369123604277281*2^(-852) ~ .27869147000000000000000000056*10^(-240) */
mpfr_set_str_binary (x, "11101101110111010110001101111100000111010100000100001E-852");
- s = mpfr_get_str (NULL, &e, 10, 8, x, GMP_RNDU);
+ s = mpfr_get_str (NULL, &e, 10, 8, x, MPFR_RNDU);
if (strcmp (s, "27869148") || e != -240)
{
printf ("Error in mpfr_get_str (37u): s=%s e=%d\n", s, (int) e);
exit (1);
}
mpfr_free_str (s);
- s = mpfr_get_str (NULL, &e, 10, 8, x, GMP_RNDD);
+ s = mpfr_get_str (NULL, &e, 10, 8, x, MPFR_RNDD);
if (strcmp (s, "27869147") || e != -240)
{
printf ("Error in mpfr_get_str (37d): s=%s e=%d\n", s, (int) e);
@@ -563,14 +563,14 @@ check_small (void)
/* 7976538478610756*2^377 ~ .245540326999999999999999999982*10^130 */
mpfr_set_str_binary (x, "11100010101101001111010010110100011100000100101000100E377");
- s = mpfr_get_str (NULL, &e, 10, 9, x, GMP_RNDU);
+ s = mpfr_get_str (NULL, &e, 10, 9, x, MPFR_RNDU);
if (strcmp (s, "245540327") || e != 130)
{
printf ("Error in mpfr_get_str (38u): s=%s e=%d\n", s, (int) e);
exit (1);
}
mpfr_free_str (s);
- s = mpfr_get_str (NULL, &e, 10, 9, x, GMP_RNDD);
+ s = mpfr_get_str (NULL, &e, 10, 9, x, MPFR_RNDD);
if (strcmp (s, "245540326") || e != 130)
{
printf ("Error in mpfr_get_str (38d): s=%s e=%d\n", s, (int) e);
@@ -580,14 +580,14 @@ check_small (void)
/* 8942832835564782*2^(-382) ~ .9078555839000000000000000000038*10^(-99) */
mpfr_set_str_binary (x, "11111110001010111010110000110011100110001010011101110E-382");
- s = mpfr_get_str (NULL, &e, 10, 10, x, GMP_RNDU);
+ s = mpfr_get_str (NULL, &e, 10, 10, x, MPFR_RNDU);
if (strcmp (s, "9078555840") || e != -99)
{
printf ("Error in mpfr_get_str (39u): s=%s e=%d\n", s, (int) e);
exit (1);
}
mpfr_free_str (s);
- s = mpfr_get_str (NULL, &e, 10, 10, x, GMP_RNDD);
+ s = mpfr_get_str (NULL, &e, 10, 10, x, MPFR_RNDD);
if (strcmp (s, "9078555839") || e != -99)
{
printf ("Error in mpfr_get_str (39d): s=%s e=%d\n", s, (int) e);
@@ -597,14 +597,14 @@ check_small (void)
/* 4471416417782391*2^(-380) ~ .18157111678000000000000000000077*10^(-98) */
mpfr_set_str_binary (x, "1111111000101011101011000011001110011000101001110111E-380");
- s = mpfr_get_str (NULL, &e, 10, 11, x, GMP_RNDU);
+ s = mpfr_get_str (NULL, &e, 10, 11, x, MPFR_RNDU);
if (strcmp (s, "18157111679") || e != -98)
{
printf ("Error in mpfr_get_str (40u): s=%s e=%d\n", s, (int) e);
exit (1);
}
mpfr_free_str (s);
- s = mpfr_get_str (NULL, &e, 10, 11, x, GMP_RNDD);
+ s = mpfr_get_str (NULL, &e, 10, 11, x, MPFR_RNDD);
if (strcmp (s, "18157111678") || e != -98)
{
printf ("Error in mpfr_get_str (40d): s=%s e=%d\n", s, (int) e);
@@ -614,14 +614,14 @@ check_small (void)
/* 7225450889282194*2^711 ~ .778380362292999999999999999999971*10^230 */
mpfr_set_str_binary (x, "11001101010111000001001100001100110010000001010010010E711");
- s = mpfr_get_str (NULL, &e, 10, 12, x, GMP_RNDU);
+ s = mpfr_get_str (NULL, &e, 10, 12, x, MPFR_RNDU);
if (strcmp (s, "778380362293") || e != 230)
{
printf ("Error in mpfr_get_str (41u): s=%s e=%d\n", s, (int) e);
exit (1);
}
mpfr_free_str (s);
- s = mpfr_get_str (NULL, &e, 10, 12, x, GMP_RNDD);
+ s = mpfr_get_str (NULL, &e, 10, 12, x, MPFR_RNDD);
if (strcmp (s, "778380362292") || e != 230)
{
printf ("Error in mpfr_get_str (41d): s=%s e=%d\n", s, (int) e);
@@ -631,14 +631,14 @@ check_small (void)
/* 3612725444641097*2^713 ~ .1556760724585999999999999999999942*10^231 */
mpfr_set_str_binary (x, "1100110101011100000100110000110011001000000101001001E713");
- s = mpfr_get_str (NULL, &e, 10, 13, x, GMP_RNDU);
+ s = mpfr_get_str (NULL, &e, 10, 13, x, MPFR_RNDU);
if (strcmp (s, "1556760724586") || e != 231)
{
printf ("Error in mpfr_get_str (42u): s=%s e=%d\n", s, (int) e);
exit (1);
}
mpfr_free_str (s);
- s = mpfr_get_str (NULL, &e, 10, 13, x, GMP_RNDD);
+ s = mpfr_get_str (NULL, &e, 10, 13, x, MPFR_RNDD);
if (strcmp (s, "1556760724585") || e != 231)
{
printf ("Error in mpfr_get_str (42d): s=%s e=%d\n", s, (int) e);
@@ -648,14 +648,14 @@ check_small (void)
/* 6965949469487146*2^(-248) ~ .15400733123779000000000000000000016*10^(-58) */
mpfr_set_str_binary (x, "11000101111110111111001111111101001101111000000101010E-248");
- s = mpfr_get_str (NULL, &e, 10, 14, x, GMP_RNDU);
+ s = mpfr_get_str (NULL, &e, 10, 14, x, MPFR_RNDU);
if (strcmp (s, "15400733123780") || e != -58)
{
printf ("Error in mpfr_get_str (43u): s=%s e=%d\n", s, (int) e);
exit (1);
}
mpfr_free_str (s);
- s = mpfr_get_str (NULL, &e, 10, 14, x, GMP_RNDD);
+ s = mpfr_get_str (NULL, &e, 10, 14, x, MPFR_RNDD);
if (strcmp (s, "15400733123779") || e != -58)
{
printf ("Error in mpfr_get_str (43d): s=%s e=%d\n", s, (int) e);
@@ -665,14 +665,14 @@ check_small (void)
/* 3482974734743573*2^(-244) ~ .12320586499023200000000000000000013*10^(-57) */
mpfr_set_str_binary (x, "1100010111111011111100111111110100110111100000010101E-244");
- s = mpfr_get_str (NULL, &e, 10, 15, x, GMP_RNDU);
+ s = mpfr_get_str (NULL, &e, 10, 15, x, MPFR_RNDU);
if (strcmp (s, "123205864990233") || e != -57)
{
printf ("Error in mpfr_get_str (44u): s=%s e=%d\n", s, (int) e);
exit (1);
}
mpfr_free_str (s);
- s = mpfr_get_str (NULL, &e, 10, 15, x, GMP_RNDD);
+ s = mpfr_get_str (NULL, &e, 10, 15, x, MPFR_RNDD);
if (strcmp (s, "123205864990232") || e != -57)
{
printf ("Error in mpfr_get_str (44d): s=%s e=%d\n", s, (int) e);
@@ -682,14 +682,14 @@ check_small (void)
/* 7542952370752766*2^(-919) ~ .170206189963739699999999999999999974*10^(-260) */
mpfr_set_str_binary (x, "11010110011000100011001110100100111011100110011111110E-919");
- s = mpfr_get_str (NULL, &e, 10, 16, x, GMP_RNDU);
+ s = mpfr_get_str (NULL, &e, 10, 16, x, MPFR_RNDU);
if (strcmp (s, "1702061899637397") || e != -260)
{
printf ("Error in mpfr_get_str (45u): s=%s e=%d\n", s, (int) e);
exit (1);
}
mpfr_free_str (s);
- s = mpfr_get_str (NULL, &e, 10, 16, x, GMP_RNDD);
+ s = mpfr_get_str (NULL, &e, 10, 16, x, MPFR_RNDD);
if (strcmp (s, "1702061899637396") || e != -260)
{
printf ("Error in mpfr_get_str (45d): s=%s e=%d\n", s, (int) e);
@@ -699,14 +699,14 @@ check_small (void)
/* 5592117679628511*2^165 ~ .26153245263757307000000000000000000074*10^66 */
mpfr_set_str_binary (x, "10011110111100000000001011011110101100010000011011111E165");
- s = mpfr_get_str (NULL, &e, 10, 17, x, GMP_RNDU);
+ s = mpfr_get_str (NULL, &e, 10, 17, x, MPFR_RNDU);
if (strcmp (s, "26153245263757308") || e != 66)
{
printf ("Error in mpfr_get_str (46u): s=%s e=%d\n", s, (int) e);
exit (1);
}
mpfr_free_str (s);
- s = mpfr_get_str (NULL, &e, 10, 17, x, GMP_RNDD);
+ s = mpfr_get_str (NULL, &e, 10, 17, x, MPFR_RNDD);
if (strcmp (s, "26153245263757307") || e != 66)
{
printf ("Error in mpfr_get_str (46d): s=%s e=%d\n", s, (int) e);
@@ -715,21 +715,21 @@ check_small (void)
mpfr_free_str (s);
mpfr_set_str_binary (x, "11010010110111100001011010000110010000100001011011101E1223");
- s = mpfr_get_str (NULL, &e, 10, 17, x, GMP_RNDN);
+ s = mpfr_get_str (NULL, &e, 10, 17, x, MPFR_RNDN);
if (strcmp (s, "10716284017294180") || e != 385)
{
printf ("Error in mpfr_get_str (47n): s=%s e=%d\n", s, (int) e);
exit (1);
}
mpfr_free_str (s);
- s = mpfr_get_str (NULL, &e, 10, 18, x, GMP_RNDU);
+ s = mpfr_get_str (NULL, &e, 10, 18, x, MPFR_RNDU);
if (strcmp (s, "107162840172941805") || e != 385)
{
printf ("Error in mpfr_get_str (47u): s=%s e=%d\n", s, (int) e);
exit (1);
}
mpfr_free_str (s);
- s = mpfr_get_str (NULL, &e, 10, 18, x, GMP_RNDD);
+ s = mpfr_get_str (NULL, &e, 10, 18, x, MPFR_RNDD);
if (strcmp (s, "107162840172941804") || e != 385)
{
printf ("Error in mpfr_get_str (47d): s=%s e=%d\n", s, (int) e);
@@ -738,21 +738,21 @@ check_small (void)
mpfr_free_str (s);
mpfr_set_str_binary (x, "11111101111011000001010100001101101000010010001111E122620");
- s = mpfr_get_str (NULL, &e, 10, 17, x, GMP_RNDN);
+ s = mpfr_get_str (NULL, &e, 10, 17, x, MPFR_RNDN);
if (strcmp (s, "22183435284042374") || e != 36928)
{
printf ("Error in mpfr_get_str (48n): s=%s e=%ld\n", s, (long) e);
exit (1);
}
mpfr_free_str (s);
- s = mpfr_get_str (NULL, &e, 10, 18, x, GMP_RNDU);
+ s = mpfr_get_str (NULL, &e, 10, 18, x, MPFR_RNDU);
if (strcmp (s, "221834352840423736") || e != 36928)
{
printf ("Error in mpfr_get_str (48u): s=%s e=%ld\n", s, (long) e);
exit (1);
}
mpfr_free_str (s);
- s = mpfr_get_str (NULL, &e, 10, 18, x, GMP_RNDD);
+ s = mpfr_get_str (NULL, &e, 10, 18, x, MPFR_RNDD);
if (strcmp (s, "221834352840423735") || e != 36928)
{
printf ("Error in mpfr_get_str (48d): s=%s e=%ld\n", s, (long) e);
@@ -762,30 +762,30 @@ check_small (void)
mpfr_set_prec (x, 45);
mpfr_set_str_binary (x, "1E45");
- s = mpfr_get_str (NULL, &e, 32, 9, x, GMP_RNDN);
+ s = mpfr_get_str (NULL, &e, 32, 9, x, MPFR_RNDN);
mpfr_free_str (s);
mpfr_set_prec (x, 7);
mpfr_set_str_binary (x, "0.1010101E10");
- s = mpfr_get_str (NULL, &e, 10, 2, x, GMP_RNDU);
+ s = mpfr_get_str (NULL, &e, 10, 2, x, MPFR_RNDU);
mpfr_free_str (s);
/* checks rounding of negative numbers */
mpfr_set_prec (x, 7);
- mpfr_set_str (x, "-11.5", 10, GMP_RNDN);
- s = mpfr_get_str (NULL, &e, 10, 2, x, GMP_RNDD);
+ mpfr_set_str (x, "-11.5", 10, MPFR_RNDN);
+ s = mpfr_get_str (NULL, &e, 10, 2, x, MPFR_RNDD);
if (strcmp (s, "-12"))
{
- printf ("Error in mpfr_get_str for x=-11.5 and rnd=GMP_RNDD\n"
+ printf ("Error in mpfr_get_str for x=-11.5 and rnd=MPFR_RNDD\n"
"got %s instead of -12\n", s);
exit (1);
}
mpfr_free_str (s);
- s = mpfr_get_str (NULL, &e, 10, 2, x, GMP_RNDU);
+ s = mpfr_get_str (NULL, &e, 10, 2, x, MPFR_RNDU);
if (strcmp (s, "-11"))
{
- printf ("Error in mpfr_get_str for x=-11.5 and rnd=GMP_RNDU\n");
+ printf ("Error in mpfr_get_str for x=-11.5 and rnd=MPFR_RNDU\n");
exit (1);
}
mpfr_free_str (s);
@@ -793,12 +793,12 @@ check_small (void)
/* bug found by Jean-Pierre Merlet, produced error in mpfr_get_str */
mpfr_set_prec (x, 128);
mpfr_set_str_binary (x, "0.10111001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011010E3");
- s = mpfr_get_str (NULL, &e, 10, 0, x, GMP_RNDU);
+ s = mpfr_get_str (NULL, &e, 10, 0, x, MPFR_RNDU);
mpfr_free_str (s);
mpfr_set_prec (x, 381);
mpfr_set_str_binary (x, "0.111111111111111111111111111111111111111111111111111111111111111111101110110000100110011101101101001010111000101111000100100011110101010110101110100000010100001000110100000100011111001000010010000010001010111001011110000001110010111101100001111000101101100000010110000101100100000101010110010110001010100111001111100011100101100000100100111001100010010011110011011010110000001000010");
- s = mpfr_get_str (NULL, &e, 10, 0, x, GMP_RNDD);
+ s = mpfr_get_str (NULL, &e, 10, 0, x, MPFR_RNDD);
if (e != 0)
{
printf ("Error in mpfr_get_str for x=0.999999..., exponent is %d"
@@ -920,9 +920,9 @@ check_large (void)
mp_exp_t e;
mpfr_init2 (x, 3322);
- mpfr_set_str (x, xm, 10, GMP_RNDN);
- mpfr_div_2exp (x, x, 4343, GMP_RNDN);
- s = mpfr_get_str (NULL, &e, 10, 1000, x, GMP_RNDN);
+ mpfr_set_str (x, xm, 10, MPFR_RNDN);
+ mpfr_div_2exp (x, x, 4343, MPFR_RNDN);
+ s = mpfr_get_str (NULL, &e, 10, 1000, x, MPFR_RNDN);
if (s[999] != '1') /* s must be 5.04383...689071e-309 */
{
printf ("Error in check_large: expected '689071', got '%s'\n",
@@ -931,8 +931,8 @@ check_large (void)
}
mpfr_free_str (s);
- mpfr_mul_2exp (x, x, 4343, GMP_RNDN);
- s = mpfr_get_str (NULL, &e, 10, 2, x, GMP_RNDN);
+ mpfr_mul_2exp (x, x, 4343, MPFR_RNDN);
+ s = mpfr_get_str (NULL, &e, 10, 2, x, MPFR_RNDN);
if (strcmp (s, "12") || (e != 1000))
{
printf ("Error in check_large: expected 0.12e1000\n");
@@ -942,7 +942,7 @@ check_large (void)
mpfr_free_str (s);
mpfr_set_nan (x);
- s = mpfr_get_str (NULL, &e, 10, 1000, x, GMP_RNDN);
+ s = mpfr_get_str (NULL, &e, 10, 1000, x, MPFR_RNDN);
if (strcmp (s, "@NaN@"))
{
printf ("Error for NaN\n");
@@ -950,10 +950,10 @@ check_large (void)
}
mpfr_free_str (s);
- mpfr_get_str (s1, &e, 10, 1000, x, GMP_RNDN);
+ mpfr_get_str (s1, &e, 10, 1000, x, MPFR_RNDN);
mpfr_set_inf (x, 1);
- s = mpfr_get_str (NULL, &e, 10, 1000, x, GMP_RNDN);
+ s = mpfr_get_str (NULL, &e, 10, 1000, x, MPFR_RNDN);
if (strcmp (s, "@Inf@"))
{
printf ("Error for Inf\n");
@@ -961,10 +961,10 @@ check_large (void)
}
mpfr_free_str (s);
- mpfr_get_str (s1, &e, 10, 1000, x, GMP_RNDN);
+ mpfr_get_str (s1, &e, 10, 1000, x, MPFR_RNDN);
mpfr_set_inf (x, -1);
- s = mpfr_get_str (NULL, &e, 10, 1000, x, GMP_RNDN);
+ s = mpfr_get_str (NULL, &e, 10, 1000, x, MPFR_RNDN);
if (strcmp (s, "-@Inf@"))
{
printf ("Error for -Inf\n");
@@ -972,27 +972,27 @@ check_large (void)
}
mpfr_free_str (s);
- mpfr_get_str (s1, &e, 10, 1000, x, GMP_RNDN);
+ mpfr_get_str (s1, &e, 10, 1000, x, MPFR_RNDN);
- mpfr_set_ui (x, 0, GMP_RNDN);
- s = mpfr_get_str (NULL, &e, 10, 2, x, GMP_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ s = mpfr_get_str (NULL, &e, 10, 2, x, MPFR_RNDN);
if (e != 0 || strcmp (s, "00"))
{
printf ("Error for 0.0\n");
exit (1);
}
mpfr_free_str (s);
- mpfr_get_str (s1, &e, 10, 2, x, GMP_RNDN);
+ mpfr_get_str (s1, &e, 10, 2, x, MPFR_RNDN);
- mpfr_neg (x, x, GMP_RNDN); /* -0.0 */
- s = mpfr_get_str (NULL, &e, 10, 2, x, GMP_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN); /* -0.0 */
+ s = mpfr_get_str (NULL, &e, 10, 2, x, MPFR_RNDN);
if (e != 0 || strcmp (s, "-00"))
{
printf ("Error for -0.0\ngot %se%d\n", s, (int) e);
exit (1);
}
mpfr_free_str (s);
- mpfr_get_str (s1, &e, 10, 2, x, GMP_RNDN);
+ mpfr_get_str (s1, &e, 10, 2, x, MPFR_RNDN);
mpfr_clear (x);
}
@@ -1010,19 +1010,19 @@ check_special (int b, mp_prec_t p)
size_t m;
/* check for invalid base */
- MPFR_ASSERTN(mpfr_get_str (s, &e, 1, 10, x, GMP_RNDN) == NULL);
- MPFR_ASSERTN(mpfr_get_str (s, &e, 37, 10, x, GMP_RNDN) == NULL);
+ MPFR_ASSERTN(mpfr_get_str (s, &e, 1, 10, x, MPFR_RNDN) == NULL);
+ MPFR_ASSERTN(mpfr_get_str (s, &e, 37, 10, x, MPFR_RNDN) == NULL);
s2[0] = '1';
for (i=1; i<MAX_DIGITS+2; i++)
s2[i] = '0';
mpfr_init2 (x, p);
- mpfr_set_ui (x, 1, GMP_RNDN);
- for (i=1; i<MAX_DIGITS && mpfr_mul_ui (x, x, b, GMP_RNDN) == 0; i++)
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ for (i=1; i<MAX_DIGITS && mpfr_mul_ui (x, x, b, MPFR_RNDN) == 0; i++)
{
/* x = b^i (exact) */
- for (r = 0; r < GMP_RND_MAX; r++)
+ for (r = 0; r < MPFR_RND_MAX; r++)
for (m= (i<3)? 2 : i-1 ; (int) m <= i+1 ; m++)
{
mpfr_get_str (s, &e, b, m, x, (mp_rnd_t) r);
@@ -1033,10 +1033,10 @@ check_special (int b, mp_prec_t p)
exit (1);
}
}
- if (mpfr_sub_ui (x, x, 1, GMP_RNDN) != 0)
+ if (mpfr_sub_ui (x, x, 1, MPFR_RNDN) != 0)
break;
/* now x = b^i-1 (exact) */
- for (r = 0; r < GMP_RND_MAX; r++)
+ for (r = 0; r < MPFR_RND_MAX; r++)
if (i >= 2)
{
mpfr_get_str (s, &e, b, i, x, (mp_rnd_t) r);
@@ -1052,7 +1052,7 @@ check_special (int b, mp_prec_t p)
}
if (i >= 3)
{
- mpfr_get_str (s, &e, b, i - 1, x, GMP_RNDU);
+ mpfr_get_str (s, &e, b, i - 1, x, MPFR_RNDU);
/* should be b^i */
if ((e != i+1) || strncmp (s, s2, i - 1) != 0)
{
@@ -1062,7 +1062,7 @@ check_special (int b, mp_prec_t p)
}
}
- mpfr_add_ui (x, x, 1, GMP_RNDN);
+ mpfr_add_ui (x, x, 1, MPFR_RNDN);
}
mpfr_clear (x);
}
@@ -1082,10 +1082,10 @@ check_bug_base2k (void)
mpfr_init2 (yy, 79);
mpfr_init2 (zz, 99);
- mpfr_set_str (xx, "-1.90e8c3e525d7c0000000000000@-18", 16, GMP_RNDN);
- mpfr_set_str (yy, "-2.63b22b55697e8000000@130", 16, GMP_RNDN);
- mpfr_add (zz, xx, yy, GMP_RNDD);
- s = mpfr_get_str (NULL, &e, 16, 0, zz, GMP_RNDN);
+ mpfr_set_str (xx, "-1.90e8c3e525d7c0000000000000@-18", 16, MPFR_RNDN);
+ mpfr_set_str (yy, "-2.63b22b55697e8000000@130", 16, MPFR_RNDN);
+ mpfr_add (zz, xx, yy, MPFR_RNDD);
+ s = mpfr_get_str (NULL, &e, 16, 0, zz, MPFR_RNDN);
if (strcmp (s, "-263b22b55697e8000000000008"))
{
printf ("Error for get_str base 16\n"
@@ -1105,9 +1105,9 @@ check_reduced_exprange (void)
emax = mpfr_get_emax ();
mpfr_init2 (x, 8);
- mpfr_set_str (x, "0.11111111E0", 2, GMP_RNDN);
+ mpfr_set_str (x, "0.11111111E0", 2, MPFR_RNDN);
set_emax (0);
- s = mpfr_get_str (NULL, &e, 16, 0, x, GMP_RNDN);
+ s = mpfr_get_str (NULL, &e, 16, 0, x, MPFR_RNDN);
set_emax (emax);
if (strcmp (s, "ff0"))
{
@@ -1160,23 +1160,23 @@ main (int argc, char *argv[])
mpfr_clear (x);
check_large ();
- check3 ("4.059650008e-83", GMP_RNDN, "40597");
- check3 ("-6.606499965302424244461355e233", GMP_RNDN, "-66065");
- check3 ("-7.4", GMP_RNDN, "-74000");
- check3 ("0.997", GMP_RNDN, "99700");
- check3 ("-4.53063926135729747564e-308", GMP_RNDN, "-45306");
- check3 ("2.14478198760196000000e+16", GMP_RNDN, "21448");
- check3 ("7.02293374921793516813e-84", GMP_RNDN, "70229");
-
- check3 ("-6.7274500420134077e-87", GMP_RNDN, "-67275");
- check3 ("-6.7274500420134077e-87", GMP_RNDZ, "-67274");
- check3 ("-6.7274500420134077e-87", GMP_RNDU, "-67274");
- check3 ("-6.7274500420134077e-87", GMP_RNDD, "-67275");
-
- check3 ("6.7274500420134077e-87", GMP_RNDN, "67275");
- check3 ("6.7274500420134077e-87", GMP_RNDZ, "67274");
- check3 ("6.7274500420134077e-87", GMP_RNDU, "67275");
- check3 ("6.7274500420134077e-87", GMP_RNDD, "67274");
+ check3 ("4.059650008e-83", MPFR_RNDN, "40597");
+ check3 ("-6.606499965302424244461355e233", MPFR_RNDN, "-66065");
+ check3 ("-7.4", MPFR_RNDN, "-74000");
+ check3 ("0.997", MPFR_RNDN, "99700");
+ check3 ("-4.53063926135729747564e-308", MPFR_RNDN, "-45306");
+ check3 ("2.14478198760196000000e+16", MPFR_RNDN, "21448");
+ check3 ("7.02293374921793516813e-84", MPFR_RNDN, "70229");
+
+ check3 ("-6.7274500420134077e-87", MPFR_RNDN, "-67275");
+ check3 ("-6.7274500420134077e-87", MPFR_RNDZ, "-67274");
+ check3 ("-6.7274500420134077e-87", MPFR_RNDU, "-67274");
+ check3 ("-6.7274500420134077e-87", MPFR_RNDD, "-67275");
+
+ check3 ("6.7274500420134077e-87", MPFR_RNDN, "67275");
+ check3 ("6.7274500420134077e-87", MPFR_RNDZ, "67274");
+ check3 ("6.7274500420134077e-87", MPFR_RNDU, "67275");
+ check3 ("6.7274500420134077e-87", MPFR_RNDD, "67274");
check_bug_base2k ();
check_reduced_exprange ();
diff --git a/tests/tget_z.c b/tests/tget_z.c
index d0af7a1c0..3191dfcd7 100644
--- a/tests/tget_z.c
+++ b/tests/tget_z.c
@@ -34,8 +34,8 @@ check_diff (void)
mpz_init (z);
mpfr_init2 (x, 2);
- mpfr_set_ui (x, 2047, GMP_RNDU);
- mpz_set_fr (z, x, GMP_RNDN);
+ mpfr_set_ui (x, 2047, MPFR_RNDU);
+ mpz_set_fr (z, x, MPFR_RNDN);
if (mpz_cmp_ui (z, 2048) != 0)
{
printf ("get_z RU 2048 failed\n");
@@ -60,20 +60,20 @@ check_one (mpz_ptr z)
for (neg = 0; neg <= 1; neg++)
{
mpz_neg (z, z);
- mpfr_set_z (f, z, GMP_RNDN);
+ mpfr_set_z (f, z, MPFR_RNDN);
if (sh < 0)
{
mpz_tdiv_q_2exp (z, z, -sh);
- mpfr_div_2exp (f, f, -sh, GMP_RNDN);
+ mpfr_div_2exp (f, f, -sh, MPFR_RNDN);
}
else
{
mpz_mul_2exp (z, z, sh);
- mpfr_mul_2exp (f, f, sh, GMP_RNDN);
+ mpfr_mul_2exp (f, f, sh, MPFR_RNDN);
}
- mpfr_get_z (got, f, GMP_RNDZ);
+ mpfr_get_z (got, f, MPFR_RNDZ);
if (mpz_cmp (got, z) != 0)
{
diff --git a/tests/tgmpop.c b/tests/tgmpop.c
index 2bbce4e23..f3391ac95 100644
--- a/tests/tgmpop.c
+++ b/tests/tgmpop.c
@@ -52,7 +52,7 @@ special (void)
mpz_set_str (mpq_numref (z), "-187207494", 10);
mpz_set_str (mpq_denref (z), "5721", 10);
mpfr_set_str_binary (x, "11111111101001011011100101100011011110010011100010000100001E-44");
- mpfr_add_q (y, x, z, GMP_RNDN);
+ mpfr_add_q (y, x, z, MPFR_RNDN);
CHECK_FOR ("cancelation in add_q", mpfr_cmp_ui_2exp (y, 256783, -64) == 0);
mpfr_set_prec (x, 19);
@@ -60,7 +60,7 @@ special (void)
mpz_set_str (mpq_numref (z), "187207494", 10);
mpz_set_str (mpq_denref (z), "5721", 10);
mpfr_set_prec (y, 29);
- mpfr_add_q (y, x, z, GMP_RNDD);
+ mpfr_add_q (y, x, z, MPFR_RNDD);
mpfr_set_prec (x, 29);
mpfr_set_str_binary (x, "11111111101001110011010001001E-14");
CHECK_FOR ("cancelation in add_q", mpfr_cmp (x,y) == 0);
@@ -70,16 +70,16 @@ special (void)
mpz_set_str (mpq_numref (z), "395877315", 10);
mpz_set_str (mpq_denref (z), "3508975966", 10);
mpfr_set_prec (y, 118);
- mpfr_add_q (y, x, z, GMP_RNDU);
+ mpfr_add_q (y, x, z, MPFR_RNDU);
CHECK_FOR ("inf", mpfr_inf_p (y) && mpfr_sgn (y) > 0);
- mpfr_sub_q (y, x, z, GMP_RNDU);
+ mpfr_sub_q (y, x, z, MPFR_RNDU);
CHECK_FOR ("inf", mpfr_inf_p (y) && mpfr_sgn (y) > 0);
/* Nan */
MPFR_SET_NAN (x);
- mpfr_add_q (y, x, z, GMP_RNDU);
+ mpfr_add_q (y, x, z, MPFR_RNDU);
CHECK_FOR ("nan", mpfr_nan_p (y));
- mpfr_sub_q (y, x, z, GMP_RNDU);
+ mpfr_sub_q (y, x, z, MPFR_RNDU);
CHECK_FOR ("nan", mpfr_nan_p (y));
/* Exact value */
@@ -88,36 +88,36 @@ special (void)
mpfr_set_str1 (x, "0.5");
mpz_set_str (mpq_numref (z), "3", 10);
mpz_set_str (mpq_denref (z), "2", 10);
- res = mpfr_add_q (y, x, z, GMP_RNDU);
+ res = mpfr_add_q (y, x, z, MPFR_RNDU);
CHECK_FOR ("0.5+3/2", mpfr_cmp_ui(y, 2)==0 && res==0);
- res = mpfr_sub_q (y, x, z, GMP_RNDU);
+ res = mpfr_sub_q (y, x, z, MPFR_RNDU);
CHECK_FOR ("0.5-3/2", mpfr_cmp_si(y, -1)==0 && res==0);
/* Inf Rationnal */
mpq_set_ui (z, 1, 0);
mpfr_set_str1 (x, "0.5");
- res = mpfr_add_q (y, x, z, GMP_RNDN);
+ res = mpfr_add_q (y, x, z, MPFR_RNDN);
CHECK_FOR ("0.5+1/0", mpfr_inf_p (y) && MPFR_SIGN (y) > 0 && res == 0);
- res = mpfr_sub_q (y, x, z, GMP_RNDN);
+ res = mpfr_sub_q (y, x, z, MPFR_RNDN);
CHECK_FOR ("0.5-1/0", mpfr_inf_p (y) && MPFR_SIGN (y) < 0 && res == 0);
mpq_set_si (z, -1, 0);
- res = mpfr_add_q (y, x, z, GMP_RNDN);
+ res = mpfr_add_q (y, x, z, MPFR_RNDN);
CHECK_FOR ("0.5+ -1/0", mpfr_inf_p (y) && MPFR_SIGN (y) < 0 && res == 0);
- res = mpfr_sub_q (y, x, z, GMP_RNDN);
+ res = mpfr_sub_q (y, x, z, MPFR_RNDN);
CHECK_FOR ("0.5- -1/0", mpfr_inf_p (y) && MPFR_SIGN (y) > 0 && res == 0);
- res = mpfr_div_q (y, x, z, GMP_RNDN);
+ res = mpfr_div_q (y, x, z, MPFR_RNDN);
CHECK_FOR ("0.5 / (-1/0)", mpfr_zero_p (y) && MPFR_SIGN (y) < 0 && res == 0);
/* 0 */
mpq_set_ui (z, 0, 1);
- mpfr_set_ui (x, 42, GMP_RNDN);
- res = mpfr_add_q (y, x, z, GMP_RNDN);
+ mpfr_set_ui (x, 42, MPFR_RNDN);
+ res = mpfr_add_q (y, x, z, MPFR_RNDN);
CHECK_FOR ("42+0/1", mpfr_cmp_ui (y, 42) == 0 && res == 0);
- res = mpfr_sub_q (y, x, z, GMP_RNDN);
+ res = mpfr_sub_q (y, x, z, MPFR_RNDN);
CHECK_FOR ("42-0/1", mpfr_cmp_ui (y, 42) == 0 && res == 0);
- res = mpfr_mul_q (y, x, z, GMP_RNDN);
+ res = mpfr_mul_q (y, x, z, MPFR_RNDN);
CHECK_FOR ("42*0/1", mpfr_zero_p (y) && MPFR_SIGN (y) > 0 && res == 0);
- res = mpfr_div_q (y, x, z, GMP_RNDN);
+ res = mpfr_div_q (y, x, z, MPFR_RNDN);
CHECK_FOR ("42/(0/1)", mpfr_inf_p (y) && MPFR_SIGN (y) > 0 && res == 0);
@@ -219,7 +219,7 @@ test_cmp_z (mp_prec_t pmin, mp_prec_t pmax, int nmax)
mpz_urandomb (y, RANDS, 1024);
if (!MPFR_IS_SINGULAR (x))
{
- mpfr_sub_z (z, x, y, GMP_RNDN);
+ mpfr_sub_z (z, x, y, MPFR_RNDN);
res1 = mpfr_sgn (z);
res2 = mpfr_cmp_z (x, y);
if (res1 != res2)
@@ -257,7 +257,7 @@ test_cmp_q (mp_prec_t pmin, mp_prec_t pmax, int nmax)
mpq_set_ui (y, randlimb (), randlimb() );
if (!MPFR_IS_SINGULAR (x))
{
- mpfr_sub_q (z, x, y, GMP_RNDN);
+ mpfr_sub_q (z, x, y, MPFR_RNDN);
res1 = mpfr_sgn (z);
res2 = mpfr_cmp_q (x, y);
if (res1 != res2)
@@ -296,8 +296,8 @@ test_cmp_f (mp_prec_t pmin, mp_prec_t pmax, int nmax)
mpf_urandomb (y, RANDS, p);
if (!MPFR_IS_SINGULAR (x))
{
- mpfr_set_f (z, y, GMP_RNDN);
- mpfr_sub (z, x, z, GMP_RNDN);
+ mpfr_set_f (z, y, MPFR_RNDN);
+ mpfr_sub (z, x, z, MPFR_RNDN);
res1 = mpfr_sgn (z);
res2 = mpfr_cmp_f (x, y);
if (res1 != res2)
@@ -330,13 +330,13 @@ test_specialz (int (*mpfr_func)(mpfr_ptr, mpfr_srcptr, mpz_srcptr, mp_rnd_t),
mpz_fac_ui (z2, 20); /* 20!+1 fits perfectly in a 128 bits mantissa */
mpz_add_ui (z2, z2, 1);
- res = mpfr_set_z(x1, z1, GMP_RNDN);
+ res = mpfr_set_z(x1, z1, MPFR_RNDN);
if (res)
{
printf("Specialz %s: set_z1 error\n", op);
exit(1);
}
- mpfr_set_z (x2, z2, GMP_RNDN);
+ mpfr_set_z (x2, z2, MPFR_RNDN);
if (res)
{
printf("Specialz %s: set_z2 error\n", op);
@@ -344,14 +344,14 @@ test_specialz (int (*mpfr_func)(mpfr_ptr, mpfr_srcptr, mpz_srcptr, mp_rnd_t),
}
/* (19!+1) * (20!+1) fits in a 128 bits number */
- res = mpfr_func(x1, x1, z2, GMP_RNDN);
+ res = mpfr_func(x1, x1, z2, MPFR_RNDN);
if (res)
{
printf("Specialz %s: wrong inexact flag.\n", op);
exit(1);
}
mpz_func(z1, z1, z2);
- res = mpfr_set_z (x2, z1, GMP_RNDN);
+ res = mpfr_set_z (x2, z1, MPFR_RNDN);
if (res)
{
printf("Specialz %s: set_z2 error\n", op);
@@ -371,10 +371,10 @@ test_specialz (int (*mpfr_func)(mpfr_ptr, mpfr_srcptr, mpz_srcptr, mp_rnd_t),
mpz_set_ui (z1, 1);
mpz_set_ui (z2, 0);
- mpfr_set_ui (x1, 1, GMP_RNDN);
+ mpfr_set_ui (x1, 1, MPFR_RNDN);
mpz_func (z1, z1, z2);
- res = mpfr_func(x1, x1, z2, GMP_RNDN);
- mpfr_set_z (x2, z1, GMP_RNDN);
+ res = mpfr_func(x1, x1, z2, MPFR_RNDN);
+ mpfr_set_z (x2, z1, MPFR_RNDN);
if (mpfr_cmp(x1, x2))
{
printf("Specialz %s: results differ(2).\nx1=", op);
@@ -569,11 +569,11 @@ test_specialq (mp_prec_t p0, mp_prec_t p1, unsigned int N,
mpq_canonicalize (q1);
mpq_canonicalize (q2);
mpq_func (qr, q1, q2);
- mpfr_set_q (fra, q1, GMP_RNDD);
- mpfr_func (fra, fra, q2, GMP_RNDD);
- mpfr_set_q (frb, q1, GMP_RNDU);
- mpfr_func (frb, frb, q2, GMP_RNDU);
- mpfr_set_q (frq, qr, GMP_RNDN);
+ mpfr_set_q (fra, q1, MPFR_RNDD);
+ mpfr_func (fra, fra, q2, MPFR_RNDD);
+ mpfr_set_q (frb, q1, MPFR_RNDU);
+ mpfr_func (frb, frb, q2, MPFR_RNDU);
+ mpfr_set_q (frq, qr, MPFR_RNDN);
/* We should have fra <= qr <= frb */
if ( (mpfr_cmp(fra, frq) > 0) || (mpfr_cmp (frq, frb) > 0))
{
diff --git a/tests/thyperbolic.c b/tests/thyperbolic.c
index 2c05989b7..660c64cda 100644
--- a/tests/thyperbolic.c
+++ b/tests/thyperbolic.c
@@ -43,7 +43,7 @@ check_NAN (void)
/******cosh********/
- tester=mpfr_cosh(ch,t,GMP_RNDD);
+ tester=mpfr_cosh(ch,t,MPFR_RNDD);
if (!MPFR_IS_NAN(ch) || tester!=0)
{
printf("cosh NAN \n");
@@ -53,7 +53,7 @@ check_NAN (void)
/******sinh********/
- tester=mpfr_sinh(sh,t,GMP_RNDD);
+ tester=mpfr_sinh(sh,t,MPFR_RNDD);
if (!MPFR_IS_NAN(sh) || tester!=0)
{
printf("sinh NAN \n");
@@ -63,7 +63,7 @@ check_NAN (void)
/******tanh********/
- tester=mpfr_tanh(th,t,GMP_RNDD);
+ tester=mpfr_tanh(th,t,MPFR_RNDD);
if (!MPFR_IS_NAN(th) || tester!=0)
{
printf("tanh NAN \n");
@@ -73,7 +73,7 @@ check_NAN (void)
/******acosh********/
- tester=mpfr_acosh(ach,t,GMP_RNDD);
+ tester=mpfr_acosh(ach,t,MPFR_RNDD);
if (!MPFR_IS_NAN(ach) || tester!=0)
{
printf("acosh NAN \n");
@@ -83,7 +83,7 @@ check_NAN (void)
/******asinh********/
- tester=mpfr_asinh(ash,t,GMP_RNDD);
+ tester=mpfr_asinh(ash,t,MPFR_RNDD);
if (!MPFR_IS_NAN(ash) || tester!=0)
{
printf("asinh NAN \n");
@@ -93,7 +93,7 @@ check_NAN (void)
/******atanh********/
- tester=mpfr_atanh(ath,t,GMP_RNDD);
+ tester=mpfr_atanh(ath,t,MPFR_RNDD);
if (!MPFR_IS_NAN(ath) || tester!=0)
{
printf("atanh NAN \n");
@@ -128,11 +128,11 @@ check_zero (void)
mpfr_init2(ash,200);
mpfr_init2(ath,200);
- mpfr_set_ui(t,0,GMP_RNDD);
+ mpfr_set_ui(t,0,MPFR_RNDD);
/******cosh********/
- tester = mpfr_cosh (ch, t, GMP_RNDD);
+ tester = mpfr_cosh (ch, t, MPFR_RNDD);
if (mpfr_cmp_ui(ch, 1) || tester)
{
printf("cosh(0) \n");
@@ -142,7 +142,7 @@ check_zero (void)
/******sinh********/
- tester = mpfr_sinh (sh, t, GMP_RNDD);
+ tester = mpfr_sinh (sh, t, MPFR_RNDD);
if (!MPFR_IS_ZERO(sh) || tester)
{
printf("sinh(0) \n");
@@ -152,7 +152,7 @@ check_zero (void)
/******tanh********/
- tester = mpfr_tanh (th, t, GMP_RNDD);
+ tester = mpfr_tanh (th, t, MPFR_RNDD);
if (!MPFR_IS_ZERO(th) || tester)
{
printf("tanh(0) \n");
@@ -162,7 +162,7 @@ check_zero (void)
/******acosh********/
- tester=mpfr_acosh(ach,t,GMP_RNDD);
+ tester=mpfr_acosh(ach,t,MPFR_RNDD);
if (!MPFR_IS_NAN(ach) || tester)
{
printf("acosh(0) \n");
@@ -172,7 +172,7 @@ check_zero (void)
/******asinh********/
- tester=mpfr_asinh(ash,t,GMP_RNDD);
+ tester=mpfr_asinh(ash,t,MPFR_RNDD);
if (!MPFR_IS_ZERO(ash) || tester)
{
printf("asinh(0) \n");
@@ -182,7 +182,7 @@ check_zero (void)
/******atanh********/
- tester=mpfr_atanh(ath,t,GMP_RNDD);
+ tester=mpfr_atanh(ath,t,MPFR_RNDD);
if (!MPFR_IS_ZERO(ath) || tester)
{
printf("atanh(0) \n");
@@ -224,7 +224,7 @@ check_INF (void)
/******cosh********/
- tester = mpfr_cosh(ch,t,GMP_RNDD);
+ tester = mpfr_cosh(ch,t,MPFR_RNDD);
if (!MPFR_IS_INF(ch) || MPFR_SIGN(ch) < 0 || tester!=0)
{
printf("cosh(INF) \n");
@@ -234,7 +234,7 @@ check_INF (void)
/******sinh********/
- tester=mpfr_sinh(sh,t,GMP_RNDD);
+ tester=mpfr_sinh(sh,t,MPFR_RNDD);
if (!MPFR_IS_INF(sh) || MPFR_SIGN(sh) < 0 || tester!=0)
{
printf("sinh(INF) \n");
@@ -244,7 +244,7 @@ check_INF (void)
/******tanh********/
- tester=mpfr_tanh(th,t,GMP_RNDD);
+ tester=mpfr_tanh(th,t,MPFR_RNDD);
if (mpfr_cmp_ui(th,1) != 0 || tester!=0)
{
printf("tanh(INF) \n");
@@ -254,7 +254,7 @@ check_INF (void)
/******acosh********/
- tester=mpfr_acosh(ach,t,GMP_RNDD);
+ tester=mpfr_acosh(ach,t,MPFR_RNDD);
if (!MPFR_IS_INF(ach) || MPFR_SIGN(ach) < 0 || tester!=0)
{
printf("acosh(INF) \n");
@@ -264,7 +264,7 @@ check_INF (void)
/******asinh********/
- tester=mpfr_asinh(ash,t,GMP_RNDD);
+ tester=mpfr_asinh(ash,t,MPFR_RNDD);
if (!MPFR_IS_INF(ash) || MPFR_SIGN(ash) < 0 || tester!=0)
{
printf("asinh(INF) \n");
@@ -274,7 +274,7 @@ check_INF (void)
/******atanh********/
- tester = mpfr_atanh (ath, t, GMP_RNDD);
+ tester = mpfr_atanh (ath, t, MPFR_RNDD);
if (!MPFR_IS_NAN(ath) || tester != 0)
{
printf("atanh(INF) \n");
@@ -286,7 +286,7 @@ check_INF (void)
/******cosh********/
- tester=mpfr_cosh(ch,t,GMP_RNDD);
+ tester=mpfr_cosh(ch,t,MPFR_RNDD);
if (!MPFR_IS_INF(ch) || MPFR_SIGN(ch) < 0 || tester!=0)
{
printf("cosh(-INF) \n");
@@ -296,7 +296,7 @@ check_INF (void)
/******sinh********/
- tester=mpfr_sinh(sh,t,GMP_RNDD);
+ tester=mpfr_sinh(sh,t,MPFR_RNDD);
if (!MPFR_IS_INF(sh) || MPFR_SIGN(sh) > 0 || tester!=0)
{
printf("sinh(-INF) \n");
@@ -306,7 +306,7 @@ check_INF (void)
/******tanh********/
- tester=mpfr_tanh(th,t,GMP_RNDD);
+ tester=mpfr_tanh(th,t,MPFR_RNDD);
if (!mpfr_cmp_ui(th,-1) || tester!=0)
{
printf("tanh(-INF) \n");
@@ -316,7 +316,7 @@ check_INF (void)
/******acosh********/
- tester=mpfr_acosh(ach,t,GMP_RNDD);
+ tester=mpfr_acosh(ach,t,MPFR_RNDD);
if (!MPFR_IS_NAN(ach) || tester!=0)
{
printf("acosh(-INF) \n");
@@ -326,7 +326,7 @@ check_INF (void)
/******asinh********/
- tester=mpfr_asinh(ash,t,GMP_RNDD);
+ tester=mpfr_asinh(ash,t,MPFR_RNDD);
if (!MPFR_IS_INF(ash) || MPFR_SIGN(ash) > 0 || tester!=0)
{
printf("asinh(-INF) \n");
@@ -336,7 +336,7 @@ check_INF (void)
/******atanh********/
- tester = mpfr_atanh (ath, t, GMP_RNDD);
+ tester = mpfr_atanh (ath, t, MPFR_RNDD);
if (!MPFR_IS_NAN(ath) || tester != 0)
{
printf("atanh(-INF) \n");
diff --git a/tests/thypot.c b/tests/thypot.c
index 23561fb0c..3f5bdd316 100644
--- a/tests/thypot.c
+++ b/tests/thypot.c
@@ -39,22 +39,22 @@ special (void)
mpfr_init (z);
mpfr_set_nan (x);
- mpfr_hypot (z, x, y, GMP_RNDN);
+ mpfr_hypot (z, x, y, MPFR_RNDN);
MPFR_ASSERTN(mpfr_nan_p (z));
mpfr_set_inf (x, 1);
mpfr_set_inf (y, -1);
- mpfr_hypot (z, x, y, GMP_RNDN);
+ mpfr_hypot (z, x, y, MPFR_RNDN);
MPFR_ASSERTN(mpfr_inf_p (z) && mpfr_sgn (z) > 0);
mpfr_set_inf (x, -1);
mpfr_set_nan (y);
- mpfr_hypot (z, x, y, GMP_RNDN);
+ mpfr_hypot (z, x, y, MPFR_RNDN);
MPFR_ASSERTN(mpfr_inf_p (z) && mpfr_sgn (z) > 0);
mpfr_set_nan (x);
mpfr_set_inf (y, -1);
- mpfr_hypot (z, x, y, GMP_RNDN);
+ mpfr_hypot (z, x, y, MPFR_RNDN);
MPFR_ASSERTN(mpfr_inf_p (z) && mpfr_sgn (z) > 0);
mpfr_clear (x);
@@ -72,21 +72,21 @@ test_large (void)
mpfr_init (z);
mpfr_init (t);
- mpfr_set_ui (x, 21, GMP_RNDN);
- mpfr_set_ui (y, 28, GMP_RNDN);
- mpfr_set_ui (z, 35, GMP_RNDN);
+ mpfr_set_ui (x, 21, MPFR_RNDN);
+ mpfr_set_ui (y, 28, MPFR_RNDN);
+ mpfr_set_ui (z, 35, MPFR_RNDN);
- mpfr_mul_2ui (x, x, MPFR_EMAX_DEFAULT-6, GMP_RNDN);
- mpfr_mul_2ui (y, y, MPFR_EMAX_DEFAULT-6, GMP_RNDN);
- mpfr_mul_2ui (z, z, MPFR_EMAX_DEFAULT-6, GMP_RNDN);
+ mpfr_mul_2ui (x, x, MPFR_EMAX_DEFAULT-6, MPFR_RNDN);
+ mpfr_mul_2ui (y, y, MPFR_EMAX_DEFAULT-6, MPFR_RNDN);
+ mpfr_mul_2ui (z, z, MPFR_EMAX_DEFAULT-6, MPFR_RNDN);
- mpfr_hypot (t, x, y, GMP_RNDN);
+ mpfr_hypot (t, x, y, MPFR_RNDN);
if (mpfr_cmp (z, t))
{
printf ("Error in test_large: got\n");
- mpfr_out_str (stdout, 2, 0, t, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, t, MPFR_RNDN);
printf ("\ninstead of\n");
- mpfr_out_str (stdout, 2, 0, z, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, z, MPFR_RNDN);
printf ("\n");
exit (1);
}
@@ -96,14 +96,14 @@ test_large (void)
mpfr_set_prec (y, 53);
mpfr_set_str_binary (x, "0.11101100011110000011101000010101010011001101000001100E-1021");
mpfr_set_str_binary (y, "0.11111001010011000001110110001101011100001000010010100E-1021");
- mpfr_hypot (t, x, y, GMP_RNDN);
+ mpfr_hypot (t, x, y, MPFR_RNDN);
mpfr_set_str_binary (z, "0.101010111100110111101110111110100110010011001010111E-1020");
if (mpfr_cmp (z, t))
{
printf ("Error in test_large: got\n");
- mpfr_out_str (stdout, 2, 0, t, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, t, MPFR_RNDN);
printf ("\ninstead of\n");
- mpfr_out_str (stdout, 2, 0, z, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, z, MPFR_RNDN);
printf ("\n");
exit (1);
}
@@ -114,14 +114,14 @@ test_large (void)
mpfr_set_prec (t, 2);
mpfr_set_str_binary (x, "0.100111011010010010110100000100000001100010011100110101101111111101011110111011011101010110100101111000111100010100110000100101011110111011100110100110100101110101101100011000001100000001111101110100100100011011011010110111100110010101000111e-7");
mpfr_set_str_binary (y, "0.1111000010000011000111E-10");
- mpfr_hypot (t, x, y, GMP_RNDN);
+ mpfr_hypot (t, x, y, MPFR_RNDN);
mpfr_set_str_binary (z, "0.11E-7");
if (mpfr_cmp (z, t))
{
printf ("Error in test_large: got\n");
- mpfr_out_str (stdout, 2, 0, t, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, t, MPFR_RNDN);
printf ("\ninstead of\n");
- mpfr_out_str (stdout, 2, 0, z, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, z, MPFR_RNDN);
printf ("\n");
exit (1);
}
@@ -141,22 +141,22 @@ test_small (void)
/* Test hypot(x,x) with x = 2^(emin-1). Result is x * sqrt(2). */
mpfr_inits2 (8, x, y, z1, z2, (mpfr_ptr) 0);
- mpfr_set_si_2exp (x, 1, mpfr_get_emin () - 1, GMP_RNDN);
- mpfr_set_si_2exp (y, 1, mpfr_get_emin () - 1, GMP_RNDN);
- mpfr_set_ui (z1, 2, GMP_RNDN);
- inex1 = mpfr_sqrt (z1, z1, GMP_RNDN);
- inex2 = mpfr_mul (z1, z1, x, GMP_RNDN);
+ mpfr_set_si_2exp (x, 1, mpfr_get_emin () - 1, MPFR_RNDN);
+ mpfr_set_si_2exp (y, 1, mpfr_get_emin () - 1, MPFR_RNDN);
+ mpfr_set_ui (z1, 2, MPFR_RNDN);
+ inex1 = mpfr_sqrt (z1, z1, MPFR_RNDN);
+ inex2 = mpfr_mul (z1, z1, x, MPFR_RNDN);
MPFR_ASSERTN (inex2 == 0);
mpfr_clear_flags ();
- inex2 = mpfr_hypot (z2, x, y, GMP_RNDN);
+ inex2 = mpfr_hypot (z2, x, y, MPFR_RNDN);
flags = __gmpfr_flags;
if (mpfr_cmp (z1, z2) != 0)
{
printf ("Error in test_small%s\nExpected ",
ext ? ", extended exponent range" : "");
- mpfr_out_str (stdout, 2, 0, z1, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, z1, MPFR_RNDN);
printf ("\nGot ");
- mpfr_out_str (stdout, 2, 0, z2, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, z2, MPFR_RNDN);
printf ("\n");
exit (1);
}
@@ -186,9 +186,9 @@ test_large_small (void)
mpfr_init2 (y, 2);
mpfr_init2 (z, 2);
- mpfr_set_ui_2exp (x, 1, mpfr_get_emax () / 2, GMP_RNDN);
- mpfr_set_ui_2exp (y, 1, -1, GMP_RNDN);
- inexact = mpfr_hypot (z, x, y, GMP_RNDN);
+ mpfr_set_ui_2exp (x, 1, mpfr_get_emax () / 2, MPFR_RNDN);
+ mpfr_set_ui_2exp (y, 1, -1, MPFR_RNDN);
+ inexact = mpfr_hypot (z, x, y, MPFR_RNDN);
if (inexact >= 0 || mpfr_cmp (x, z))
{
printf ("Error 1 in test_large_small%s\n",
@@ -196,30 +196,30 @@ test_large_small (void)
exit (1);
}
- mpfr_mul_ui (x, x, 5, GMP_RNDN);
- inexact = mpfr_hypot (z, x, y, GMP_RNDN);
+ mpfr_mul_ui (x, x, 5, MPFR_RNDN);
+ inexact = mpfr_hypot (z, x, y, MPFR_RNDN);
if (mpfr_cmp (x, z) >= 0)
{
printf ("Error 2 in test_large_small%s\n",
ext ? ", extended exponent range" : "");
printf ("x = ");
- mpfr_out_str (stdout, 2, 0, x, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN);
printf ("\n");
printf ("y = ");
- mpfr_out_str (stdout, 2, 0, y, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN);
printf ("\n");
printf ("z = ");
- mpfr_out_str (stdout, 2, 0, z, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, z, MPFR_RNDN);
printf (" (in precision 2) instead of\n ");
- mpfr_out_str (stdout, 2, 2, x, GMP_RNDU);
+ mpfr_out_str (stdout, 2, 2, x, MPFR_RNDU);
printf ("\n");
exit (1);
}
RND_LOOP(r)
{
- mpfr_set_ui_2exp (x, 1, mpfr_get_emax () - 1, GMP_RNDN);
- mpfr_set_ui_2exp (y, 1, mpfr_get_emin (), GMP_RNDN);
+ mpfr_set_ui_2exp (x, 1, mpfr_get_emax () - 1, MPFR_RNDN);
+ mpfr_set_ui_2exp (y, 1, mpfr_get_emin (), MPFR_RNDN);
inexact = mpfr_hypot (z, x, y, (mp_rnd_t) r);
inex2 = mpfr_add_ui (y, x, 1, (mp_rnd_t) r);
if (! mpfr_equal_p (y, z) || ! SAME_SIGN (inexact, inex2))
@@ -228,10 +228,10 @@ test_large_small (void)
mpfr_print_rnd_mode ((mp_rnd_t) r),
ext ? ", extended exponent range" : "");
printf ("Expected ");
- mpfr_out_str (stdout, 2, 0, y, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN);
printf (", inex = %d\n", inex2);
printf ("Got ");
- mpfr_out_str (stdout, 2, 0, y, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN);
printf (", inex = %d\n", inexact);
exit (1);
}
@@ -249,7 +249,7 @@ check_overflow (void)
int inex, r;
mpfr_inits2 (8, x, y, (mpfr_ptr) 0);
- mpfr_set_ui (x, 1, GMP_RNDN);
+ mpfr_set_ui (x, 1, MPFR_RNDN);
mpfr_setmax (x, mpfr_get_emax ());
RND_LOOP(r)
@@ -264,7 +264,7 @@ check_overflow (void)
exit (1);
}
MPFR_ASSERTN (MPFR_IS_POS (y));
- if (r == GMP_RNDZ || r == GMP_RNDD)
+ if (r == MPFR_RNDZ || r == MPFR_RNDD)
{
MPFR_ASSERTN (inex < 0);
MPFR_ASSERTN (!mpfr_inf_p (y));
diff --git a/tests/tinp_str.c b/tests/tinp_str.c
index 188f7e234..d61bbf1b3 100644
--- a/tests/tinp_str.c
+++ b/tests/tinp_str.c
@@ -42,7 +42,7 @@ main (int argc, char *argv[])
printf ("Error, can't open inp_str.data\n");
exit (1);
}
- i = mpfr_inp_str (x, f, 10, GMP_RNDN);
+ i = mpfr_inp_str (x, f, 10, MPFR_RNDN);
if (i == 0 || mpfr_cmp_ui (x, 31415))
{
printf ("Error in reading 1st line from file inp_str.data (%d)\n", i);
@@ -50,7 +50,7 @@ main (int argc, char *argv[])
exit (1);
}
getc (f);
- i = mpfr_inp_str (x, f, 10, GMP_RNDN);
+ i = mpfr_inp_str (x, f, 10, MPFR_RNDN);
if ((i == 0) || mpfr_cmp_ui (x, 31416))
{
printf ("Error in reading 2nd line from file inp_str.data (%d)\n", i);
@@ -58,7 +58,7 @@ main (int argc, char *argv[])
exit (1);
}
getc (f);
- i = mpfr_inp_str (x, f, 10, GMP_RNDN);
+ i = mpfr_inp_str (x, f, 10, MPFR_RNDN);
if (i != 0)
{
printf ("Error in reading 3rd line from file inp_str.data (%d)\n", i);
diff --git a/tests/tinternals.c b/tests/tinternals.c
index 91cc9d5b6..141ee3835 100644
--- a/tests/tinternals.c
+++ b/tests/tinternals.c
@@ -60,14 +60,14 @@ test_round_near_x (void)
mpfr_set_prec (y, 3);
mpfr_set_prec (z, 3);
mpfr_set_prec (eps, 2);
- mpfr_set_ui_2exp (eps, 1, -32, GMP_RNDN);
+ mpfr_set_ui_2exp (eps, 1, -32, MPFR_RNDN);
for (mx = 16; mx < 32; mx++)
{
- mpfr_set_ui_2exp (x, mx, -2, GMP_RNDN);
+ mpfr_set_ui_2exp (x, mx, -2, MPFR_RNDN);
for (p = buffer, neg = 0;
neg <= 1;
- mpfr_neg (x, x, GMP_RNDN), p++, neg++)
+ mpfr_neg (x, x, MPFR_RNDN), p++, neg++)
for (err = 2; err <= 6; err++)
for (dir = 0; dir <= 1; dir++)
RND_LOOP(r)
@@ -91,11 +91,11 @@ test_round_near_x (void)
else
{
printf ("Bad MPFR value (should have got ");
- mpfr_out_str (stdout, 2, 3, z, GMP_RNDZ);
+ mpfr_out_str (stdout, 2, 3, z, MPFR_RNDZ);
printf (") for:\n");
}
- if (!mpfr_get_str (buffer, &e, 2, 5, x, GMP_RNDZ) || e != 3)
+ if (!mpfr_get_str (buffer, &e, 2, 5, x, MPFR_RNDZ) || e != 3)
{
printf ("mpfr_get_str failed in test_round_near_x\n");
exit (1);
@@ -107,7 +107,7 @@ test_round_near_x (void)
if (inex != 0)
{
printf (", y = ");
- mpfr_out_str (stdout, 2, 3, y, GMP_RNDZ);
+ mpfr_out_str (stdout, 2, 3, y, MPFR_RNDZ);
}
printf ("\n");
if (inex == 0)
diff --git a/tests/tisnan.c b/tests/tisnan.c
index 0f1c5678b..460c95e85 100644
--- a/tests/tisnan.c
+++ b/tests/tisnan.c
@@ -35,8 +35,8 @@ main (void)
mpfr_init (x);
/* check +infinity gives non-zero for mpfr_inf_p only */
- mpfr_set_ui (x, 1L, GMP_RNDZ);
- mpfr_div_ui (x, x, 0L, GMP_RNDZ);
+ mpfr_set_ui (x, 1L, MPFR_RNDZ);
+ mpfr_div_ui (x, x, 0L, MPFR_RNDZ);
if (mpfr_nan_p (x) || (mpfr_nan_p) (x) )
{
printf ("Error: mpfr_nan_p(+Inf) gives non-zero\n");
@@ -59,7 +59,7 @@ main (void)
}
/* same for -Inf */
- mpfr_neg (x, x, GMP_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN);
if (mpfr_nan_p (x) || (mpfr_nan_p(x)))
{
printf ("Error: mpfr_nan_p(-Inf) gives non-zero\n");
@@ -82,7 +82,7 @@ main (void)
}
/* same for NaN */
- mpfr_sub (x, x, x, GMP_RNDN);
+ mpfr_sub (x, x, x, MPFR_RNDN);
if (mpfr_nan_p (x) == 0)
{
printf ("Error: mpfr_nan_p(NaN) gives zero\n");
@@ -105,7 +105,7 @@ main (void)
}
/* same for an ordinary number */
- mpfr_set_ui (x, 1, GMP_RNDN);
+ mpfr_set_ui (x, 1, MPFR_RNDN);
if (mpfr_nan_p (x) || (mpfr_nan_p)(x))
{
printf ("Error: mpfr_nan_p(1) gives non-zero\n");
@@ -128,7 +128,7 @@ main (void)
}
/* Same for 0 */
- mpfr_set_ui (x, 0, GMP_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
if (mpfr_nan_p (x) || (mpfr_nan_p)(x))
{
printf ("Error: mpfr_nan_p(0) gives non-zero\n");
diff --git a/tests/tj0.c b/tests/tj0.c
index 40b625848..28d6bd6d7 100644
--- a/tests/tj0.c
+++ b/tests/tj0.c
@@ -42,60 +42,60 @@ main (int argc, char *argv[])
/* special values */
mpfr_set_nan (x);
- mpfr_j0 (y, x, GMP_RNDN);
+ mpfr_j0 (y, x, MPFR_RNDN);
MPFR_ASSERTN(mpfr_nan_p (y));
mpfr_set_inf (x, 1); /* +Inf */
- mpfr_j0 (y, x, GMP_RNDN);
+ mpfr_j0 (y, x, MPFR_RNDN);
MPFR_ASSERTN(mpfr_cmp_ui (y, 0) == 0 && MPFR_IS_POS (y));
mpfr_set_inf (x, -1); /* -Inf */
- mpfr_j0 (y, x, GMP_RNDN);
+ mpfr_j0 (y, x, MPFR_RNDN);
MPFR_ASSERTN(mpfr_cmp_ui (y, 0) == 0 && MPFR_IS_POS (y));
- mpfr_set_ui (x, 0, GMP_RNDN); /* +0 */
- mpfr_j0 (y, x, GMP_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN); /* +0 */
+ mpfr_j0 (y, x, MPFR_RNDN);
MPFR_ASSERTN(mpfr_cmp_ui (y, 1) == 0); /* j0(+0)=1 */
- mpfr_set_ui (x, 0, GMP_RNDN);
- mpfr_neg (x, x, GMP_RNDN); /* -0 */
- mpfr_j0 (y, x, GMP_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN); /* -0 */
+ mpfr_j0 (y, x, MPFR_RNDN);
MPFR_ASSERTN(mpfr_cmp_ui (y, 1) == 0); /* j0(-0)=1 */
mpfr_set_prec (x, 53);
mpfr_set_prec (y, 53);
- mpfr_set_ui (x, 1, GMP_RNDN);
- mpfr_j0 (y, x, GMP_RNDN);
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_j0 (y, x, MPFR_RNDN);
mpfr_set_str_binary (x, "0.1100001111100011111111101101111010111101110001111");
if (mpfr_cmp (x, y))
{
- printf ("Error in mpfr_j0 for x=1, rnd=GMP_RNDN\n");
+ printf ("Error in mpfr_j0 for x=1, rnd=MPFR_RNDN\n");
printf ("Expected "); mpfr_dump (x);
printf ("Got "); mpfr_dump (y);
exit (1);
}
- mpfr_set_si (x, -1, GMP_RNDN);
- mpfr_j0 (y, x, GMP_RNDN);
+ mpfr_set_si (x, -1, MPFR_RNDN);
+ mpfr_j0 (y, x, MPFR_RNDN);
mpfr_set_str_binary (x, "0.1100001111100011111111101101111010111101110001111");
if (mpfr_cmp (x, y))
{
- printf ("Error in mpfr_j0 for x=-1, rnd=GMP_RNDN\n");
+ printf ("Error in mpfr_j0 for x=-1, rnd=MPFR_RNDN\n");
printf ("Expected "); mpfr_dump (x);
printf ("Got "); mpfr_dump (y);
exit (1);
}
/* Bug reported on 2007-07-03 by Sisyphus (assertion failed in r4619) */
- mpfr_set_si (x, 70000, GMP_RNDN);
- mpfr_j0 (y, x, GMP_RNDN);
+ mpfr_set_si (x, 70000, MPFR_RNDN);
+ mpfr_j0 (y, x, MPFR_RNDN);
/* Bug reported by Kevin Rauch on 27 Oct 2007 */
mpfr_set_prec (x, 7);
mpfr_set_prec (y, 7);
- mpfr_set_si (x, -100, GMP_RNDN);
- mpfr_j0 (y, x, GMP_RNDN);
+ mpfr_set_si (x, -100, MPFR_RNDN);
+ mpfr_j0 (y, x, MPFR_RNDN);
MPFR_ASSERTN (! mpfr_nan_p (y) && mpfr_cmp_ui_2exp (y, 41, -11) == 0);
mpfr_clear (x);
diff --git a/tests/tj1.c b/tests/tj1.c
index c6be96dcd..4fe0b4bf9 100644
--- a/tests/tj1.c
+++ b/tests/tj1.c
@@ -42,35 +42,35 @@ main (int argc, char *argv[])
/* special values */
mpfr_set_nan (x);
- mpfr_j1 (y, x, GMP_RNDN);
+ mpfr_j1 (y, x, MPFR_RNDN);
MPFR_ASSERTN(mpfr_nan_p (y));
mpfr_set_inf (x, 1); /* +Inf */
- mpfr_j1 (y, x, GMP_RNDN);
+ mpfr_j1 (y, x, MPFR_RNDN);
MPFR_ASSERTN(mpfr_cmp_ui (y, 0) == 0 && MPFR_IS_POS (y));
mpfr_set_inf (x, -1); /* -Inf */
- mpfr_j1 (y, x, GMP_RNDN);
+ mpfr_j1 (y, x, MPFR_RNDN);
MPFR_ASSERTN(mpfr_cmp_ui (y, 0) == 0 && MPFR_IS_POS (y));
- mpfr_set_ui (x, 0, GMP_RNDN); /* +0 */
- mpfr_j1 (y, x, GMP_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN); /* +0 */
+ mpfr_j1 (y, x, MPFR_RNDN);
MPFR_ASSERTN(mpfr_cmp_ui (y, 0) == 0 && MPFR_IS_POS (y)); /* j1(+0)=+0 */
- mpfr_set_ui (x, 0, GMP_RNDN);
- mpfr_neg (x, x, GMP_RNDN); /* -0 */
- mpfr_j1 (y, x, GMP_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN); /* -0 */
+ mpfr_j1 (y, x, MPFR_RNDN);
MPFR_ASSERTN(mpfr_cmp_ui (y, 0) == 0 && MPFR_IS_NEG (y)); /* j1(-0)=-0 */
mpfr_set_prec (x, 53);
mpfr_set_prec (y, 53);
- mpfr_set_ui (x, 1, GMP_RNDN);
- mpfr_j1 (y, x, GMP_RNDN);
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_j1 (y, x, MPFR_RNDN);
mpfr_set_str_binary (x, "0.0111000010100111001001111011101001011100001100011011");
if (mpfr_cmp (x, y))
{
- printf ("Error in mpfr_j1 for x=1, rnd=GMP_RNDN\n");
+ printf ("Error in mpfr_j1 for x=1, rnd=MPFR_RNDN\n");
printf ("Expected "); mpfr_dump (x);
printf ("Got "); mpfr_dump (y);
exit (1);
diff --git a/tests/tjn.c b/tests/tjn.c
index 8a8fc5119..2180a05f5 100644
--- a/tests/tjn.c
+++ b/tests/tjn.c
@@ -35,9 +35,9 @@ main (int argc, char *argv[])
if (argc > 1)
{
mpfr_init2 (x, atoi (argv[1]));
- mpfr_set_str (x, argv[3], 10, GMP_RNDN);
- mpfr_jn (x, atoi (argv[2]), x, GMP_RNDN);
- mpfr_out_str (stdout, 10, 10, x, GMP_RNDN);
+ mpfr_set_str (x, argv[3], 10, MPFR_RNDN);
+ mpfr_jn (x, atoi (argv[2]), x, MPFR_RNDN);
+ mpfr_out_str (stdout, 10, 10, x, MPFR_RNDN);
printf ("\n");
mpfr_clear (x);
return 0;
@@ -50,201 +50,201 @@ main (int argc, char *argv[])
/* special values */
mpfr_set_nan (x);
- mpfr_jn (y, 17, x, GMP_RNDN);
+ mpfr_jn (y, 17, x, MPFR_RNDN);
MPFR_ASSERTN(mpfr_nan_p (y));
mpfr_set_inf (x, 1); /* +Inf */
- mpfr_jn (y, 17, x, GMP_RNDN);
+ mpfr_jn (y, 17, x, MPFR_RNDN);
MPFR_ASSERTN(mpfr_cmp_ui (y, 0) == 0 && MPFR_IS_POS (y));
mpfr_set_inf (x, -1); /* -Inf */
- mpfr_jn (y, 17, x, GMP_RNDN);
+ mpfr_jn (y, 17, x, MPFR_RNDN);
MPFR_ASSERTN(mpfr_cmp_ui (y, 0) == 0 && MPFR_IS_POS (y));
- mpfr_set_ui (x, 0, GMP_RNDN); /* +0 */
- mpfr_jn (y, 0, x, GMP_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN); /* +0 */
+ mpfr_jn (y, 0, x, MPFR_RNDN);
MPFR_ASSERTN(mpfr_cmp_ui (y, 1) == 0); /* j0(+0)=1 */
- mpfr_jn (y, 17, x, GMP_RNDN);
+ mpfr_jn (y, 17, x, MPFR_RNDN);
MPFR_ASSERTN(mpfr_cmp_ui (y, 0) == 0 && MPFR_IS_POS (y)); /* j17(+0)=+0 */
- mpfr_jn (y, -17, x, GMP_RNDN);
+ mpfr_jn (y, -17, x, MPFR_RNDN);
MPFR_ASSERTN(mpfr_cmp_ui (y, 0) == 0 && MPFR_IS_NEG (y)); /* j-17(+0)=-0 */
- mpfr_jn (y, 42, x, GMP_RNDN);
+ mpfr_jn (y, 42, x, MPFR_RNDN);
MPFR_ASSERTN(mpfr_cmp_ui (y, 0) == 0 && MPFR_IS_POS (y)); /* j42(+0)=+0 */
- mpfr_set_ui (x, 0, GMP_RNDN);
- mpfr_neg (x, x, GMP_RNDN); /* -0 */
- mpfr_jn (y, 0, x, GMP_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN); /* -0 */
+ mpfr_jn (y, 0, x, MPFR_RNDN);
MPFR_ASSERTN(mpfr_cmp_ui (y, 1) == 0); /* j0(-0)=1 */
- mpfr_jn (y, 17, x, GMP_RNDN);
+ mpfr_jn (y, 17, x, MPFR_RNDN);
MPFR_ASSERTN(mpfr_cmp_ui (y, 0) == 0 && MPFR_IS_NEG (y)); /* j17(-0)=-0 */
- mpfr_jn (y, -17, x, GMP_RNDN);
+ mpfr_jn (y, -17, x, MPFR_RNDN);
MPFR_ASSERTN(mpfr_cmp_ui (y, 0) == 0 && MPFR_IS_POS (y)); /* j-17(-0)=+0 */
- mpfr_jn (y, 42, x, GMP_RNDN);
+ mpfr_jn (y, 42, x, MPFR_RNDN);
MPFR_ASSERTN(mpfr_cmp_ui (y, 0) == 0 && MPFR_IS_POS (y)); /* j42(-0)=+0 */
mpfr_set_prec (x, 53);
mpfr_set_prec (y, 53);
- mpfr_set_ui (x, 1, GMP_RNDN);
- mpfr_jn (y, 0, x, GMP_RNDN);
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_jn (y, 0, x, MPFR_RNDN);
mpfr_set_str_binary (x, "0.1100001111100011111111101101111010111101110001111");
if (mpfr_cmp (x, y))
{
- printf ("Error in mpfr_jn for n=0, x=1, rnd=GMP_RNDN\n");
+ printf ("Error in mpfr_jn for n=0, x=1, rnd=MPFR_RNDN\n");
printf ("Expected "); mpfr_dump (x);
printf ("Got "); mpfr_dump (y);
exit (1);
}
- mpfr_set_si (x, -1, GMP_RNDN);
- mpfr_jn (y, 0, x, GMP_RNDN);
+ mpfr_set_si (x, -1, MPFR_RNDN);
+ mpfr_jn (y, 0, x, MPFR_RNDN);
mpfr_set_str_binary (x, "0.1100001111100011111111101101111010111101110001111");
if (mpfr_cmp (x, y))
{
- printf ("Error in mpfr_jn for n=0, x=-1, rnd=GMP_RNDN\n");
+ printf ("Error in mpfr_jn for n=0, x=-1, rnd=MPFR_RNDN\n");
printf ("Expected "); mpfr_dump (x);
printf ("Got "); mpfr_dump (y);
exit (1);
}
- mpfr_set_ui (x, 1, GMP_RNDN);
- mpfr_jn (y, 1, x, GMP_RNDN);
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_jn (y, 1, x, MPFR_RNDN);
mpfr_set_str_binary (x, "0.0111000010100111001001111011101001011100001100011011");
if (mpfr_cmp (x, y))
{
- printf ("Error in mpfr_jn for n=1, x=1, rnd=GMP_RNDN\n");
+ printf ("Error in mpfr_jn for n=1, x=1, rnd=MPFR_RNDN\n");
printf ("Expected "); mpfr_dump (x);
printf ("Got "); mpfr_dump (y);
exit (1);
}
- mpfr_set_ui (x, 1, GMP_RNDN);
- mpfr_jn (y, 17, x, GMP_RNDN);
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_jn (y, 17, x, MPFR_RNDN);
mpfr_set_str_binary (x, "0.1100011111001010101001001001000110110000010001011E-65");
if (mpfr_cmp (x, y))
{
- printf ("Error in mpfr_jn for n=17, x=1, rnd=GMP_RNDN\n");
+ printf ("Error in mpfr_jn for n=17, x=1, rnd=MPFR_RNDN\n");
printf ("Expected "); mpfr_dump (x);
printf ("Got "); mpfr_dump (y);
exit (1);
}
- mpfr_set_ui (x, 1, GMP_RNDN);
- mpfr_jn (y, 42, x, GMP_RNDN);
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_jn (y, 42, x, MPFR_RNDN);
mpfr_set_str_binary (x, "0.10000111100011010100111011100111101101000100000001001E-211");
if (mpfr_cmp (x, y))
{
- printf ("Error in mpfr_jn for n=42, x=1, rnd=GMP_RNDN\n");
+ printf ("Error in mpfr_jn for n=42, x=1, rnd=MPFR_RNDN\n");
printf ("Expected "); mpfr_dump (x);
printf ("Got "); mpfr_dump (y);
exit (1);
}
- mpfr_set_ui (x, 1, GMP_RNDN);
- mpfr_jn (y, -42, x, GMP_RNDN);
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_jn (y, -42, x, MPFR_RNDN);
mpfr_set_str_binary (x, "0.10000111100011010100111011100111101101000100000001001E-211");
if (mpfr_cmp (x, y))
{
- printf ("Error in mpfr_jn for n=-42, x=1, rnd=GMP_RNDN\n");
+ printf ("Error in mpfr_jn for n=-42, x=1, rnd=MPFR_RNDN\n");
printf ("Expected "); mpfr_dump (x);
printf ("Got "); mpfr_dump (y);
exit (1);
}
- mpfr_set_si (x, -1, GMP_RNDN);
- mpfr_jn (y, 42, x, GMP_RNDN);
+ mpfr_set_si (x, -1, MPFR_RNDN);
+ mpfr_jn (y, 42, x, MPFR_RNDN);
mpfr_set_str_binary (x, "0.10000111100011010100111011100111101101000100000001001E-211");
if (mpfr_cmp (x, y))
{
- printf ("Error in mpfr_jn for n=42, x=-1, rnd=GMP_RNDN\n");
+ printf ("Error in mpfr_jn for n=42, x=-1, rnd=MPFR_RNDN\n");
printf ("Expected "); mpfr_dump (x);
printf ("Got "); mpfr_dump (y);
exit (1);
}
- mpfr_set_si (x, -1, GMP_RNDN);
- mpfr_jn (y, -42, x, GMP_RNDN);
+ mpfr_set_si (x, -1, MPFR_RNDN);
+ mpfr_jn (y, -42, x, MPFR_RNDN);
mpfr_set_str_binary (x, "0.10000111100011010100111011100111101101000100000001001E-211");
if (mpfr_cmp (x, y))
{
- printf ("Error in mpfr_jn for n=-42, x=-1, rnd=GMP_RNDN\n");
+ printf ("Error in mpfr_jn for n=-42, x=-1, rnd=MPFR_RNDN\n");
printf ("Expected "); mpfr_dump (x);
printf ("Got "); mpfr_dump (y);
exit (1);
}
- mpfr_set_ui (x, 17, GMP_RNDN);
- mpfr_jn (y, 4, x, GMP_RNDN);
+ mpfr_set_ui (x, 17, MPFR_RNDN);
+ mpfr_jn (y, 4, x, MPFR_RNDN);
mpfr_set_str_binary (x, "-0.0001110001011001100010100111100111100000111110111011111");
if (mpfr_cmp (x, y))
{
- printf ("Error in mpfr_jn for n=4, x=17, rnd=GMP_RNDN\n");
+ printf ("Error in mpfr_jn for n=4, x=17, rnd=MPFR_RNDN\n");
printf ("Expected "); mpfr_dump (x);
printf ("Got "); mpfr_dump (y);
exit (1);
}
- mpfr_set_ui (x, 17, GMP_RNDN);
- mpfr_jn (y, 16, x, GMP_RNDN);
+ mpfr_set_ui (x, 17, MPFR_RNDN);
+ mpfr_jn (y, 16, x, MPFR_RNDN);
mpfr_set_str_binary (x, "0.0011101111100111101111010100000111111001111001001010011");
if (mpfr_cmp (x, y))
{
- printf ("Error in mpfr_jn for n=16, x=17, rnd=GMP_RNDN\n");
+ printf ("Error in mpfr_jn for n=16, x=17, rnd=MPFR_RNDN\n");
printf ("Expected "); mpfr_dump (x);
printf ("Got "); mpfr_dump (y);
exit (1);
}
- mpfr_set_ui (x, 17, GMP_RNDN);
- mpfr_jn (y, 256, x, GMP_RNDN);
+ mpfr_set_ui (x, 17, MPFR_RNDN);
+ mpfr_jn (y, 256, x, MPFR_RNDN);
mpfr_set_str_binary (x, "0.11111101111100110000000010111101101011101011110001011E-894");
if (mpfr_cmp (x, y))
{
- printf ("Error in mpfr_jn for n=256, x=17, rnd=GMP_RNDN\n");
+ printf ("Error in mpfr_jn for n=256, x=17, rnd=MPFR_RNDN\n");
printf ("Expected "); mpfr_dump (x);
printf ("Got "); mpfr_dump (y);
exit (1);
}
- mpfr_set_ui (x, 17, GMP_RNDN);
- mpfr_jn (y, 65536, x, GMP_RNDN);
+ mpfr_set_ui (x, 17, MPFR_RNDN);
+ mpfr_jn (y, 65536, x, MPFR_RNDN);
mpfr_set_str_binary (x, "100010010010011010110101100001000100011100010111011E-751747");
if (mpfr_cmp (x, y))
{
- printf ("Error in mpfr_jn for n=65536, x=17, rnd=GMP_RNDN\n");
+ printf ("Error in mpfr_jn for n=65536, x=17, rnd=MPFR_RNDN\n");
printf ("Expected "); mpfr_dump (x);
printf ("Got "); mpfr_dump (y);
exit (1);
}
- mpfr_set_ui (x, 17, GMP_RNDN);
- mpfr_jn (y, 131072, x, GMP_RNDN);
+ mpfr_set_ui (x, 17, MPFR_RNDN);
+ mpfr_jn (y, 131072, x, MPFR_RNDN);
mpfr_set_str_binary (x, "1000001001110011111001110110000010011010000001001101E-1634508");
if (mpfr_cmp (x, y))
{
- printf ("Error in mpfr_jn for n=131072, x=17, rnd=GMP_RNDN\n");
+ printf ("Error in mpfr_jn for n=131072, x=17, rnd=MPFR_RNDN\n");
printf ("Expected "); mpfr_dump (x);
printf ("Got "); mpfr_dump (y);
exit (1);
}
- mpfr_set_ui (x, 17, GMP_RNDN);
- mpfr_jn (y, 262144, x, GMP_RNDN);
+ mpfr_set_ui (x, 17, MPFR_RNDN);
+ mpfr_jn (y, 262144, x, MPFR_RNDN);
mpfr_set_str_binary (x, "1010011011000100111011001011110001000010000010111111E-3531100");
if (mpfr_cmp (x, y))
{
- printf ("Error in mpfr_jn for n=262144, x=17, rnd=GMP_RNDN\n");
+ printf ("Error in mpfr_jn for n=262144, x=17, rnd=MPFR_RNDN\n");
printf ("Expected "); mpfr_dump (x);
printf ("Got "); mpfr_dump (y);
exit (1);
}
- mpfr_set_ui (x, 17, GMP_RNDN);
- mpfr_jn (y, 524288, x, GMP_RNDN);
+ mpfr_set_ui (x, 17, MPFR_RNDN);
+ mpfr_jn (y, 524288, x, MPFR_RNDN);
mpfr_set_str_binary (x, "110000001010001111011011000011001011010100010001011E-7586426");
if (mpfr_cmp (x, y))
{
- printf ("Error in mpfr_jn for n=524288, x=17, rnd=GMP_RNDN\n");
+ printf ("Error in mpfr_jn for n=524288, x=17, rnd=MPFR_RNDN\n");
printf ("Expected "); mpfr_dump (x);
printf ("Got "); mpfr_dump (y);
exit (1);
@@ -254,45 +254,45 @@ main (int argc, char *argv[])
/* ensures n is odd */
if (n % 2 == 0)
n --;
- mpfr_set_ui (x, 17, GMP_RNDN);
- mpfr_jn (y, n, x, GMP_RNDN);
+ mpfr_set_ui (x, 17, MPFR_RNDN);
+ mpfr_jn (y, n, x, MPFR_RNDN);
mpfr_set_str_binary (x, "0.0");
if (mpfr_cmp (x, y))
{
- printf ("Error in mpfr_jn for n=%ld, x=17, rnd=GMP_RNDN\n", n);
+ printf ("Error in mpfr_jn for n=%ld, x=17, rnd=MPFR_RNDN\n", n);
printf ("Expected "); mpfr_dump (x);
printf ("Got "); mpfr_dump (y);
exit (1);
}
- mpfr_set_si (x, -17, GMP_RNDN);
- mpfr_jn (y, n, x, GMP_RNDN);
+ mpfr_set_si (x, -17, MPFR_RNDN);
+ mpfr_jn (y, n, x, MPFR_RNDN);
mpfr_set_str_binary (x, "-0.0");
if (mpfr_cmp (x, y))
{
- printf ("Error in mpfr_jn for n=%ld, x=-17, rnd=GMP_RNDN\n", n);
+ printf ("Error in mpfr_jn for n=%ld, x=-17, rnd=MPFR_RNDN\n", n);
printf ("Expected "); mpfr_dump (x);
printf ("Got "); mpfr_dump (y);
exit (1);
}
- mpfr_set_ui (x, 17, GMP_RNDN);
- mpfr_jn (y, -n, x, GMP_RNDN);
+ mpfr_set_ui (x, 17, MPFR_RNDN);
+ mpfr_jn (y, -n, x, MPFR_RNDN);
mpfr_set_str_binary (x, "-0.0");
if (mpfr_cmp (x, y))
{
- printf ("Error in mpfr_jn for n=%ld, x=17, rnd=GMP_RNDN\n", -n);
+ printf ("Error in mpfr_jn for n=%ld, x=17, rnd=MPFR_RNDN\n", -n);
printf ("Expected "); mpfr_dump (x);
printf ("Got "); mpfr_dump (y);
exit (1);
}
- mpfr_set_si (x, -17, GMP_RNDN);
- mpfr_jn (y, -n, x, GMP_RNDN);
+ mpfr_set_si (x, -17, MPFR_RNDN);
+ mpfr_jn (y, -n, x, MPFR_RNDN);
mpfr_set_str_binary (x, "0.0");
if (mpfr_cmp (x, y))
{
- printf ("Error in mpfr_jn for n=%ld, x=-17, rnd=GMP_RNDN\n", -n);
+ printf ("Error in mpfr_jn for n=%ld, x=-17, rnd=MPFR_RNDN\n", -n);
printf ("Expected "); mpfr_dump (x);
printf ("Got "); mpfr_dump (y);
exit (1);
diff --git a/tests/tl2b.c b/tests/tl2b.c
index 73f1d4487..08667cad2 100644
--- a/tests/tl2b.c
+++ b/tests/tl2b.c
@@ -96,16 +96,16 @@ compute_l2b (int output)
{
/* 23-bit upper approximation to log(b)/log(2) */
mpfr_init2 (p, 23);
- mpfr_set_ui (p, beta, GMP_RNDU);
- mpfr_log2 (p, p, GMP_RNDU);
+ mpfr_set_ui (p, beta, MPFR_RNDU);
+ mpfr_log2 (p, p, MPFR_RNDU);
}
else
{
/* 76-bit upper approximation to log(2)/log(b) */
mpfr_init2 (p, 77);
- mpfr_set_ui (p, beta, GMP_RNDD);
- mpfr_log2 (p, p, GMP_RNDD);
- mpfr_ui_div (p, 1, p, GMP_RNDU);
+ mpfr_set_ui (p, beta, MPFR_RNDD);
+ mpfr_log2 (p, p, MPFR_RNDD);
+ mpfr_ui_div (p, 1, p, MPFR_RNDU);
}
sprintf (buffer, "mpfr_l2b_%d_%d", beta, i);
diff --git a/tests/tlgamma.c b/tests/tlgamma.c
index af4d089cb..b7829f8a0 100644
--- a/tests/tlgamma.c
+++ b/tests/tlgamma.c
@@ -34,15 +34,15 @@ mpfr_lgamma_nosign (mpfr_ptr y, mpfr_srcptr x, mp_rnd_t rnd)
if (!MPFR_IS_SINGULAR (y))
{
MPFR_ASSERTN (sign == 1 || sign == -1);
- if (sign == -1 && (rnd == GMP_RNDN || rnd == GMP_RNDZ))
+ if (sign == -1 && (rnd == MPFR_RNDN || rnd == MPFR_RNDZ))
{
- mpfr_neg (y, y, GMP_RNDN);
+ mpfr_neg (y, y, MPFR_RNDN);
inex = -inex;
/* This is a way to check with the generic tests, that the value
returned in the sign variable is consistent, but warning! The
tested function depends on the rounding mode: it is
- * lgamma(x) = log(|Gamma(x)|) in GMP_RNDD and GMP_RNDU;
- * lgamma(x) * sign(Gamma(x)) in GMP_RNDN and GMP_RNDZ. */
+ * lgamma(x) = log(|Gamma(x)|) in MPFR_RNDD and MPFR_RNDU;
+ * lgamma(x) * sign(Gamma(x)) in MPFR_RNDN and MPFR_RNDZ. */
}
}
@@ -64,7 +64,7 @@ special (void)
mpfr_init (y);
mpfr_set_nan (x);
- mpfr_lgamma (y, &sign, x, GMP_RNDN);
+ mpfr_lgamma (y, &sign, x, MPFR_RNDN);
if (!mpfr_nan_p (y))
{
printf ("Error for lgamma(NaN)\n");
@@ -72,7 +72,7 @@ special (void)
}
mpfr_set_inf (x, -1);
- mpfr_lgamma (y, &sign, x, GMP_RNDN);
+ mpfr_lgamma (y, &sign, x, MPFR_RNDN);
if (!mpfr_inf_p (y) || mpfr_sgn (y) < 0)
{
printf ("Error for lgamma(-Inf)\n");
@@ -81,52 +81,52 @@ special (void)
mpfr_set_inf (x, 1);
sign = -17;
- mpfr_lgamma (y, &sign, x, GMP_RNDN);
+ mpfr_lgamma (y, &sign, x, MPFR_RNDN);
if (!mpfr_inf_p (y) || mpfr_sgn (y) < 0 || sign != 1)
{
printf ("Error for lgamma(+Inf)\n");
exit (1);
}
- mpfr_set_ui (x, 0, GMP_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
sign = -17;
- mpfr_lgamma (y, &sign, x, GMP_RNDN);
+ mpfr_lgamma (y, &sign, x, MPFR_RNDN);
if (!mpfr_inf_p (y) || mpfr_sgn (y) < 0 || sign != 1)
{
printf ("Error for lgamma(+0)\n");
exit (1);
}
- mpfr_set_ui (x, 0, GMP_RNDN);
- mpfr_neg (x, x, GMP_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN);
sign = -17;
- mpfr_lgamma (y, &sign, x, GMP_RNDN);
+ mpfr_lgamma (y, &sign, x, MPFR_RNDN);
if (!mpfr_inf_p (y) || mpfr_sgn (y) < 0 || sign != -1)
{
printf ("Error for lgamma(-0)\n");
exit (1);
}
- mpfr_set_ui (x, 1, GMP_RNDN);
+ mpfr_set_ui (x, 1, MPFR_RNDN);
sign = -17;
- mpfr_lgamma (y, &sign, x, GMP_RNDN);
+ mpfr_lgamma (y, &sign, x, MPFR_RNDN);
if (MPFR_IS_NAN (y) || mpfr_cmp_ui (y, 0) || MPFR_IS_NEG (y) || sign != 1)
{
printf ("Error for lgamma(1)\n");
exit (1);
}
- mpfr_set_si (x, -1, GMP_RNDN);
- mpfr_lgamma (y, &sign, x, GMP_RNDN);
+ mpfr_set_si (x, -1, MPFR_RNDN);
+ mpfr_lgamma (y, &sign, x, MPFR_RNDN);
if (!mpfr_inf_p (y) || mpfr_sgn (y) < 0)
{
printf ("Error for lgamma(-1)\n");
exit (1);
}
- mpfr_set_ui (x, 2, GMP_RNDN);
+ mpfr_set_ui (x, 2, MPFR_RNDN);
sign = -17;
- mpfr_lgamma (y, &sign, x, GMP_RNDN);
+ mpfr_lgamma (y, &sign, x, MPFR_RNDN);
if (MPFR_IS_NAN (y) || mpfr_cmp_ui (y, 0) || MPFR_IS_NEG (y) || sign != 1)
{
printf ("Error for lgamma(2)\n");
@@ -139,10 +139,10 @@ special (void)
#define CHECK_X1 "1.0762904832837976166"
#define CHECK_Y1 "-0.039418362817587634939"
- mpfr_set_str (x, CHECK_X1, 10, GMP_RNDN);
+ mpfr_set_str (x, CHECK_X1, 10, MPFR_RNDN);
sign = -17;
- mpfr_lgamma (y, &sign, x, GMP_RNDN);
- mpfr_set_str (x, CHECK_Y1, 10, GMP_RNDN);
+ mpfr_lgamma (y, &sign, x, MPFR_RNDN);
+ mpfr_set_str (x, CHECK_Y1, 10, MPFR_RNDN);
if (mpfr_equal_p (y, x) == 0 || sign != 1)
{
printf ("mpfr_lgamma("CHECK_X1") is wrong:\n"
@@ -155,10 +155,10 @@ special (void)
#define CHECK_X2 "9.23709516716202383435e-01"
#define CHECK_Y2 "0.049010669407893718563"
- mpfr_set_str (x, CHECK_X2, 10, GMP_RNDN);
+ mpfr_set_str (x, CHECK_X2, 10, MPFR_RNDN);
sign = -17;
- mpfr_lgamma (y, &sign, x, GMP_RNDN);
- mpfr_set_str (x, CHECK_Y2, 10, GMP_RNDN);
+ mpfr_lgamma (y, &sign, x, MPFR_RNDN);
+ mpfr_set_str (x, CHECK_Y2, 10, MPFR_RNDN);
if (mpfr_equal_p (y, x) == 0 || sign != 1)
{
printf ("mpfr_lgamma("CHECK_X2") is wrong:\n"
@@ -171,9 +171,9 @@ special (void)
mpfr_set_prec (x, 8);
mpfr_set_prec (y, 175);
- mpfr_set_ui (x, 33, GMP_RNDN);
+ mpfr_set_ui (x, 33, MPFR_RNDN);
sign = -17;
- mpfr_lgamma (y, &sign, x, GMP_RNDU);
+ mpfr_lgamma (y, &sign, x, MPFR_RNDU);
mpfr_set_prec (x, 175);
mpfr_set_str_binary (x, "0.1010001100011101101011001101110010100001000001000001110011000001101100001111001001000101011011100100010101011110100111110101010100010011010010000101010111001100011000101111E7");
if (mpfr_equal_p (x, y) == 0 || sign != 1)
@@ -184,9 +184,9 @@ special (void)
mpfr_set_prec (x, 21);
mpfr_set_prec (y, 8);
- mpfr_set_ui (y, 120, GMP_RNDN);
+ mpfr_set_ui (y, 120, MPFR_RNDN);
sign = -17;
- mpfr_lgamma (x, &sign, y, GMP_RNDZ);
+ mpfr_lgamma (x, &sign, y, MPFR_RNDZ);
mpfr_set_prec (y, 21);
mpfr_set_str_binary (y, "0.111000101000001100101E9");
if (mpfr_equal_p (x, y) == 0 || sign != 1)
@@ -201,7 +201,7 @@ special (void)
mpfr_set_prec (y, 206);
mpfr_set_str_binary (x, "0.110e10");
sign = -17;
- inex = mpfr_lgamma (y, &sign, x, GMP_RNDN);
+ inex = mpfr_lgamma (y, &sign, x, MPFR_RNDN);
mpfr_set_prec (x, 206);
mpfr_set_str_binary (x, "0.10000111011000000011100010101001100110001110000111100011000100100110110010001011011110101001111011110110000001010100111011010000000011100110110101100111000111010011110010000100010111101010001101000110101001E13");
if (mpfr_equal_p (x, y) == 0 || sign != 1)
@@ -219,7 +219,7 @@ special (void)
mpfr_set_prec (y, 4);
mpfr_set_str_binary (x, "0.1100E-66");
sign = -17;
- mpfr_lgamma (y, &sign, x, GMP_RNDN);
+ mpfr_lgamma (y, &sign, x, MPFR_RNDN);
mpfr_set_str_binary (x, "0.1100E6");
if (mpfr_equal_p (x, y) == 0 || sign != 1)
{
@@ -233,11 +233,11 @@ special (void)
mpfr_set_prec (x, 256);
mpfr_set_prec (y, 32);
- mpfr_set_si_2exp (x, -1, 200, GMP_RNDN);
- mpfr_add_ui (x, x, 1, GMP_RNDN);
- mpfr_div_2ui (x, x, 1, GMP_RNDN);
+ mpfr_set_si_2exp (x, -1, 200, MPFR_RNDN);
+ mpfr_add_ui (x, x, 1, MPFR_RNDN);
+ mpfr_div_2ui (x, x, 1, MPFR_RNDN);
sign = -17;
- mpfr_lgamma (y, &sign, x, GMP_RNDN);
+ mpfr_lgamma (y, &sign, x, MPFR_RNDN);
mpfr_set_prec (x, 32);
mpfr_set_str_binary (x, "-0.10001000111011111011000010100010E207");
if (mpfr_equal_p (x, y) == 0 || sign != 1)
@@ -252,11 +252,11 @@ special (void)
mpfr_set_prec (x, 256);
mpfr_set_prec (y, 32);
- mpfr_set_si_2exp (x, -1, 200, GMP_RNDN);
- mpfr_sub_ui (x, x, 1, GMP_RNDN);
- mpfr_div_2ui (x, x, 1, GMP_RNDN);
+ mpfr_set_si_2exp (x, -1, 200, MPFR_RNDN);
+ mpfr_sub_ui (x, x, 1, MPFR_RNDN);
+ mpfr_div_2ui (x, x, 1, MPFR_RNDN);
sign = -17;
- mpfr_lgamma (y, &sign, x, GMP_RNDN);
+ mpfr_lgamma (y, &sign, x, MPFR_RNDN);
mpfr_set_prec (x, 32);
mpfr_set_str_binary (x, "-0.10001000111011111011000010100010E207");
if (mpfr_equal_p (x, y) == 0 || sign != -1)
@@ -273,7 +273,7 @@ special (void)
mpfr_set_prec (x, 10);
mpfr_set_prec (y, 10);
mpfr_set_str_binary (x, "-0.1101111000E-3");
- inex = mpfr_lgamma (y, &sign, x, GMP_RNDN);
+ inex = mpfr_lgamma (y, &sign, x, MPFR_RNDN);
mpfr_set_str_binary (x, "10.01001011");
if (mpfr_equal_p (x, y) == 0 || sign != -1 || inex >= 0)
{
@@ -289,7 +289,7 @@ special (void)
mpfr_set_prec (x, 18);
mpfr_set_prec (y, 28);
mpfr_set_str_binary (x, "-1.10001101010001101e-196");
- inex = mpfr_lgamma (y, &sign, x, GMP_RNDN);
+ inex = mpfr_lgamma (y, &sign, x, MPFR_RNDN);
mpfr_set_prec (x, 28);
mpfr_set_str_binary (x, "0.100001110110101011011010011E8");
MPFR_ASSERTN (mpfr_equal_p (x, y) && inex < 0);
@@ -313,38 +313,38 @@ special (void)
mpfr_set_prec (y, 53);
mpfr_set_str_binary (x, VAL1);
- mpfr_lgamma (y, &sign, x, GMP_RNDN);
+ mpfr_lgamma (y, &sign, x, MPFR_RNDN);
mpfr_set_str_binary (x, OUT1);
MPFR_ASSERTN(sign == -1 && mpfr_equal_p(x, y));
mpfr_set_str_binary (x, VAL2);
- mpfr_lgamma (y, &sign, x, GMP_RNDN);
+ mpfr_lgamma (y, &sign, x, MPFR_RNDN);
mpfr_set_str_binary (x, OUT2);
MPFR_ASSERTN(sign == -1 && mpfr_equal_p (x, y));
mpfr_set_str_binary (x, VAL3);
- mpfr_lgamma (y, &sign, x, GMP_RNDN);
+ mpfr_lgamma (y, &sign, x, MPFR_RNDN);
mpfr_set_str_binary (x, OUT3);
MPFR_ASSERTN(sign == -1 && mpfr_equal_p (x, y));
mpfr_set_str_binary (x, VAL4);
- mpfr_lgamma (y, &sign, x, GMP_RNDN);
+ mpfr_lgamma (y, &sign, x, MPFR_RNDN);
mpfr_set_str_binary (x, OUT4);
MPFR_ASSERTN(sign == -1 && mpfr_equal_p (x, y));
mpfr_set_str_binary (x, VAL5);
- mpfr_lgamma (y, &sign, x, GMP_RNDN);
+ mpfr_lgamma (y, &sign, x, MPFR_RNDN);
mpfr_set_str_binary (x, OUT5);
MPFR_ASSERTN(sign == -1 && mpfr_equal_p (x, y));
mpfr_set_str_binary (x, VAL6);
- mpfr_lgamma (y, &sign, x, GMP_RNDN);
+ mpfr_lgamma (y, &sign, x, MPFR_RNDN);
mpfr_set_str_binary (x, OUT6);
MPFR_ASSERTN(sign == -1 && mpfr_equal_p (x, y));
/* further test from Kaveh Ghazi */
mpfr_set_str_binary (x, "-0.10011010101001010010001110010111010111011101010111001E-53");
- mpfr_lgamma (y, &sign, x, GMP_RNDN);
+ mpfr_lgamma (y, &sign, x, MPFR_RNDN);
mpfr_set_str_binary (x, "100101.00111101101010000000101010111010001111001101111");
MPFR_ASSERTN(sign == -1 && mpfr_equal_p (x, y));
@@ -353,8 +353,8 @@ special (void)
emax = mpfr_get_emax ();
mpfr_set_emin (-1000000000);
mpfr_set_emax (1000000000);
- mpfr_set_ui (x, 1, GMP_RNDN);
- mpfr_lgamma (x, &sign, x, GMP_RNDN);
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_lgamma (x, &sign, x, MPFR_RNDN);
MPFR_ASSERTN(mpfr_get_emin () == -1000000000);
MPFR_ASSERTN(mpfr_get_emax () == 1000000000);
mpfr_set_emin (emin);
@@ -364,16 +364,16 @@ special (void)
mpfr_set_prec (x, 128);
mpfr_set_prec (y, 128);
mpfr_set_str_binary (x, "0.11000110011110111111110010100110000000000000000000000000000000000000000000000000000000000000000001000011000110100100110111101010E-765689");
- inex = mpfr_lgamma (y, &sign, x, GMP_RNDN);
+ inex = mpfr_lgamma (y, &sign, x, MPFR_RNDN);
mpfr_set_str_binary (x, "10000001100100101111011011010000111010001001110000111010011000101001011111011111110011011010110100101111110111001001010100011101E-108");
MPFR_ASSERTN(inex < 0 && mpfr_cmp (y, x) == 0 && sign > 0);
mpfr_set_prec (x, 128);
mpfr_set_prec (y, 256);
mpfr_set_str_binary (x, "0.1011111111111111100000111011111E-31871");
- inex = mpfr_lgamma (y, &sign, x, GMP_RNDN);
+ inex = mpfr_lgamma (y, &sign, x, MPFR_RNDN);
mpfr_set_prec (x, 256);
- mpfr_set_str (x, "AC9729B83707E6797612D0D76DAF42B1240A677FF1B6E3783FD4E53037143B1P-237", 16, GMP_RNDN);
+ mpfr_set_str (x, "AC9729B83707E6797612D0D76DAF42B1240A677FF1B6E3783FD4E53037143B1P-237", 16, MPFR_RNDN);
MPFR_ASSERTN(inex < 0 && mpfr_cmp (y, x) == 0 && sign > 0);
mpfr_clear (x);
diff --git a/tests/tli2.c b/tests/tli2.c
index 258248e6f..99fa80a86 100644
--- a/tests/tli2.c
+++ b/tests/tli2.c
@@ -36,7 +36,7 @@ special (void)
mpfr_init (y);
mpfr_set_nan (x);
- mpfr_li2 (y, x, GMP_RNDN);
+ mpfr_li2 (y, x, MPFR_RNDN);
if (!mpfr_nan_p (y))
{
printf ("Error for li2(NaN)\n");
@@ -44,7 +44,7 @@ special (void)
}
mpfr_set_inf (x, -1);
- mpfr_li2 (y, x, GMP_RNDN);
+ mpfr_li2 (y, x, MPFR_RNDN);
if (!MPFR_IS_INF (y) || MPFR_IS_POS (y))
{
printf ("Error for li2(-Inf)\n");
@@ -52,24 +52,24 @@ special (void)
}
mpfr_set_inf (x, 1);
- mpfr_li2 (y, x, GMP_RNDN);
+ mpfr_li2 (y, x, MPFR_RNDN);
if (!MPFR_IS_INF (y) || MPFR_IS_POS (y))
{
printf ("Error for li2(+Inf)\n");
exit (1);
}
- mpfr_set_ui (x, 0, GMP_RNDN);
- mpfr_li2 (y, x, GMP_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_li2 (y, x, MPFR_RNDN);
if (!MPFR_IS_ZERO (y) || MPFR_IS_NEG (y))
{
printf ("Error for li2(+0)\n");
exit (1);
}
- mpfr_set_ui (x, 0, GMP_RNDN);
- mpfr_neg (x, x, GMP_RNDN);
- mpfr_li2 (y, x, GMP_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN);
+ mpfr_li2 (y, x, MPFR_RNDN);
if (!MPFR_IS_ZERO (y) || MPFR_IS_POS (y))
{
printf ("Error for li2(-0)\n");
@@ -89,9 +89,9 @@ normal (void)
mpfr_init (y);
/* x1 = 2^-3 */
- mpfr_set_str (x, "1p-3", 2, GMP_RNDD);
- mpfr_li2 (x, x, GMP_RNDN);
- if (mpfr_cmp_str (x, "0x1087a7a9e42141p-55", 16, GMP_RNDN) != 0)
+ mpfr_set_str (x, "1p-3", 2, MPFR_RNDD);
+ mpfr_li2 (x, x, MPFR_RNDN);
+ if (mpfr_cmp_str (x, "0x1087a7a9e42141p-55", 16, MPFR_RNDN) != 0)
{
printf ("Error for li2(x1)\n");
exit (1);
@@ -100,25 +100,25 @@ normal (void)
/* check MPFR_FAST_COMPUTE_IF_SMALL_INPUT */
mpfr_set_prec (x, 2);
mpfr_set_prec (y, 20);
- mpfr_set_ui_2exp (x, 1, -21, GMP_RNDN);
- mpfr_li2 (y, x, GMP_RNDN);
+ mpfr_set_ui_2exp (x, 1, -21, MPFR_RNDN);
+ mpfr_li2 (y, x, MPFR_RNDN);
MPFR_ASSERTN(mpfr_cmp (y, x) == 0);
- mpfr_set_si_2exp (x, -1, -21, GMP_RNDN);
- mpfr_li2 (y, x, GMP_RNDN);
+ mpfr_set_si_2exp (x, -1, -21, MPFR_RNDN);
+ mpfr_li2 (y, x, MPFR_RNDN);
MPFR_ASSERTN(mpfr_cmp (y, x) == 0);
/* worst case */
/* x2 = 0x7F18EA6537E00E983196CDDC6EFAC57Fp-129
Li2(x2) = 2^-2 + 2^-6 + 2^-120 */
mpfr_set_prec (x, 128);
- mpfr_set_str (x, "7F18EA6537E00E983196CDDC6EFAC57Fp-129", 16, GMP_RNDN);
+ mpfr_set_str (x, "7F18EA6537E00E983196CDDC6EFAC57Fp-129", 16, MPFR_RNDN);
/* round to nearest mode and 4 bits of precision,
it should be rounded to 2^-2 + 2^-5 and */
mpfr_set_prec (y, 4);
- inexact = mpfr_li2 (y, x, GMP_RNDN);
- if (inexact != 1 || mpfr_cmp_str (y, "0.1001p-1", 2, GMP_RNDN) != 0)
+ inexact = mpfr_li2 (y, x, MPFR_RNDN);
+ if (inexact != 1 || mpfr_cmp_str (y, "0.1001p-1", 2, MPFR_RNDN) != 0)
{
printf ("Error for li2(x2, RNDN)\n");
exit (1);
@@ -127,8 +127,8 @@ normal (void)
/* round towards zero mode and 5 bits of precision,
it should be rounded to 2^-2 + 2^-6 */
mpfr_set_prec (y, 5);
- inexact = mpfr_li2 (y, x, GMP_RNDZ);
- if (inexact != -1 || mpfr_cmp_str (y, "0.10001p-1", 2, GMP_RNDN) != 0)
+ inexact = mpfr_li2 (y, x, MPFR_RNDZ);
+ if (inexact != -1 || mpfr_cmp_str (y, "0.10001p-1", 2, MPFR_RNDN) != 0)
{
printf ("Error for li2(x2, RNDZ)\n");
exit (1);
@@ -136,8 +136,8 @@ normal (void)
/* round away from zero mode and 5 bits of precision,
it should be rounded to 2^-2 + 2^-5 */
- inexact = mpfr_li2 (y, x, GMP_RNDU);
- if (inexact != 1 || mpfr_cmp_str (y, "0.10010p-1", 2, GMP_RNDN) != 0)
+ inexact = mpfr_li2 (y, x, MPFR_RNDU);
+ if (inexact != 1 || mpfr_cmp_str (y, "0.10010p-1", 2, MPFR_RNDN) != 0)
{
printf ("Error for li2(x2, RNDU)\n");
exit (1);
diff --git a/tests/tlngamma.c b/tests/tlngamma.c
index e67721535..fff8aad20 100644
--- a/tests/tlngamma.c
+++ b/tests/tlngamma.c
@@ -39,7 +39,7 @@ special (void)
mpfr_init (y);
mpfr_set_nan (x);
- mpfr_lngamma (y, x, GMP_RNDN);
+ mpfr_lngamma (y, x, MPFR_RNDN);
if (!mpfr_nan_p (y))
{
printf ("Error for lngamma(NaN)\n");
@@ -47,7 +47,7 @@ special (void)
}
mpfr_set_inf (x, -1);
- mpfr_lngamma (y, x, GMP_RNDN);
+ mpfr_lngamma (y, x, MPFR_RNDN);
if (!mpfr_nan_p (y))
{
printf ("Error for lngamma(-Inf)\n");
@@ -55,48 +55,48 @@ special (void)
}
mpfr_set_inf (x, 1);
- mpfr_lngamma (y, x, GMP_RNDN);
+ mpfr_lngamma (y, x, MPFR_RNDN);
if (!mpfr_inf_p (y) || mpfr_sgn (y) < 0)
{
printf ("Error for lngamma(+Inf)\n");
exit (1);
}
- mpfr_set_ui (x, 0, GMP_RNDN);
- mpfr_lngamma (y, x, GMP_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_lngamma (y, x, MPFR_RNDN);
if (!mpfr_inf_p (y) || mpfr_sgn (y) < 0)
{
printf ("Error for lngamma(+0)\n");
exit (1);
}
- mpfr_set_ui (x, 0, GMP_RNDN);
- mpfr_neg (x, x, GMP_RNDN);
- mpfr_lngamma (y, x, GMP_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN);
+ mpfr_lngamma (y, x, MPFR_RNDN);
if (!mpfr_nan_p (y))
{
printf ("Error for lngamma(-0)\n");
exit (1);
}
- mpfr_set_ui (x, 1, GMP_RNDN);
- mpfr_lngamma (y, x, GMP_RNDN);
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_lngamma (y, x, MPFR_RNDN);
if (MPFR_IS_NAN (y) || mpfr_cmp_ui (y, 0) || MPFR_IS_NEG (y))
{
printf ("Error for lngamma(1)\n");
exit (1);
}
- mpfr_set_si (x, -1, GMP_RNDN);
- mpfr_lngamma (y, x, GMP_RNDN);
+ mpfr_set_si (x, -1, MPFR_RNDN);
+ mpfr_lngamma (y, x, MPFR_RNDN);
if (!mpfr_nan_p (y))
{
printf ("Error for lngamma(-1)\n");
exit (1);
}
- mpfr_set_ui (x, 2, GMP_RNDN);
- mpfr_lngamma (y, x, GMP_RNDN);
+ mpfr_set_ui (x, 2, MPFR_RNDN);
+ mpfr_lngamma (y, x, MPFR_RNDN);
if (MPFR_IS_NAN (y) || mpfr_cmp_ui (y, 0) || MPFR_IS_NEG (y))
{
printf ("Error for lngamma(2)\n");
@@ -109,9 +109,9 @@ special (void)
#define CHECK_X1 "1.0762904832837976166"
#define CHECK_Y1 "-0.039418362817587634939"
- mpfr_set_str (x, CHECK_X1, 10, GMP_RNDN);
- mpfr_lngamma (y, x, GMP_RNDN);
- mpfr_set_str (x, CHECK_Y1, 10, GMP_RNDN);
+ mpfr_set_str (x, CHECK_X1, 10, MPFR_RNDN);
+ mpfr_lngamma (y, x, MPFR_RNDN);
+ mpfr_set_str (x, CHECK_Y1, 10, MPFR_RNDN);
if (MPFR_IS_NAN (y) || mpfr_cmp (y, x))
{
printf ("mpfr_lngamma("CHECK_X1") is wrong:\n"
@@ -124,9 +124,9 @@ special (void)
#define CHECK_X2 "9.23709516716202383435e-01"
#define CHECK_Y2 "0.049010669407893718563"
- mpfr_set_str (x, CHECK_X2, 10, GMP_RNDN);
- mpfr_lngamma (y, x, GMP_RNDN);
- mpfr_set_str (x, CHECK_Y2, 10, GMP_RNDN);
+ mpfr_set_str (x, CHECK_X2, 10, MPFR_RNDN);
+ mpfr_lngamma (y, x, MPFR_RNDN);
+ mpfr_set_str (x, CHECK_Y2, 10, MPFR_RNDN);
if (MPFR_IS_NAN (y) || mpfr_cmp (y, x))
{
printf ("mpfr_lngamma("CHECK_X2") is wrong:\n"
@@ -139,8 +139,8 @@ special (void)
mpfr_set_prec (x, 8);
mpfr_set_prec (y, 175);
- mpfr_set_ui (x, 33, GMP_RNDN);
- mpfr_lngamma (y, x, GMP_RNDU);
+ mpfr_set_ui (x, 33, MPFR_RNDN);
+ mpfr_lngamma (y, x, MPFR_RNDU);
mpfr_set_prec (x, 175);
mpfr_set_str_binary (x, "0.1010001100011101101011001101110010100001000001000001110011000001101100001111001001000101011011100100010101011110100111110101010100010011010010000101010111001100011000101111E7");
if (MPFR_IS_NAN (y) || mpfr_cmp (x, y))
@@ -151,8 +151,8 @@ special (void)
mpfr_set_prec (x, 21);
mpfr_set_prec (y, 8);
- mpfr_set_ui (y, 120, GMP_RNDN);
- mpfr_lngamma (x, y, GMP_RNDZ);
+ mpfr_set_ui (y, 120, MPFR_RNDN);
+ mpfr_lngamma (x, y, MPFR_RNDZ);
mpfr_set_prec (y, 21);
mpfr_set_str_binary (y, "0.111000101000001100101E9");
if (MPFR_IS_NAN (x) || mpfr_cmp (x, y))
@@ -166,7 +166,7 @@ special (void)
mpfr_set_prec (x, 3);
mpfr_set_prec (y, 206);
mpfr_set_str_binary (x, "0.110e10");
- inex = mpfr_lngamma (y, x, GMP_RNDN);
+ inex = mpfr_lngamma (y, x, MPFR_RNDN);
mpfr_set_prec (x, 206);
mpfr_set_str_binary (x, "0.10000111011000000011100010101001100110001110000111100011000100100110110010001011011110101001111011110110000001010100111011010000000011100110110101100111000111010011110010000100010111101010001101000110101001E13");
if (MPFR_IS_NAN (y) || mpfr_cmp (x, y))
@@ -183,7 +183,7 @@ special (void)
mpfr_set_prec (x, 4);
mpfr_set_prec (y, 4);
mpfr_set_str_binary (x, "0.1100E-66");
- mpfr_lngamma (y, x, GMP_RNDN);
+ mpfr_lngamma (y, x, MPFR_RNDN);
mpfr_set_str_binary (x, "0.1100E6");
if (MPFR_IS_NAN (y) || mpfr_cmp (x, y))
{
@@ -193,10 +193,10 @@ special (void)
mpfr_set_prec (x, 256);
mpfr_set_prec (y, 32);
- mpfr_set_si_2exp (x, -1, 200, GMP_RNDN);
- mpfr_add_ui (x, x, 1, GMP_RNDN);
- mpfr_div_2ui (x, x, 1, GMP_RNDN);
- mpfr_lngamma (y, x, GMP_RNDN);
+ mpfr_set_si_2exp (x, -1, 200, MPFR_RNDN);
+ mpfr_add_ui (x, x, 1, MPFR_RNDN);
+ mpfr_div_2ui (x, x, 1, MPFR_RNDN);
+ mpfr_lngamma (y, x, MPFR_RNDN);
mpfr_set_prec (x, 32);
mpfr_set_str_binary (x, "-0.10001000111011111011000010100010E207");
if (MPFR_IS_NAN (y) || mpfr_cmp (x, y))
@@ -211,10 +211,10 @@ special (void)
mpfr_set_prec (x, 256);
mpfr_set_prec (y, 32);
- mpfr_set_si_2exp (x, -1, 200, GMP_RNDN);
- mpfr_sub_ui (x, x, 1, GMP_RNDN);
- mpfr_div_2ui (x, x, 1, GMP_RNDN);
- mpfr_lngamma (y, x, GMP_RNDN);
+ mpfr_set_si_2exp (x, -1, 200, MPFR_RNDN);
+ mpfr_sub_ui (x, x, 1, MPFR_RNDN);
+ mpfr_div_2ui (x, x, 1, MPFR_RNDN);
+ mpfr_lngamma (y, x, MPFR_RNDN);
if (!mpfr_nan_p (y))
{
printf ("Error for lngamma(-2^199-0.5)\n");
diff --git a/tests/tlog.c b/tests/tlog.c
index 990255d2f..ce615c561 100644
--- a/tests/tlog.c
+++ b/tests/tlog.c
@@ -30,7 +30,7 @@ static int
test_log (mpfr_ptr a, mpfr_srcptr b, mp_rnd_t rnd_mode)
{
int res;
- int ok = rnd_mode == GMP_RNDN && mpfr_number_p (b) && mpfr_get_prec (a)>=53;
+ int ok = rnd_mode == MPFR_RNDN && mpfr_number_p (b) && mpfr_get_prec (a)>=53;
if (ok)
{
mpfr_print_raw (b);
@@ -63,7 +63,7 @@ check2 (const char *as, mp_rnd_t rnd_mode, const char *res1s)
as, mpfr_print_rnd_mode (rnd_mode));
printf ("correct result is %s\n mpfr_log gives ",
res1s);
- mpfr_out_str(stdout, 10, 0, tres, GMP_RNDN);
+ mpfr_out_str(stdout, 10, 0, tres, MPFR_RNDN);
exit (1);
}
mpfr_clears (ta, tres, (mpfr_ptr) 0);
@@ -93,85 +93,85 @@ check3 (double d, unsigned long prec, mp_rnd_t rnd)
static void
check_worst_cases (void)
{
- check2("1.00089971802309629645", GMP_RNDD, "8.99313519443722736088e-04");
- check2("1.00089971802309629645", GMP_RNDN, "8.99313519443722844508e-04");
- check2("1.00089971802309629645", GMP_RNDU, "8.99313519443722844508e-04");
+ check2("1.00089971802309629645", MPFR_RNDD, "8.99313519443722736088e-04");
+ check2("1.00089971802309629645", MPFR_RNDN, "8.99313519443722844508e-04");
+ check2("1.00089971802309629645", MPFR_RNDU, "8.99313519443722844508e-04");
- check2("1.01979300812244555452", GMP_RNDD, "1.95996734891603630047e-02");
- check2("1.01979300812244555452", GMP_RNDN, "1.95996734891603664741e-02");
- check2("1.01979300812244555452", GMP_RNDU, "1.95996734891603664741e-02");
+ check2("1.01979300812244555452", MPFR_RNDD, "1.95996734891603630047e-02");
+ check2("1.01979300812244555452", MPFR_RNDN, "1.95996734891603664741e-02");
+ check2("1.01979300812244555452", MPFR_RNDU, "1.95996734891603664741e-02");
- check2("1.02900871924604464525", GMP_RNDD, "2.85959303301472726744e-02");
- check2("1.02900871924604464525", GMP_RNDN, "2.85959303301472761438e-02");
- check2("1.02900871924604464525", GMP_RNDU, "2.85959303301472761438e-02");
+ check2("1.02900871924604464525", MPFR_RNDD, "2.85959303301472726744e-02");
+ check2("1.02900871924604464525", MPFR_RNDN, "2.85959303301472761438e-02");
+ check2("1.02900871924604464525", MPFR_RNDU, "2.85959303301472761438e-02");
- check2("1.27832870030418943585", GMP_RNDD, "2.45553521871417795852e-01");
- check2("1.27832870030418943585", GMP_RNDN, "2.45553521871417823608e-01");
- check2("1.27832870030418943585", GMP_RNDU, "2.45553521871417823608e-01");
+ check2("1.27832870030418943585", MPFR_RNDD, "2.45553521871417795852e-01");
+ check2("1.27832870030418943585", MPFR_RNDN, "2.45553521871417823608e-01");
+ check2("1.27832870030418943585", MPFR_RNDU, "2.45553521871417823608e-01");
- check2("1.31706530746788241792", GMP_RNDD, "2.75406009586277422674e-01");
- check2("1.31706530746788241792", GMP_RNDN, "2.75406009586277478185e-01");
- check2("1.31706530746788241792", GMP_RNDU, "2.75406009586277478185e-01");
+ check2("1.31706530746788241792", MPFR_RNDD, "2.75406009586277422674e-01");
+ check2("1.31706530746788241792", MPFR_RNDN, "2.75406009586277478185e-01");
+ check2("1.31706530746788241792", MPFR_RNDU, "2.75406009586277478185e-01");
- check2("1.47116981099449883885", GMP_RNDD, "3.86057874110010412760e-01");
- check2("1.47116981099449883885", GMP_RNDN, "3.86057874110010412760e-01");
- check2("1.47116981099449883885", GMP_RNDU, "3.86057874110010468272e-01");
+ check2("1.47116981099449883885", MPFR_RNDD, "3.86057874110010412760e-01");
+ check2("1.47116981099449883885", MPFR_RNDN, "3.86057874110010412760e-01");
+ check2("1.47116981099449883885", MPFR_RNDU, "3.86057874110010468272e-01");
- check2("1.58405446812987782401", GMP_RNDD, "4.59987679246663727639e-01");
- check2("1.58405446812987782401", GMP_RNDN, "4.59987679246663783150e-01");
- check2("1.58405446812987782401", GMP_RNDU, "4.59987679246663783150e-01");
+ check2("1.58405446812987782401", MPFR_RNDD, "4.59987679246663727639e-01");
+ check2("1.58405446812987782401", MPFR_RNDN, "4.59987679246663783150e-01");
+ check2("1.58405446812987782401", MPFR_RNDU, "4.59987679246663783150e-01");
- check2("1.67192331263391547047", GMP_RNDD, "5.13974647961076613889e-01");
- check2("1.67192331263391547047", GMP_RNDN, "5.13974647961076724911e-01");
- check2("1.67192331263391547047", GMP_RNDU, "5.13974647961076724911e-01");
+ check2("1.67192331263391547047", MPFR_RNDD, "5.13974647961076613889e-01");
+ check2("1.67192331263391547047", MPFR_RNDN, "5.13974647961076724911e-01");
+ check2("1.67192331263391547047", MPFR_RNDU, "5.13974647961076724911e-01");
- check2("1.71101198068990645318", GMP_RNDD, "5.37084997042120315669e-01");
- check2("1.71101198068990645318", GMP_RNDN, "5.37084997042120315669e-01");
- check2("1.71101198068990645318", GMP_RNDU, "5.37084997042120426691e-01");
+ check2("1.71101198068990645318", MPFR_RNDD, "5.37084997042120315669e-01");
+ check2("1.71101198068990645318", MPFR_RNDN, "5.37084997042120315669e-01");
+ check2("1.71101198068990645318", MPFR_RNDU, "5.37084997042120426691e-01");
- check2("1.72634853551388700588", GMP_RNDD, "5.46008504786553605648e-01");
- check2("1.72634853551388700588", GMP_RNDN, "5.46008504786553716670e-01");
- check2("1.72634853551388700588", GMP_RNDU, "5.46008504786553716670e-01");
+ check2("1.72634853551388700588", MPFR_RNDD, "5.46008504786553605648e-01");
+ check2("1.72634853551388700588", MPFR_RNDN, "5.46008504786553716670e-01");
+ check2("1.72634853551388700588", MPFR_RNDU, "5.46008504786553716670e-01");
- check2("2.00028876593004323325", GMP_RNDD, "6.93291553102749702475e-01");
- check2("2.00028876593004323325", GMP_RNDN, "6.93291553102749813497e-01");
- check2("2.00028876593004323325", GMP_RNDU, "6.93291553102749813497e-01");
+ check2("2.00028876593004323325", MPFR_RNDD, "6.93291553102749702475e-01");
+ check2("2.00028876593004323325", MPFR_RNDN, "6.93291553102749813497e-01");
+ check2("2.00028876593004323325", MPFR_RNDU, "6.93291553102749813497e-01");
- check2("6.27593230200363105808", GMP_RNDD, "1.83672204800630312072");
- check2("6.27593230200363105808", GMP_RNDN, "1.83672204800630334276");
- check2("6.27593230200363105808", GMP_RNDU, "1.83672204800630334276");
+ check2("6.27593230200363105808", MPFR_RNDD, "1.83672204800630312072");
+ check2("6.27593230200363105808", MPFR_RNDN, "1.83672204800630334276");
+ check2("6.27593230200363105808", MPFR_RNDU, "1.83672204800630334276");
- check2("7.47216682321367997588", GMP_RNDD, "2.01118502712453661729");
- check2("7.47216682321367997588", GMP_RNDN, "2.01118502712453706138");
- check2("7.47216682321367997588", GMP_RNDU, "2.01118502712453706138");
+ check2("7.47216682321367997588", MPFR_RNDD, "2.01118502712453661729");
+ check2("7.47216682321367997588", MPFR_RNDN, "2.01118502712453706138");
+ check2("7.47216682321367997588", MPFR_RNDU, "2.01118502712453706138");
- check2("9.34589857718275318632", GMP_RNDD, "2.23493759221664944903");
- check2("9.34589857718275318632", GMP_RNDN, "2.23493759221664989312");
- check2("9.34589857718275318632", GMP_RNDU, "2.23493759221664989312");
+ check2("9.34589857718275318632", MPFR_RNDD, "2.23493759221664944903");
+ check2("9.34589857718275318632", MPFR_RNDN, "2.23493759221664989312");
+ check2("9.34589857718275318632", MPFR_RNDU, "2.23493759221664989312");
- check2("10.6856587560831854944", GMP_RNDD, "2.36890253928838445674");
- check2("10.6856587560831854944", GMP_RNDN, "2.36890253928838445674");
- check2("10.6856587560831854944", GMP_RNDU, "2.36890253928838490083");
+ check2("10.6856587560831854944", MPFR_RNDD, "2.36890253928838445674");
+ check2("10.6856587560831854944", MPFR_RNDN, "2.36890253928838445674");
+ check2("10.6856587560831854944", MPFR_RNDU, "2.36890253928838490083");
- check2("12.4646345033981766903", GMP_RNDD, "2.52289539471636015122");
- check2("12.4646345033981766903", GMP_RNDN, "2.52289539471636015122");
- check2("12.4646345033981766903", GMP_RNDU, "2.52289539471636059531");
+ check2("12.4646345033981766903", MPFR_RNDD, "2.52289539471636015122");
+ check2("12.4646345033981766903", MPFR_RNDN, "2.52289539471636015122");
+ check2("12.4646345033981766903", MPFR_RNDU, "2.52289539471636059531");
- check2("17.0953275851761752335", GMP_RNDD, "2.83880518553861849185");
- check2("17.0953275851761752335", GMP_RNDN, "2.83880518553861893594");
- check2("17.0953275851761752335", GMP_RNDU, "2.83880518553861893594");
+ check2("17.0953275851761752335", MPFR_RNDD, "2.83880518553861849185");
+ check2("17.0953275851761752335", MPFR_RNDN, "2.83880518553861893594");
+ check2("17.0953275851761752335", MPFR_RNDU, "2.83880518553861893594");
- check2("19.8509496207496916043", GMP_RNDD, "2.98825184582516722998");
- check2("19.8509496207496916043", GMP_RNDN, "2.98825184582516722998");
- check2("19.8509496207496916043", GMP_RNDU, "2.98825184582516767406");
+ check2("19.8509496207496916043", MPFR_RNDD, "2.98825184582516722998");
+ check2("19.8509496207496916043", MPFR_RNDN, "2.98825184582516722998");
+ check2("19.8509496207496916043", MPFR_RNDU, "2.98825184582516767406");
- check2("23.9512076062771335216", GMP_RNDD, "3.17601874455977206679");
- check2("23.9512076062771335216", GMP_RNDN, "3.17601874455977206679");
- check2("23.9512076062771335216", GMP_RNDU, "3.17601874455977251088");
+ check2("23.9512076062771335216", MPFR_RNDD, "3.17601874455977206679");
+ check2("23.9512076062771335216", MPFR_RNDN, "3.17601874455977206679");
+ check2("23.9512076062771335216", MPFR_RNDU, "3.17601874455977251088");
- check2("428.315247165198229595", GMP_RNDD, "6.05985948325268264369");
- check2("428.315247165198229595", GMP_RNDN, "6.05985948325268353187");
- check2("428.315247165198229595", GMP_RNDU, "6.05985948325268353187");
+ check2("428.315247165198229595", MPFR_RNDD, "6.05985948325268264369");
+ check2("428.315247165198229595", MPFR_RNDN, "6.05985948325268353187");
+ check2("428.315247165198229595", MPFR_RNDU, "6.05985948325268353187");
}
static void
@@ -193,30 +193,30 @@ special (void)
mpfr_set_prec (y, 24*2);
mpfr_set_prec (x, 24);
mpfr_set_str_binary (x, "0.111110101010101011110101E0");
- test_log (y, x, GMP_RNDN);
+ test_log (y, x, MPFR_RNDN);
set_emin (emin);
set_emax (emax);
mpfr_set_prec (y, 53);
mpfr_set_prec (x, 53);
- mpfr_set_ui (x, 3, GMP_RNDD);
- test_log (y, x, GMP_RNDD);
+ mpfr_set_ui (x, 3, MPFR_RNDD);
+ test_log (y, x, MPFR_RNDD);
if (mpfr_cmp_str1 (y, "1.09861228866810956"))
{
- printf ("Error in mpfr_log(3) for GMP_RNDD\n");
+ printf ("Error in mpfr_log(3) for MPFR_RNDD\n");
exit (1);
}
/* check large precision */
mpfr_set_prec (x, 3322);
mpfr_set_prec (y, 3322);
- mpfr_set_ui (x, 3, GMP_RNDN);
- mpfr_sqrt (x, x, GMP_RNDN);
- test_log (y, x, GMP_RNDN);
+ mpfr_set_ui (x, 3, MPFR_RNDN);
+ mpfr_sqrt (x, x, MPFR_RNDN);
+ test_log (y, x, MPFR_RNDN);
/* negative argument */
- mpfr_set_si (x, -1, GMP_RNDN);
- test_log (y, x, GMP_RNDN);
+ mpfr_set_si (x, -1, MPFR_RNDN);
+ test_log (y, x, MPFR_RNDN);
MPFR_ASSERTN(mpfr_nan_p (y));
/* infinite loop when */
@@ -225,19 +225,19 @@ special (void)
mpfr_set_prec (y, 251);
mpfr_set_str_binary (x, "0.10010111000000000001101E8");
/* x = 4947981/32768, log(x) ~ 5.017282... */
- test_log (y, x, GMP_RNDN);
+ test_log (y, x, MPFR_RNDN);
set_emax (emax);
- mpfr_set_ui (x, 0, GMP_RNDN);
- inex = test_log (y, x, GMP_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ inex = test_log (y, x, MPFR_RNDN);
MPFR_ASSERTN (inex == 0);
MPFR_ASSERTN (mpfr_inf_p (y));
MPFR_ASSERTN (mpfr_sgn (y) < 0);
- mpfr_set_ui (x, 0, GMP_RNDN);
- mpfr_neg (x, x, GMP_RNDN);
- inex = test_log (y, x, GMP_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN);
+ inex = test_log (y, x, MPFR_RNDN);
MPFR_ASSERTN (inex == 0);
MPFR_ASSERTN (mpfr_inf_p (y));
MPFR_ASSERTN (mpfr_sgn (y) < 0);
@@ -255,10 +255,10 @@ x_near_one (void)
mpfr_init2 (x, 32);
mpfr_init2 (y, 16);
- mpfr_set_ui (x, 1, GMP_RNDN);
+ mpfr_set_ui (x, 1, MPFR_RNDN);
mpfr_nextbelow (x);
- inex = mpfr_log (y, x, GMP_RNDD);
- if (mpfr_cmp_str (y, "-0.1000000000000001E-31", 2, GMP_RNDN)
+ inex = mpfr_log (y, x, MPFR_RNDD);
+ if (mpfr_cmp_str (y, "-0.1000000000000001E-31", 2, MPFR_RNDN)
|| inex >= 0)
{
printf ("Failure in x_near_one, got inex = %d and\ny = ", inex);
@@ -286,67 +286,67 @@ main (int argc, char *argv[])
special ();
check_worst_cases();
- check2("1.01979300812244555452", GMP_RNDN, "1.95996734891603664741e-02");
- check2("10.0",GMP_RNDU,"2.30258509299404590110e+00");
- check2("6.0",GMP_RNDU,"1.79175946922805517936");
- check2("1.0",GMP_RNDZ,"0.0");
- check2("62.0",GMP_RNDU,"4.12713438504509166905");
- check2("0.5",GMP_RNDZ,"-6.93147180559945286226e-01");
- check2("3.0",GMP_RNDZ,"1.09861228866810956006e+00");
- check2("234375765.0",GMP_RNDU,"1.92724362186836231104e+01");
- check2("8.0",GMP_RNDZ,"2.07944154167983574765e+00");
- check2("44.0",GMP_RNDU,"3.78418963391826146392e+00");
- check2("1.01979300812244555452", GMP_RNDN, "1.95996734891603664741e-02");
+ check2("1.01979300812244555452", MPFR_RNDN, "1.95996734891603664741e-02");
+ check2("10.0",MPFR_RNDU,"2.30258509299404590110e+00");
+ check2("6.0",MPFR_RNDU,"1.79175946922805517936");
+ check2("1.0",MPFR_RNDZ,"0.0");
+ check2("62.0",MPFR_RNDU,"4.12713438504509166905");
+ check2("0.5",MPFR_RNDZ,"-6.93147180559945286226e-01");
+ check2("3.0",MPFR_RNDZ,"1.09861228866810956006e+00");
+ check2("234375765.0",MPFR_RNDU,"1.92724362186836231104e+01");
+ check2("8.0",MPFR_RNDZ,"2.07944154167983574765e+00");
+ check2("44.0",MPFR_RNDU,"3.78418963391826146392e+00");
+ check2("1.01979300812244555452", MPFR_RNDN, "1.95996734891603664741e-02");
/* bugs found by Vincent Lefe`vre */
- check2("0.99999599881598921769", GMP_RNDN, "-0.0000040011920155404072924737977900999652547398000024259090423583984375");
- check2("9.99995576063808955247e-01",GMP_RNDZ,"-4.42394597667932383816e-06");
- check2("9.99993687357856209097e-01",GMP_RNDN,"-6.31266206860017342601e-06");
- check2("9.99995223520736886691e-01",GMP_RNDN,"-4.77649067052670982220e-06");
- check2("9.99993025794720935551e-01",GMP_RNDN,"-6.97422959894716163837e-06");
- check2("9.99987549017837484833e-01",GMP_RNDN,"-1.24510596766369924330e-05");
- check2("9.99985901426543311032e-01",GMP_RNDN,"-1.40986728425098585229e-05");
- check2("9.99986053947420794330e-01",GMP_RNDN, "-0.000013946149826301084938555592540598837558718514628708362579345703125");
- check2("9.99971938247442126979e-01",GMP_RNDN,"-2.80621462962173414790e-05");
+ check2("0.99999599881598921769", MPFR_RNDN, "-0.0000040011920155404072924737977900999652547398000024259090423583984375");
+ check2("9.99995576063808955247e-01",MPFR_RNDZ,"-4.42394597667932383816e-06");
+ check2("9.99993687357856209097e-01",MPFR_RNDN,"-6.31266206860017342601e-06");
+ check2("9.99995223520736886691e-01",MPFR_RNDN,"-4.77649067052670982220e-06");
+ check2("9.99993025794720935551e-01",MPFR_RNDN,"-6.97422959894716163837e-06");
+ check2("9.99987549017837484833e-01",MPFR_RNDN,"-1.24510596766369924330e-05");
+ check2("9.99985901426543311032e-01",MPFR_RNDN,"-1.40986728425098585229e-05");
+ check2("9.99986053947420794330e-01",MPFR_RNDN, "-0.000013946149826301084938555592540598837558718514628708362579345703125");
+ check2("9.99971938247442126979e-01",MPFR_RNDN,"-2.80621462962173414790e-05");
/* other bugs found by Vincent Lefe`vre */
- check2("1.18615436389927785905e+77",GMP_RNDN,"1.77469768607706015473e+02");
- check2("9.48868723578399476187e+77",GMP_RNDZ,"1.79549152432275803903e+02");
- check2("2.31822210096938820854e+89",GMP_RNDN,"2.05770873832573869322e+02");
+ check2("1.18615436389927785905e+77",MPFR_RNDN,"1.77469768607706015473e+02");
+ check2("9.48868723578399476187e+77",MPFR_RNDZ,"1.79549152432275803903e+02");
+ check2("2.31822210096938820854e+89",MPFR_RNDN,"2.05770873832573869322e+02");
/* further bugs found by Vincent Lefe`vre */
- check2("9.99999989485669482647e-01",GMP_RNDZ,"-1.05143305726283042331e-08");
- check2("9.99999989237970177136e-01",GMP_RNDZ,"-1.07620298807745377934e-08");
- check2("9.99999989239339082125e-01",GMP_RNDN,"-1.07606609757704445430e-08");
-
- check2("7.3890560989306504",GMP_RNDU,"2.0000000000000004"); /* exp(2.0) */
- check2("7.3890560989306495",GMP_RNDU,"2.0"); /* exp(2.0) */
- check2("7.53428236571286402512e+34",GMP_RNDZ,"8.03073567492226345621e+01");
- check2("6.18784121531737948160e+19",GMP_RNDZ,"4.55717030391710693493e+01");
- check2("1.02560267603047283735e+00",GMP_RNDD,"2.52804164149448735987e-02");
- check2("7.53428236571286402512e+34",GMP_RNDZ,"8.03073567492226345621e+01");
- check2("1.42470900831881198052e+49",GMP_RNDZ,"113.180637144887668910087086260318756103515625");
-
- check2("1.08013816255293777466e+11",GMP_RNDN,"2.54055249841782604392e+01");
- check2("6.72783635300509015581e-37",GMP_RNDU,"-8.32893948416799503320e+01");
- check2("2.25904918906057891180e-52",GMP_RNDU,"-1.18919480823735682406e+02");
- check2("1.48901209246462951085e+00",GMP_RNDD,"3.98112874867437460668e-01");
- check2("1.70322470467612341327e-01",GMP_RNDN,"-1.77006175364294615626");
- check2("1.94572026316065240791e+01",GMP_RNDD,"2.96821731676437838842");
- check2("4.01419512207026418764e+04",GMP_RNDD,"1.06001772315501128218e+01");
- check2("9.47077365236487591672e-04",GMP_RNDZ,"-6.96212977303956748187e+00");
- check2("3.95906157687589643802e-109",GMP_RNDD,"-2.49605768114704119399e+02");
- check2("2.73874914516503004113e-02",GMP_RNDD,"-3.59766888618655977794e+00");
- check2("9.18989072589566467669e-17",GMP_RNDZ,"-3.69258425351464083519e+01");
- check2("7706036453608191045959753324430048151991964994788917248.0",GMP_RNDZ,"126.3815989984199177342816255986690521240234375");
- check2("1.74827399630587801934e-23",GMP_RNDZ,"-5.24008281254547156891e+01");
- check2("4.35302958401482307665e+22",GMP_RNDD,"5.21277441046519527390e+01");
- check2("9.70791868689332915209e+00",GMP_RNDD,"2.27294191194272210410e+00");
- check2("2.22183639799464011100e-01",GMP_RNDN,"-1.50425103275253957413e+00");
- check2("2.27313466156682375540e+00",GMP_RNDD,"8.21159787095675608448e-01");
- check2("6.58057413965851156767e-01",GMP_RNDZ,"-4.18463096196088235600e-01");
- check2 ("7.34302197248998461006e+43",GMP_RNDZ,"101.0049094695131799426235374994575977325439453125");
- check2("6.09969788341579732815e+00",GMP_RNDD,"1.80823924264386204363e+00");
+ check2("9.99999989485669482647e-01",MPFR_RNDZ,"-1.05143305726283042331e-08");
+ check2("9.99999989237970177136e-01",MPFR_RNDZ,"-1.07620298807745377934e-08");
+ check2("9.99999989239339082125e-01",MPFR_RNDN,"-1.07606609757704445430e-08");
+
+ check2("7.3890560989306504",MPFR_RNDU,"2.0000000000000004"); /* exp(2.0) */
+ check2("7.3890560989306495",MPFR_RNDU,"2.0"); /* exp(2.0) */
+ check2("7.53428236571286402512e+34",MPFR_RNDZ,"8.03073567492226345621e+01");
+ check2("6.18784121531737948160e+19",MPFR_RNDZ,"4.55717030391710693493e+01");
+ check2("1.02560267603047283735e+00",MPFR_RNDD,"2.52804164149448735987e-02");
+ check2("7.53428236571286402512e+34",MPFR_RNDZ,"8.03073567492226345621e+01");
+ check2("1.42470900831881198052e+49",MPFR_RNDZ,"113.180637144887668910087086260318756103515625");
+
+ check2("1.08013816255293777466e+11",MPFR_RNDN,"2.54055249841782604392e+01");
+ check2("6.72783635300509015581e-37",MPFR_RNDU,"-8.32893948416799503320e+01");
+ check2("2.25904918906057891180e-52",MPFR_RNDU,"-1.18919480823735682406e+02");
+ check2("1.48901209246462951085e+00",MPFR_RNDD,"3.98112874867437460668e-01");
+ check2("1.70322470467612341327e-01",MPFR_RNDN,"-1.77006175364294615626");
+ check2("1.94572026316065240791e+01",MPFR_RNDD,"2.96821731676437838842");
+ check2("4.01419512207026418764e+04",MPFR_RNDD,"1.06001772315501128218e+01");
+ check2("9.47077365236487591672e-04",MPFR_RNDZ,"-6.96212977303956748187e+00");
+ check2("3.95906157687589643802e-109",MPFR_RNDD,"-2.49605768114704119399e+02");
+ check2("2.73874914516503004113e-02",MPFR_RNDD,"-3.59766888618655977794e+00");
+ check2("9.18989072589566467669e-17",MPFR_RNDZ,"-3.69258425351464083519e+01");
+ check2("7706036453608191045959753324430048151991964994788917248.0",MPFR_RNDZ,"126.3815989984199177342816255986690521240234375");
+ check2("1.74827399630587801934e-23",MPFR_RNDZ,"-5.24008281254547156891e+01");
+ check2("4.35302958401482307665e+22",MPFR_RNDD,"5.21277441046519527390e+01");
+ check2("9.70791868689332915209e+00",MPFR_RNDD,"2.27294191194272210410e+00");
+ check2("2.22183639799464011100e-01",MPFR_RNDN,"-1.50425103275253957413e+00");
+ check2("2.27313466156682375540e+00",MPFR_RNDD,"8.21159787095675608448e-01");
+ check2("6.58057413965851156767e-01",MPFR_RNDZ,"-4.18463096196088235600e-01");
+ check2 ("7.34302197248998461006e+43",MPFR_RNDZ,"101.0049094695131799426235374994575977325439453125");
+ check2("6.09969788341579732815e+00",MPFR_RNDD,"1.80823924264386204363e+00");
x_near_one ();
diff --git a/tests/tlog10.c b/tests/tlog10.c
index dc938ce66..4017b8a08 100644
--- a/tests/tlog10.c
+++ b/tests/tlog10.c
@@ -30,7 +30,7 @@ static int
test_log10 (mpfr_ptr a, mpfr_srcptr b, mp_rnd_t rnd_mode)
{
int res;
- int ok = rnd_mode == GMP_RNDN && mpfr_number_p (b) && mpfr_get_prec (a)>=53;
+ int ok = rnd_mode == MPFR_RNDN && mpfr_number_p (b) && mpfr_get_prec (a)>=53;
if (ok)
{
mpfr_print_raw (b);
@@ -68,42 +68,42 @@ main (int argc, char *argv[])
/* check NaN */
mpfr_set_nan (x);
- inex = test_log10 (y, x, GMP_RNDN);
+ inex = test_log10 (y, x, MPFR_RNDN);
MPFR_ASSERTN (mpfr_nan_p (y) && inex == 0);
/* check Inf */
mpfr_set_inf (x, -1);
- inex = test_log10 (y, x, GMP_RNDN);
+ inex = test_log10 (y, x, MPFR_RNDN);
MPFR_ASSERTN (mpfr_nan_p (y) && inex == 0);
mpfr_set_inf (x, 1);
- inex = test_log10 (y, x, GMP_RNDN);
+ inex = test_log10 (y, x, MPFR_RNDN);
MPFR_ASSERTN (mpfr_inf_p (y) && mpfr_sgn (y) > 0 && inex == 0);
- mpfr_set_ui (x, 0, GMP_RNDN);
- inex = test_log10 (x, x, GMP_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ inex = test_log10 (x, x, MPFR_RNDN);
MPFR_ASSERTN (mpfr_inf_p (x) && mpfr_sgn (x) < 0 && inex == 0);
- mpfr_set_ui (x, 0, GMP_RNDN);
- mpfr_neg (x, x, GMP_RNDN);
- inex = test_log10 (x, x, GMP_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN);
+ inex = test_log10 (x, x, MPFR_RNDN);
MPFR_ASSERTN (mpfr_inf_p (x) && mpfr_sgn (x) < 0 && inex == 0);
/* check negative argument */
- mpfr_set_si (x, -1, GMP_RNDN);
- inex = test_log10 (y, x, GMP_RNDN);
+ mpfr_set_si (x, -1, MPFR_RNDN);
+ inex = test_log10 (y, x, MPFR_RNDN);
MPFR_ASSERTN (mpfr_nan_p (y) && inex == 0);
/* check log10(1) = 0 */
- mpfr_set_ui (x, 1, GMP_RNDN);
- inex = test_log10 (y, x, GMP_RNDN);
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ inex = test_log10 (y, x, MPFR_RNDN);
MPFR_ASSERTN (mpfr_cmp_ui (y, 0) == 0 && MPFR_IS_POS (y) && inex == 0);
/* check log10(10^n)=n */
- mpfr_set_ui (x, 1, GMP_RNDN);
+ mpfr_set_ui (x, 1, MPFR_RNDN);
for (n = 1; n <= 15; n++)
{
- mpfr_mul_ui (x, x, 10, GMP_RNDN); /* x = 10^n */
- inex = test_log10 (y, x, GMP_RNDN);
+ mpfr_mul_ui (x, x, 10, MPFR_RNDN); /* x = 10^n */
+ inex = test_log10 (y, x, MPFR_RNDN);
if (mpfr_cmp_ui (y, n))
{
printf ("log10(10^n) <> n for n=%u\n", n);
diff --git a/tests/tlog1p.c b/tests/tlog1p.c
index 8ac833934..7c913b3a6 100644
--- a/tests/tlog1p.c
+++ b/tests/tlog1p.c
@@ -30,7 +30,7 @@ static int
test_log1p (mpfr_ptr a, mpfr_srcptr b, mp_rnd_t rnd_mode)
{
int res;
- int ok = rnd_mode == GMP_RNDN && mpfr_number_p (b) && mpfr_get_prec (a)>=53;
+ int ok = rnd_mode == MPFR_RNDN && mpfr_number_p (b) && mpfr_get_prec (a)>=53;
if (ok)
{
mpfr_print_raw (b);
@@ -61,30 +61,30 @@ special (void)
mpfr_init (x);
mpfr_set_nan (x);
- inex = test_log1p (x, x, GMP_RNDN);
+ inex = test_log1p (x, x, MPFR_RNDN);
MPFR_ASSERTN (mpfr_nan_p (x) && inex == 0);
mpfr_set_inf (x, -1);
- inex = test_log1p (x, x, GMP_RNDN);
+ inex = test_log1p (x, x, MPFR_RNDN);
MPFR_ASSERTN (mpfr_nan_p (x) && inex == 0);
mpfr_set_inf (x, 1);
- inex = test_log1p (x, x, GMP_RNDN);
+ inex = test_log1p (x, x, MPFR_RNDN);
MPFR_ASSERTN (mpfr_inf_p (x) && mpfr_sgn (x) > 0 && inex == 0);
- mpfr_set_ui (x, 0, GMP_RNDN);
- inex = test_log1p (x, x, GMP_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ inex = test_log1p (x, x, MPFR_RNDN);
MPFR_ASSERTN (mpfr_cmp_ui (x, 0) == 0 && MPFR_IS_POS (x) && inex == 0);
- mpfr_neg (x, x, GMP_RNDN);
- inex = test_log1p (x, x, GMP_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN);
+ inex = test_log1p (x, x, MPFR_RNDN);
MPFR_ASSERTN (mpfr_cmp_ui (x, 0) == 0 && MPFR_IS_NEG (x) && inex == 0);
- mpfr_set_si (x, -1, GMP_RNDN);
- inex = test_log1p (x, x, GMP_RNDN);
+ mpfr_set_si (x, -1, MPFR_RNDN);
+ inex = test_log1p (x, x, MPFR_RNDN);
MPFR_ASSERTN (mpfr_inf_p (x) && mpfr_sgn (x) < 0 && inex == 0);
- mpfr_set_si (x, -2, GMP_RNDN);
- inex = test_log1p (x, x, GMP_RNDN);
+ mpfr_set_si (x, -2, MPFR_RNDN);
+ inex = test_log1p (x, x, MPFR_RNDN);
MPFR_ASSERTN (mpfr_nan_p (x) && inex == 0);
mpfr_clear (x);
@@ -97,17 +97,17 @@ other (void)
/* Bug reported by Guillaume Melquiond on 2006-08-14. */
mpfr_init2 (x, 53);
- mpfr_set_str (x, "-1.5e4f72873ed9a@-100", 16, GMP_RNDN);
+ mpfr_set_str (x, "-1.5e4f72873ed9a@-100", 16, MPFR_RNDN);
mpfr_init2 (y, 57);
- mpfr_log1p (y, x, GMP_RNDU);
+ mpfr_log1p (y, x, MPFR_RNDU);
if (mpfr_cmp (x, y) != 0)
{
printf ("Error in tlog1p for x = ");
- mpfr_out_str (stdout, 16, 0, x, GMP_RNDN);
- printf (", rnd = GMP_RNDU\nExpected ");
- mpfr_out_str (stdout, 16, 15, x, GMP_RNDN);
+ mpfr_out_str (stdout, 16, 0, x, MPFR_RNDN);
+ printf (", rnd = MPFR_RNDU\nExpected ");
+ mpfr_out_str (stdout, 16, 15, x, MPFR_RNDN);
printf ("\nGot ");
- mpfr_out_str (stdout, 16, 15, y, GMP_RNDN);
+ mpfr_out_str (stdout, 16, 15, y, MPFR_RNDN);
printf ("\n");
exit (1);
}
diff --git a/tests/tlog2.c b/tests/tlog2.c
index 09a0afbd0..16a5e3f99 100644
--- a/tests/tlog2.c
+++ b/tests/tlog2.c
@@ -38,31 +38,31 @@ special (void)
mpfr_init (x);
mpfr_set_nan (x);
- inex = mpfr_log2 (x, x, GMP_RNDN);
+ inex = mpfr_log2 (x, x, MPFR_RNDN);
MPFR_ASSERTN (mpfr_nan_p (x) && inex == 0);
mpfr_set_inf (x, -1);
- inex = mpfr_log2 (x, x, GMP_RNDN);
+ inex = mpfr_log2 (x, x, MPFR_RNDN);
MPFR_ASSERTN (mpfr_nan_p (x) && inex == 0);
mpfr_set_inf (x, 1);
- inex = mpfr_log2 (x, x, GMP_RNDN);
+ inex = mpfr_log2 (x, x, MPFR_RNDN);
MPFR_ASSERTN (mpfr_inf_p (x) && mpfr_sgn (x) > 0 && inex == 0);
- mpfr_set_ui (x, 0, GMP_RNDN);
- inex = mpfr_log2 (x, x, GMP_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ inex = mpfr_log2 (x, x, MPFR_RNDN);
MPFR_ASSERTN (mpfr_inf_p (x) && mpfr_sgn (x) < 0 && inex == 0);
- mpfr_set_ui (x, 0, GMP_RNDN);
- mpfr_neg (x, x, GMP_RNDN);
- inex = mpfr_log2 (x, x, GMP_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN);
+ inex = mpfr_log2 (x, x, MPFR_RNDN);
MPFR_ASSERTN (mpfr_inf_p (x) && mpfr_sgn (x) < 0 && inex == 0);
- mpfr_set_si (x, -1, GMP_RNDN);
- inex = mpfr_log2 (x, x, GMP_RNDN);
+ mpfr_set_si (x, -1, MPFR_RNDN);
+ inex = mpfr_log2 (x, x, MPFR_RNDN);
MPFR_ASSERTN (mpfr_nan_p (x) && inex == 0);
- mpfr_set_si (x, 1, GMP_RNDN);
- inex = mpfr_log2 (x, x, GMP_RNDN);
+ mpfr_set_si (x, 1, MPFR_RNDN);
+ inex = mpfr_log2 (x, x, MPFR_RNDN);
MPFR_ASSERTN (mpfr_cmp_ui (x, 0) == 0 && MPFR_IS_POS(x) && inex == 0);
mpfr_clear (x);
diff --git a/tests/tminmax.c b/tests/tminmax.c
index a2c5fb6e4..8563d1d8c 100644
--- a/tests/tminmax.c
+++ b/tests/tminmax.c
@@ -39,13 +39,13 @@ main (void)
/* case x=NaN && y=NAN */
mpfr_set_nan (x);
mpfr_set_nan (y);
- mpfr_min (z, x, y, GMP_RNDN);
+ mpfr_min (z, x, y, MPFR_RNDN);
if (!mpfr_nan_p (z))
{
printf ("Error in mpfr_min (NaN, NaN)\n");
exit (1);
}
- mpfr_max (z, x, y, GMP_RNDN);
+ mpfr_max (z, x, y, MPFR_RNDN);
if (!mpfr_nan_p (z))
{
printf ("Error in mpfr_max (NaN, NaN)\n");
@@ -53,56 +53,56 @@ main (void)
}
/* case x=NaN */
mpfr_set_nan (x);
- mpfr_set_ui (y, 0, GMP_RNDN);
- mpfr_min (z, x, y, GMP_RNDN);
+ mpfr_set_ui (y, 0, MPFR_RNDN);
+ mpfr_min (z, x, y, MPFR_RNDN);
if (mpfr_cmp_ui (z, 0))
{
printf ("Error in mpfr_min (NaN, 0)\n");
exit (1);
}
- mpfr_min (z, y, x, GMP_RNDN);
+ mpfr_min (z, y, x, MPFR_RNDN);
if (mpfr_cmp_ui (z, 0))
{
printf ("Error in mpfr_min (0, NaN)\n");
exit (1);
}
- mpfr_max (z, x, y, GMP_RNDN);
+ mpfr_max (z, x, y, MPFR_RNDN);
if (mpfr_cmp_ui (z, 0))
{
printf ("Error in mpfr_max (NaN, 0)\n");
exit (1);
}
- mpfr_max (z, y, x, GMP_RNDN);
+ mpfr_max (z, y, x, MPFR_RNDN);
if (mpfr_cmp_ui (z, 0))
{
printf ("Error in mpfr_max (0, NaN)\n");
exit (1);
}
/* Case x=0+ and x=0- */
- mpfr_set_ui (x, 0, GMP_RNDN);
- mpfr_set_ui (y, 0, GMP_RNDN); MPFR_SET_NEG(y);
- mpfr_max (z, x, y, GMP_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_set_ui (y, 0, MPFR_RNDN); MPFR_SET_NEG(y);
+ mpfr_max (z, x, y, MPFR_RNDN);
if (!MPFR_IS_ZERO(z) || MPFR_IS_NEG(z))
{
printf ("Error in mpfr_max (0+, 0-)\n");
exit (1);
}
- mpfr_min (z, x, y, GMP_RNDN);
+ mpfr_min (z, x, y, MPFR_RNDN);
if (!MPFR_IS_ZERO(z) || MPFR_IS_POS(z))
{
printf ("Error in mpfr_min (0+, 0-)\n");
exit (1);
}
/* Case x=0- and y=0+ */
- mpfr_set_ui (x, 0, GMP_RNDN); MPFR_SET_NEG(x);
- mpfr_set_ui (y, 0, GMP_RNDN);
- mpfr_max (z, x, y, GMP_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN); MPFR_SET_NEG(x);
+ mpfr_set_ui (y, 0, MPFR_RNDN);
+ mpfr_max (z, x, y, MPFR_RNDN);
if (!MPFR_IS_ZERO(z) || MPFR_IS_NEG(z))
{
printf ("Error in mpfr_max (0+, 0-)\n");
exit (1);
}
- mpfr_min (z, x, y, GMP_RNDN);
+ mpfr_min (z, x, y, MPFR_RNDN);
if (!MPFR_IS_ZERO(z) || MPFR_IS_POS(z))
{
printf ("Error in mpfr_min (0+, 0-)\n");
@@ -111,14 +111,14 @@ main (void)
/* case x=+Inf */
mpfr_set_inf (x, 1);
- mpfr_set_si (y, -12, GMP_RNDN);
- mpfr_min (z, x, y, GMP_RNDN);
+ mpfr_set_si (y, -12, MPFR_RNDN);
+ mpfr_min (z, x, y, MPFR_RNDN);
if ( mpfr_cmp_si (z, -12) )
{
printf ("Error in mpfr_min (+Inf, -12)\n");
exit (1);
}
- mpfr_max (z, x, y, GMP_RNDN);
+ mpfr_max (z, x, y, MPFR_RNDN);
if ( !MPFR_IS_INF(z) || MPFR_IS_NEG(z) )
{
printf ("Error in mpfr_max (+Inf, 12)\n");
@@ -126,14 +126,14 @@ main (void)
}
/* case x=-Inf */
mpfr_set_inf (x, -1);
- mpfr_set_ui (y, 12, GMP_RNDN);
- mpfr_max (z, x, y, GMP_RNDN);
+ mpfr_set_ui (y, 12, MPFR_RNDN);
+ mpfr_max (z, x, y, MPFR_RNDN);
if ( mpfr_cmp_ui (z, 12) )
{
printf ("Error in mpfr_max (-Inf, 12)\n");
exit (1);
}
- mpfr_min (z, x, y, GMP_RNDN);
+ mpfr_min (z, x, y, MPFR_RNDN);
if ( !MPFR_IS_INF(z) || MPFR_IS_POS(z) )
{
printf ("Error in mpfr_min (-Inf, 12)\n");
@@ -141,21 +141,21 @@ main (void)
}
/* case x=17 and y=42 */
- mpfr_set_ui (x, 17, GMP_RNDN);
- mpfr_set_ui (y, 42, GMP_RNDN);
- mpfr_max (z, x, y, GMP_RNDN);
+ mpfr_set_ui (x, 17, MPFR_RNDN);
+ mpfr_set_ui (y, 42, MPFR_RNDN);
+ mpfr_max (z, x, y, MPFR_RNDN);
if ( mpfr_cmp_ui (z, 42) )
{
printf ("Error in mpfr_max (17, 42)\n");
exit (1);
}
- mpfr_max (z, y, x, GMP_RNDN);
+ mpfr_max (z, y, x, MPFR_RNDN);
if ( mpfr_cmp_ui (z, 42) )
{
printf ("Error in mpfr_max (42, 17)\n");
exit (1);
}
- mpfr_min (z, y, x, GMP_RNDN);
+ mpfr_min (z, y, x, MPFR_RNDN);
if ( mpfr_cmp_ui (z, 17) )
{
printf ("Error in mpfr_min (42, 17)\n");
diff --git a/tests/tmodf.c b/tests/tmodf.c
index 358e14b2a..68690e20d 100644
--- a/tests/tmodf.c
+++ b/tests/tmodf.c
@@ -45,7 +45,7 @@ check (const char *xis, const char *xfs, const char *xs,
printf ("mpfr_mof failed for x=%s, rnd=%s\n",
xs, mpfr_print_rnd_mode(rnd_mode));
printf ("got integer value: ");
- mpfr_out_str (stdout, 10, 0, xi, GMP_RNDN);
+ mpfr_out_str (stdout, 10, 0, xi, MPFR_RNDN);
printf ("\nexpected %s\n", xis);
exit (1);
}
@@ -54,7 +54,7 @@ check (const char *xis, const char *xfs, const char *xs,
printf ("mpfr_mof failed for x=%s, rnd=%s\n",
xs, mpfr_print_rnd_mode(rnd_mode));
printf ("got fractional value: ");
- mpfr_out_str (stdout, 10, 0, xf, GMP_RNDN);
+ mpfr_out_str (stdout, 10, 0, xf, MPFR_RNDN);
printf ("\nexpected %s\n", xfs);
exit (1);
}
@@ -79,20 +79,20 @@ check_nans (void)
/* nan */
mpfr_set_nan (x);
- mpfr_modf (xi, xf, x, GMP_RNDN);
+ mpfr_modf (xi, xf, x, MPFR_RNDN);
MPFR_ASSERTN (mpfr_nan_p (xi));
MPFR_ASSERTN (mpfr_nan_p (xf));
/* +inf */
mpfr_set_inf (x, 1);
- mpfr_modf (xi, xf, x, GMP_RNDN);
+ mpfr_modf (xi, xf, x, MPFR_RNDN);
MPFR_ASSERTN (mpfr_inf_p (xi));
MPFR_ASSERTN (mpfr_sgn (xi) > 0);
MPFR_ASSERTN (mpfr_zero_p (xf));
/* -inf */
mpfr_set_inf (x, -1);
- mpfr_modf (xi ,xf, x, GMP_RNDN);
+ mpfr_modf (xi ,xf, x, MPFR_RNDN);
MPFR_ASSERTN (mpfr_inf_p (xi));
MPFR_ASSERTN (mpfr_sgn (xi) < 0);
MPFR_ASSERTN (mpfr_zero_p (xf));
@@ -110,16 +110,16 @@ main (int argc, char *argv[])
check_nans ();
check ("61680","3.52935791015625e-1", "61680.352935791015625",
- 53, 53, 53, 0, GMP_RNDZ);
+ 53, 53, 53, 0, MPFR_RNDZ);
check ("-53968","-3.529052734375e-1", "-53970.352935791015625",
- 13, 13, 53, 2, GMP_RNDZ);
+ 13, 13, 53, 2, MPFR_RNDZ);
check ("61632","3.525390625e-1", "61648.352935791015625",
- 10, 10, 53, -2, GMP_RNDZ);
- check ("61680", "0", "61680", 53, 53, 53, 0, GMP_RNDZ);
- check ("-53968","0", "-53970", 13, 13, 53, 1, GMP_RNDZ);
- check ("-43392","0", "-43399", 13, 13, 53, 1, GMP_RNDU);
- check ("-52720","0", "-52719", 13, 13, 53, -1, GMP_RNDD);
- check ("61632", "0", "61648", 10, 10, 53, -1, GMP_RNDZ);
+ 10, 10, 53, -2, MPFR_RNDZ);
+ check ("61680", "0", "61680", 53, 53, 53, 0, MPFR_RNDZ);
+ check ("-53968","0", "-53970", 13, 13, 53, 1, MPFR_RNDZ);
+ check ("-43392","0", "-43399", 13, 13, 53, 1, MPFR_RNDU);
+ check ("-52720","0", "-52719", 13, 13, 53, -1, MPFR_RNDD);
+ check ("61632", "0", "61648", 10, 10, 53, -1, MPFR_RNDZ);
tests_end_mpfr ();
return 0;
diff --git a/tests/tmul.c b/tests/tmul.c
index cea39326b..4e3c39c46 100644
--- a/tests/tmul.c
+++ b/tests/tmul.c
@@ -36,7 +36,7 @@ static int
test_mul (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mp_rnd_t rnd_mode)
{
int res;
- int ok = rnd_mode == GMP_RNDN && mpfr_number_p (b) && mpfr_number_p (c);
+ int ok = rnd_mode == MPFR_RNDN && mpfr_number_p (b) && mpfr_number_p (c);
if (ok)
{
mpfr_print_raw (b);
@@ -77,7 +77,7 @@ pcheck (const char *xs, const char *ys, const char *res, mp_rnd_t rnd_mode,
printf ("(1)mpfr_mul failed for x=%s y=%s with rnd=%s\n",
xs, ys, mpfr_print_rnd_mode (rnd_mode));
printf ("correct is %s, mpfr_mul gives ", res);
- mpfr_out_str(stdout, 10, 0, zz, GMP_RNDN);
+ mpfr_out_str(stdout, 10, 0, zz, MPFR_RNDN);
/*
printf("\nBinary forms:\nxx=");
mpfr_print_binary (xx);
@@ -108,7 +108,7 @@ check53 (const char *xs, const char *ys, mp_rnd_t rnd_mode, const char *zs)
printf ("(2) mpfr_mul failed for x=%s y=%s with rnd=%s\n",
xs, ys, mpfr_print_rnd_mode(rnd_mode));
printf ("correct result is %s,\n mpfr_mul gives ", zs);
- mpfr_out_str(stdout, 10, 0, zz, GMP_RNDN);
+ mpfr_out_str(stdout, 10, 0, zz, MPFR_RNDN);
/*
printf("\nBinary forms:\nxx=");
mpfr_print_binary (xx);
@@ -140,7 +140,7 @@ check24 (const char *xs, const char *ys, mp_rnd_t rnd_mode, const char *zs)
printf ("(3) mpfr_mul failed for x=%s y=%s with "
"rnd=%s\n", xs, ys, mpfr_print_rnd_mode(rnd_mode));
printf ("correct result is gives %s, mpfr_mul gives ", zs);
- mpfr_out_str(stdout, 10, 0, zz, GMP_RNDN);
+ mpfr_out_str(stdout, 10, 0, zz, MPFR_RNDN);
putchar('\n');
exit (1);
}
@@ -152,45 +152,45 @@ check24 (const char *xs, const char *ys, mp_rnd_t rnd_mode, const char *zs)
static void
check_float (void)
{
- check24("8388609.0", "8388609.0", GMP_RNDN, "70368760954880.0");
- check24("16777213.0", "8388609.0", GMP_RNDN, "140737479966720.0");
- check24("8388611.0", "8388609.0", GMP_RNDN, "70368777732096.0");
- check24("12582911.0", "8388610.0", GMP_RNDN, "105553133043712.0");
- check24("12582914.0", "8388610.0", GMP_RNDN, "105553158209536.0");
- check24("13981013.0", "8388611.0", GMP_RNDN, "117281279442944.0");
- check24("11184811.0", "8388611.0", GMP_RNDN, "93825028587520.0");
- check24("11184810.0", "8388611.0", GMP_RNDN, "93825020198912.0");
- check24("13981014.0", "8388611.0", GMP_RNDN, "117281287831552.0");
-
- check24("8388609.0", "8388609.0", GMP_RNDZ, "70368760954880.0");
- check24("16777213.0", "8388609.0", GMP_RNDZ, "140737471578112.0");
- check24("8388611.0", "8388609.0", GMP_RNDZ, "70368777732096.0");
- check24("12582911.0", "8388610.0", GMP_RNDZ, "105553124655104.0");
- check24("12582914.0", "8388610.0", GMP_RNDZ, "105553158209536.0");
- check24("13981013.0", "8388611.0", GMP_RNDZ, "117281271054336.0");
- check24("11184811.0", "8388611.0", GMP_RNDZ, "93825028587520.0");
- check24("11184810.0", "8388611.0", GMP_RNDZ, "93825011810304.0");
- check24("13981014.0", "8388611.0", GMP_RNDZ, "117281287831552.0");
-
- check24("8388609.0", "8388609.0", GMP_RNDU, "70368769343488.0");
- check24("16777213.0", "8388609.0", GMP_RNDU, "140737479966720.0");
- check24("8388611.0", "8388609.0", GMP_RNDU, "70368786120704.0");
- check24("12582911.0", "8388610.0", GMP_RNDU, "105553133043712.0");
- check24("12582914.0", "8388610.0", GMP_RNDU, "105553166598144.0");
- check24("13981013.0", "8388611.0", GMP_RNDU, "117281279442944.0");
- check24("11184811.0", "8388611.0", GMP_RNDU, "93825036976128.0");
- check24("11184810.0", "8388611.0", GMP_RNDU, "93825020198912.0");
- check24("13981014.0", "8388611.0", GMP_RNDU, "117281296220160.0");
-
- check24("8388609.0", "8388609.0", GMP_RNDD, "70368760954880.0");
- check24("16777213.0", "8388609.0", GMP_RNDD, "140737471578112.0");
- check24("8388611.0", "8388609.0", GMP_RNDD, "70368777732096.0");
- check24("12582911.0", "8388610.0", GMP_RNDD, "105553124655104.0");
- check24("12582914.0", "8388610.0", GMP_RNDD, "105553158209536.0");
- check24("13981013.0", "8388611.0", GMP_RNDD, "117281271054336.0");
- check24("11184811.0", "8388611.0", GMP_RNDD, "93825028587520.0");
- check24("11184810.0", "8388611.0", GMP_RNDD, "93825011810304.0");
- check24("13981014.0", "8388611.0", GMP_RNDD, "117281287831552.0");
+ check24("8388609.0", "8388609.0", MPFR_RNDN, "70368760954880.0");
+ check24("16777213.0", "8388609.0", MPFR_RNDN, "140737479966720.0");
+ check24("8388611.0", "8388609.0", MPFR_RNDN, "70368777732096.0");
+ check24("12582911.0", "8388610.0", MPFR_RNDN, "105553133043712.0");
+ check24("12582914.0", "8388610.0", MPFR_RNDN, "105553158209536.0");
+ check24("13981013.0", "8388611.0", MPFR_RNDN, "117281279442944.0");
+ check24("11184811.0", "8388611.0", MPFR_RNDN, "93825028587520.0");
+ check24("11184810.0", "8388611.0", MPFR_RNDN, "93825020198912.0");
+ check24("13981014.0", "8388611.0", MPFR_RNDN, "117281287831552.0");
+
+ check24("8388609.0", "8388609.0", MPFR_RNDZ, "70368760954880.0");
+ check24("16777213.0", "8388609.0", MPFR_RNDZ, "140737471578112.0");
+ check24("8388611.0", "8388609.0", MPFR_RNDZ, "70368777732096.0");
+ check24("12582911.0", "8388610.0", MPFR_RNDZ, "105553124655104.0");
+ check24("12582914.0", "8388610.0", MPFR_RNDZ, "105553158209536.0");
+ check24("13981013.0", "8388611.0", MPFR_RNDZ, "117281271054336.0");
+ check24("11184811.0", "8388611.0", MPFR_RNDZ, "93825028587520.0");
+ check24("11184810.0", "8388611.0", MPFR_RNDZ, "93825011810304.0");
+ check24("13981014.0", "8388611.0", MPFR_RNDZ, "117281287831552.0");
+
+ check24("8388609.0", "8388609.0", MPFR_RNDU, "70368769343488.0");
+ check24("16777213.0", "8388609.0", MPFR_RNDU, "140737479966720.0");
+ check24("8388611.0", "8388609.0", MPFR_RNDU, "70368786120704.0");
+ check24("12582911.0", "8388610.0", MPFR_RNDU, "105553133043712.0");
+ check24("12582914.0", "8388610.0", MPFR_RNDU, "105553166598144.0");
+ check24("13981013.0", "8388611.0", MPFR_RNDU, "117281279442944.0");
+ check24("11184811.0", "8388611.0", MPFR_RNDU, "93825036976128.0");
+ check24("11184810.0", "8388611.0", MPFR_RNDU, "93825020198912.0");
+ check24("13981014.0", "8388611.0", MPFR_RNDU, "117281296220160.0");
+
+ check24("8388609.0", "8388609.0", MPFR_RNDD, "70368760954880.0");
+ check24("16777213.0", "8388609.0", MPFR_RNDD, "140737471578112.0");
+ check24("8388611.0", "8388609.0", MPFR_RNDD, "70368777732096.0");
+ check24("12582911.0", "8388610.0", MPFR_RNDD, "105553124655104.0");
+ check24("12582914.0", "8388610.0", MPFR_RNDD, "105553158209536.0");
+ check24("13981013.0", "8388611.0", MPFR_RNDD, "117281271054336.0");
+ check24("11184811.0", "8388611.0", MPFR_RNDD, "93825028587520.0");
+ check24("11184810.0", "8388611.0", MPFR_RNDD, "93825011810304.0");
+ check24("13981014.0", "8388611.0", MPFR_RNDD, "117281287831552.0");
}
/* check sign of result */
@@ -201,13 +201,13 @@ check_sign (void)
mpfr_init2 (a, 53);
mpfr_init2 (b, 53);
- mpfr_set_si (a, -1, GMP_RNDN);
- mpfr_set_ui (b, 2, GMP_RNDN);
- test_mul(a, b, b, GMP_RNDN);
+ mpfr_set_si (a, -1, MPFR_RNDN);
+ mpfr_set_ui (b, 2, MPFR_RNDN);
+ test_mul(a, b, b, MPFR_RNDN);
if (mpfr_cmp_ui (a, 4) )
{
printf ("2.0*2.0 gives \n");
- mpfr_out_str(stdout, 10, 0, a, GMP_RNDN);
+ mpfr_out_str(stdout, 10, 0, a, MPFR_RNDN);
putchar('\n');
exit (1);
}
@@ -233,7 +233,7 @@ check_exact (void)
mpfr_set_prec (c, 32);
mpfr_set_str_binary (a, "1.1000111011000100e-1");
mpfr_set_str_binary (b, "1.0010001111100111e-1");
- if (test_mul (c, a, b, GMP_RNDZ))
+ if (test_mul (c, a, b, MPFR_RNDZ))
{
printf ("wrong return value (1)\n");
exit (1);
@@ -295,11 +295,11 @@ check_max(void)
mpfr_init2(yy, 4);
mpfr_init2(zz, 4);
mpfr_set_str1 (xx, "0.68750");
- mpfr_mul_2si(xx, xx, MPFR_EMAX_DEFAULT/2, GMP_RNDN);
+ mpfr_mul_2si(xx, xx, MPFR_EMAX_DEFAULT/2, MPFR_RNDN);
mpfr_set_str1 (yy, "0.68750");
- mpfr_mul_2si(yy, yy, MPFR_EMAX_DEFAULT - MPFR_EMAX_DEFAULT/2 + 1, GMP_RNDN);
+ mpfr_mul_2si(yy, yy, MPFR_EMAX_DEFAULT - MPFR_EMAX_DEFAULT/2 + 1, MPFR_RNDN);
mpfr_clear_flags();
- test_mul(zz, xx, yy, GMP_RNDU);
+ test_mul(zz, xx, yy, MPFR_RNDU);
if (!(mpfr_overflow_p() && MPFR_IS_INF(zz)))
{
printf("check_max failed (should be an overflow)\n");
@@ -307,14 +307,14 @@ check_max(void)
}
mpfr_clear_flags();
- test_mul(zz, xx, yy, GMP_RNDD);
+ test_mul(zz, xx, yy, MPFR_RNDD);
if (mpfr_overflow_p() || MPFR_IS_INF(zz))
{
printf("check_max failed (should NOT be an overflow)\n");
exit(1);
}
mpfr_set_str1 (xx, "0.93750");
- mpfr_mul_2si(xx, xx, MPFR_EMAX_DEFAULT, GMP_RNDN);
+ mpfr_mul_2si(xx, xx, MPFR_EMAX_DEFAULT, MPFR_RNDN);
if (!(MPFR_IS_FP(xx) && MPFR_IS_FP(zz)))
{
printf("check_max failed (internal error)\n");
@@ -323,9 +323,9 @@ check_max(void)
if (mpfr_cmp(xx, zz) != 0)
{
printf("check_max failed: got ");
- mpfr_out_str(stdout, 2, 0, zz, GMP_RNDZ);
+ mpfr_out_str(stdout, 2, 0, zz, MPFR_RNDZ);
printf(" instead of ");
- mpfr_out_str(stdout, 2, 0, xx, GMP_RNDZ);
+ mpfr_out_str(stdout, 2, 0, xx, MPFR_RNDZ);
printf("\n");
exit(1);
}
@@ -335,7 +335,7 @@ check_max(void)
set_emin (0);
mpfr_set_str_binary (xx, "0.1E0");
mpfr_set_str_binary (yy, "0.1E0");
- test_mul (zz, xx, yy, GMP_RNDN);
+ test_mul (zz, xx, yy, MPFR_RNDN);
/* exact result is 0.1E-1, which should round to 0 */
MPFR_ASSERTN(mpfr_cmp_ui (zz, 0) == 0 && MPFR_IS_POS(zz));
set_emin (emin);
@@ -347,7 +347,7 @@ check_max(void)
mpfr_set_str_binary (xx, "0.1E0");
mpfr_nextabove (xx);
mpfr_set_str_binary (yy, "0.1E0");
- test_mul (zz, xx, yy, GMP_RNDN);
+ test_mul (zz, xx, yy, MPFR_RNDN);
/* exact result is just above 0.1E-1, which should round to minfloat */
MPFR_ASSERTN(mpfr_cmp (zz, yy) == 0);
set_emin (emin);
@@ -366,21 +366,21 @@ check_min(void)
mpfr_init2(yy, 4);
mpfr_init2(zz, 3);
mpfr_set_str1(xx, "0.9375");
- mpfr_mul_2si(xx, xx, MPFR_EMIN_DEFAULT/2, GMP_RNDN);
+ mpfr_mul_2si(xx, xx, MPFR_EMIN_DEFAULT/2, MPFR_RNDN);
mpfr_set_str1(yy, "0.9375");
- mpfr_mul_2si(yy, yy, MPFR_EMIN_DEFAULT - MPFR_EMIN_DEFAULT/2 - 1, GMP_RNDN);
- test_mul(zz, xx, yy, GMP_RNDD);
+ mpfr_mul_2si(yy, yy, MPFR_EMIN_DEFAULT - MPFR_EMIN_DEFAULT/2 - 1, MPFR_RNDN);
+ test_mul(zz, xx, yy, MPFR_RNDD);
if (mpfr_sgn(zz) != 0)
{
printf("check_min failed: got ");
- mpfr_out_str(stdout, 2, 0, zz, GMP_RNDZ);
+ mpfr_out_str(stdout, 2, 0, zz, MPFR_RNDZ);
printf(" instead of 0\n");
exit(1);
}
- test_mul(zz, xx, yy, GMP_RNDU);
+ test_mul(zz, xx, yy, MPFR_RNDU);
mpfr_set_str1 (xx, "0.5");
- mpfr_mul_2si(xx, xx, MPFR_EMIN_DEFAULT, GMP_RNDN);
+ mpfr_mul_2si(xx, xx, MPFR_EMIN_DEFAULT, MPFR_RNDN);
if (mpfr_sgn(xx) <= 0)
{
printf("check_min failed (internal error)\n");
@@ -389,9 +389,9 @@ check_min(void)
if (mpfr_cmp(xx, zz) != 0)
{
printf("check_min failed: got ");
- mpfr_out_str(stdout, 2, 0, zz, GMP_RNDZ);
+ mpfr_out_str(stdout, 2, 0, zz, MPFR_RNDZ);
printf(" instead of ");
- mpfr_out_str(stdout, 2, 0, xx, GMP_RNDZ);
+ mpfr_out_str(stdout, 2, 0, xx, MPFR_RNDZ);
printf("\n");
exit(1);
}
@@ -412,33 +412,33 @@ check_nans (void)
/* nan * 0 == nan */
mpfr_set_nan (x);
- mpfr_set_ui (y, 0L, GMP_RNDN);
- test_mul (p, x, y, GMP_RNDN);
+ mpfr_set_ui (y, 0L, MPFR_RNDN);
+ test_mul (p, x, y, MPFR_RNDN);
MPFR_ASSERTN (mpfr_nan_p (p));
/* 1 * nan == nan */
- mpfr_set_ui (x, 1L, GMP_RNDN);
+ mpfr_set_ui (x, 1L, MPFR_RNDN);
mpfr_set_nan (y);
- test_mul (p, x, y, GMP_RNDN);
+ test_mul (p, x, y, MPFR_RNDN);
MPFR_ASSERTN (mpfr_nan_p (p));
/* 0 * +inf == nan */
- mpfr_set_ui (x, 0L, GMP_RNDN);
+ mpfr_set_ui (x, 0L, MPFR_RNDN);
mpfr_set_nan (y);
- test_mul (p, x, y, GMP_RNDN);
+ test_mul (p, x, y, MPFR_RNDN);
MPFR_ASSERTN (mpfr_nan_p (p));
/* +1 * +inf == +inf */
- mpfr_set_ui (x, 1L, GMP_RNDN);
+ mpfr_set_ui (x, 1L, MPFR_RNDN);
mpfr_set_inf (y, 1);
- test_mul (p, x, y, GMP_RNDN);
+ test_mul (p, x, y, MPFR_RNDN);
MPFR_ASSERTN (mpfr_inf_p (p));
MPFR_ASSERTN (mpfr_sgn (p) > 0);
/* -1 * +inf == -inf */
- mpfr_set_si (x, -1L, GMP_RNDN);
+ mpfr_set_si (x, -1L, MPFR_RNDN);
mpfr_set_inf (y, 1);
- test_mul (p, x, y, GMP_RNDN);
+ test_mul (p, x, y, MPFR_RNDN);
MPFR_ASSERTN (mpfr_inf_p (p));
MPFR_ASSERTN (mpfr_sgn (p) < 0);
@@ -489,15 +489,15 @@ check_regression (void)
exit (1);
}
get_string (s, fp);
- mpfr_set_str (y, s, 16, GMP_RNDN);
+ mpfr_set_str (y, s, 16, MPFR_RNDN);
get_string (s, fp);
- mpfr_set_str (z, s, 16, GMP_RNDN);
- i = mpfr_mul (x, y, z, GMP_RNDN);
+ mpfr_set_str (z, s, 16, MPFR_RNDN);
+ i = mpfr_mul (x, y, z, MPFR_RNDN);
get_string (s, fp);
- if (mpfr_cmp_str (x, s, 16, GMP_RNDN) != 0 || i != -1)
+ if (mpfr_cmp_str (x, s, 16, MPFR_RNDN) != 0 || i != -1)
{
printf ("Regression test 1 failed (i=%d, expected -1)\nx=", i);
- mpfr_out_str (stdout, 16, 0, x, GMP_RNDN); putchar ('\n');
+ mpfr_out_str (stdout, 16, 0, x, MPFR_RNDN); putchar ('\n');
exit (1);
}
fclose (fp);
@@ -506,14 +506,14 @@ check_regression (void)
mpfr_set_prec (y, 606);
mpfr_set_prec (z, 606);
- mpfr_set_str (y, "-f.ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff92daefc3f8052ca9f58736564d9e93e62d324@-1", 16, GMP_RNDN);
- mpfr_set_str (z, "-f.ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff92daefc3f8052ca9f58736564d9e93e62d324@-1", 16, GMP_RNDN);
- i = mpfr_mul (x, y, z, GMP_RNDU);
- mpfr_set_str (y, "f.ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff25b5df87f00a5953eb0e6cac9b3d27cc5a64c@-1", 16, GMP_RNDN);
+ mpfr_set_str (y, "-f.ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff92daefc3f8052ca9f58736564d9e93e62d324@-1", 16, MPFR_RNDN);
+ mpfr_set_str (z, "-f.ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff92daefc3f8052ca9f58736564d9e93e62d324@-1", 16, MPFR_RNDN);
+ i = mpfr_mul (x, y, z, MPFR_RNDU);
+ mpfr_set_str (y, "f.ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff25b5df87f00a5953eb0e6cac9b3d27cc5a64c@-1", 16, MPFR_RNDN);
if (mpfr_cmp (x, y) || i <= 0)
{
printf ("Regression test (2) failed! (i=%d - Expected 1)\n", i);
- mpfr_out_str (stdout, 16, 0, x, GMP_RNDN); putchar ('\n');
+ mpfr_out_str (stdout, 16, 0, x, MPFR_RNDN); putchar ('\n');
exit (1);
}
@@ -521,18 +521,18 @@ check_regression (void)
mpfr_set_prec (y, 92);
mpfr_set_prec (z, 1023);
- mpfr_set_str (y, "6.9b8c8498882770d8038c3b0@-1", 16, GMP_RNDN);
- mpfr_set_str (z, "7.44e24b986e7fb296f1e936ce749fec3504cbf0d5ba769466b1c9f1578115efd5d29b4c79271191a920a99280c714d3a657ad6e3afbab77ffce9d697e9bb9110e26d676069afcea8b69f1d1541f2365042d80a97c21dcccd8ace4f1bb58b49922003e738e6f37bb82ef653cb2e87f763974e6ae50ae54e7724c38b80653e3289@255", 16, GMP_RNDN);
- i = mpfr_mul (x, y, z, GMP_RNDU);
+ mpfr_set_str (y, "6.9b8c8498882770d8038c3b0@-1", 16, MPFR_RNDN);
+ mpfr_set_str (z, "7.44e24b986e7fb296f1e936ce749fec3504cbf0d5ba769466b1c9f1578115efd5d29b4c79271191a920a99280c714d3a657ad6e3afbab77ffce9d697e9bb9110e26d676069afcea8b69f1d1541f2365042d80a97c21dcccd8ace4f1bb58b49922003e738e6f37bb82ef653cb2e87f763974e6ae50ae54e7724c38b80653e3289@255", 16, MPFR_RNDN);
+ i = mpfr_mul (x, y, z, MPFR_RNDU);
mpfr_set_prec (y, 184);
mpfr_set_str (y, "3.0080038f2ac5054e3e71ccbb95f76aaab2221715025a28@255",
- 16, GMP_RNDN);
+ 16, MPFR_RNDN);
if (mpfr_cmp (x, y) || i <= 0)
{
printf ("Regression test (4) failed! (i=%d - expected 1)\n", i);
printf ("Ref: 3.0080038f2ac5054e3e71ccbb95f76aaab2221715025a28@255\n"
"Got: ");
- mpfr_out_str (stdout, 16, 0, x, GMP_RNDN);
+ mpfr_out_str (stdout, 16, 0, x, MPFR_RNDN);
printf ("\n");
exit (1);
}
@@ -543,20 +543,20 @@ check_regression (void)
mpfr_set_str (y, "-f.fffffffffffffffffffffffffffffffffffffffffffffffffffffff"
"fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
"ffffffffffffffffffffffffffffffffffffffffffffffffffffff99be91f83ec6f0ed28a3d42"
-"e6e9a327230345ea6@-1", 16, GMP_RNDN);
+"e6e9a327230345ea6@-1", 16, MPFR_RNDN);
mpfr_set_str (z, "-f.fffffffffffffffffffffffffffffffffffffffffffffffffffffff"
"fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
"ffffffffffffffffffffffffffffffffffffffffffffffffffffff99be91f83ec6f0ed28a3d42"
- "e6e9a327230345ea6@-1", 16, GMP_RNDN);
- i = mpfr_mul (x, y, z, GMP_RNDU);
+ "e6e9a327230345ea6@-1", 16, MPFR_RNDN);
+ i = mpfr_mul (x, y, z, MPFR_RNDU);
mpfr_set_str (y, "f.ffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
"fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
"fffffffffffffffffffffffffffffffffffffffffffffffffffff337d23f07d8de1da5147a85c"
-"dd3464e46068bd4d@-1", 16, GMP_RNDN);
+"dd3464e46068bd4d@-1", 16, MPFR_RNDN);
if (mpfr_cmp (x, y) || i <= 0)
{
printf ("Regression test (5) failed! (i=%d - expected 1)\n", i);
- mpfr_out_str (stdout, 16, 0, x, GMP_RNDN);
+ mpfr_out_str (stdout, 16, 0, x, MPFR_RNDN);
printf ("\n");
exit (1);
}
@@ -565,18 +565,18 @@ check_regression (void)
mpfr_set_prec (x, 50);
mpfr_set_prec (y, 40);
mpfr_set_prec (z, 53);
- mpfr_set_str (y, "4.1ffffffff8", 16, GMP_RNDN);
- mpfr_set_str (z, "4.2000000ffe0000@-4", 16, GMP_RNDN);
- i = mpfr_mul (x, y, z, GMP_RNDN);
- if (mpfr_cmp_str (x, "1.104000041d6c0@-3", 16, GMP_RNDN) != 0
+ mpfr_set_str (y, "4.1ffffffff8", 16, MPFR_RNDN);
+ mpfr_set_str (z, "4.2000000ffe0000@-4", 16, MPFR_RNDN);
+ i = mpfr_mul (x, y, z, MPFR_RNDN);
+ if (mpfr_cmp_str (x, "1.104000041d6c0@-3", 16, MPFR_RNDN) != 0
|| i <= 0)
{
printf ("Regression test (6) failed! (i=%d - expected 1)\nx=", i);
- mpfr_out_str (stdout, 16, 0, x, GMP_RNDN);
+ mpfr_out_str (stdout, 16, 0, x, MPFR_RNDN);
printf ("\nMore prec=");
mpfr_set_prec (x, 93);
- mpfr_mul (x, y, z, GMP_RNDN);
- mpfr_out_str (stdout, 16, 0, x, GMP_RNDN);
+ mpfr_mul (x, y, z, MPFR_RNDN);
+ mpfr_out_str (stdout, 16, 0, x, MPFR_RNDN);
printf ("\n");
exit (1);
}
@@ -585,15 +585,15 @@ check_regression (void)
mpfr_set_prec (y, 393);
mpfr_set_str (y, "-1.921fb54442d18469898cc51701b839a252049c1114cf98e804177d"
"4c76273644a29410f31c6809bbdf2a33679a748636600",
- 16, GMP_RNDN);
- i = mpfr_mul (x, y, y, GMP_RNDU);
+ 16, MPFR_RNDN);
+ i = mpfr_mul (x, y, y, MPFR_RNDU);
if (mpfr_cmp_str (x, "2.77a79937c8bbcb495b89b36602306b1c2159a8ff834288a19a08"
"84094f1cda3dc426da61174c4544a173de83c2500f8bfea2e0569e3698",
- 16, GMP_RNDN) != 0
+ 16, MPFR_RNDN) != 0
|| i <= 0)
{
printf ("Regression test (7) failed! (i=%d - expected 1)\nx=", i);
- mpfr_out_str (stdout, 16, 0, x, GMP_RNDN);
+ mpfr_out_str (stdout, 16, 0, x, MPFR_RNDN);
printf ("\n");
exit (1);
}
@@ -601,13 +601,13 @@ check_regression (void)
mpfr_set_prec (x, 1023);
mpfr_set_prec (y, 1023);
mpfr_set_prec (z, 511);
- mpfr_set_ui (x, 17, GMP_RNDN);
- mpfr_set_ui (y, 42, GMP_RNDN);
- i = mpfr_mul (z, x, y, GMP_RNDN);
+ mpfr_set_ui (x, 17, MPFR_RNDN);
+ mpfr_set_ui (y, 42, MPFR_RNDN);
+ i = mpfr_mul (z, x, y, MPFR_RNDN);
if (mpfr_cmp_ui (z, 17*42) != 0 || i != 0)
{
printf ("Regression test (8) failed! (i=%d - expected 0)\nz=", i);
- mpfr_out_str (stdout, 16, 0, z, GMP_RNDN);
+ mpfr_out_str (stdout, 16, 0, z, MPFR_RNDN);
printf ("\n");
exit (1);
}
@@ -643,34 +643,34 @@ main (int argc, char *argv[])
check_exact ();
check_float ();
- check53("6.9314718055994530941514e-1", "0.0", GMP_RNDZ, "0.0");
- check53("0.0", "6.9314718055994530941514e-1", GMP_RNDZ, "0.0");
+ check53("6.9314718055994530941514e-1", "0.0", MPFR_RNDZ, "0.0");
+ check53("0.0", "6.9314718055994530941514e-1", MPFR_RNDZ, "0.0");
check_sign();
- check53("-4.165000000e4", "-0.00004801920768307322868063274915", GMP_RNDN,
+ check53("-4.165000000e4", "-0.00004801920768307322868063274915", MPFR_RNDN,
"2.0");
check53("2.71331408349172961467e-08", "-6.72658901114033715233e-165",
- GMP_RNDZ, "-1.8251348697787782844e-172");
+ MPFR_RNDZ, "-1.8251348697787782844e-172");
check53("2.71331408349172961467e-08", "-6.72658901114033715233e-165",
- GMP_RNDA, "-1.8251348697787786e-172");
- check53("0.31869277231188065", "0.88642843322303122", GMP_RNDZ,
+ MPFR_RNDA, "-1.8251348697787786e-172");
+ check53("0.31869277231188065", "0.88642843322303122", MPFR_RNDZ,
"2.8249833483992453642e-1");
- check("8.47622108205396074254e-01", "3.24039313247872939883e-01", GMP_RNDU,
+ check("8.47622108205396074254e-01", "3.24039313247872939883e-01", MPFR_RNDU,
28, 45, 2, "0.375");
- check("8.47622108205396074254e-01", "3.24039313247872939883e-01", GMP_RNDA,
+ check("8.47622108205396074254e-01", "3.24039313247872939883e-01", MPFR_RNDA,
28, 45, 2, "0.375");
- check("2.63978122803639081440e-01", "6.8378615379333496093e-1", GMP_RNDN,
+ check("2.63978122803639081440e-01", "6.8378615379333496093e-1", MPFR_RNDN,
34, 23, 31, "0.180504585267044603");
- check("1.0", "0.11835170935876249132", GMP_RNDU, 6, 41, 36,
+ check("1.0", "0.11835170935876249132", MPFR_RNDU, 6, 41, 36,
"0.1183517093595583");
- check53("67108865.0", "134217729.0", GMP_RNDN, "9.007199456067584e15");
- check("1.37399642157394197284e-01", "2.28877275604219221350e-01", GMP_RNDN,
+ check53("67108865.0", "134217729.0", MPFR_RNDN, "9.007199456067584e15");
+ check("1.37399642157394197284e-01", "2.28877275604219221350e-01", MPFR_RNDN,
49, 15, 32, "0.0314472340833162888");
check("4.03160720978664954828e-01", "5.854828e-1"
- /*"5.85483042917246621073e-01"*/, GMP_RNDZ,
+ /*"5.85483042917246621073e-01"*/, MPFR_RNDZ,
51, 22, 32, "0.2360436821472831");
- check("3.90798504668055102229e-14", "9.85394674650308388664e-04", GMP_RNDN,
+ check("3.90798504668055102229e-14", "9.85394674650308388664e-04", MPFR_RNDN,
46, 22, 12, "0.385027296503914762e-16");
- check("4.58687081072827851358e-01", "2.20543551472118792844e-01", GMP_RNDN,
+ check("4.58687081072827851358e-01", "2.20543551472118792844e-01", MPFR_RNDN,
49, 3, 2, "0.09375");
check_max();
check_min();
diff --git a/tests/tmul_2exp.c b/tests/tmul_2exp.c
index dd1de395f..dbc37b7d4 100644
--- a/tests/tmul_2exp.c
+++ b/tests/tmul_2exp.c
@@ -66,7 +66,7 @@ underflow (mp_exp_t e)
mpfr_inits2 (8, x, y, (mpfr_ptr) 0);
for (i = 15; i <= 17; i++)
{
- inex1 = mpfr_set_ui_2exp (x, i, -4, GMP_RNDN);
+ inex1 = mpfr_set_ui_2exp (x, i, -4, MPFR_RNDN);
MPFR_ASSERTN (inex1 == 0);
for (prec = 6; prec >= 3; prec -= 3)
{
@@ -75,9 +75,9 @@ underflow (mp_exp_t e)
for (k = 1; k <= 4; k++)
{
/* The following one is assumed to be correct. */
- inex1 = mpfr_mul_2si (y, x, e, GMP_RNDN);
+ inex1 = mpfr_mul_2si (y, x, e, MPFR_RNDN);
MPFR_ASSERTN (inex1 == 0);
- inex1 = mpfr_set_ui (z1, 1 << k, GMP_RNDN);
+ inex1 = mpfr_set_ui (z1, 1 << k, MPFR_RNDN);
MPFR_ASSERTN (inex1 == 0);
mpfr_clear_flags ();
/* Do not use mpfr_div_ui to avoid the optimization
@@ -107,10 +107,10 @@ underflow (mp_exp_t e)
div == 0 ? "mul_2si" : div == 1 ? "div_2si" :
"div_2ui", i, prec, k, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd));
printf ("\nExpected ");
- mpfr_out_str (stdout, 16, 0, z1, GMP_RNDN);
+ mpfr_out_str (stdout, 16, 0, z1, MPFR_RNDN);
printf (", inex = %d, flags = %u\n", SIGN (inex1), flags1);
printf ("Got ");
- mpfr_out_str (stdout, 16, 0, z2, GMP_RNDN);
+ mpfr_out_str (stdout, 16, 0, z2, MPFR_RNDN);
printf (", inex = %d, flags = %u\n", SIGN (inex2), flags2);
exit (1);
} /* div */
@@ -145,7 +145,7 @@ main (int argc, char *argv[])
for (i = 0; i < 3; i++)
{
mpfr_set_inf (w, 1);
- test_mul (i, 0, w, w, 10, GMP_RNDZ);
+ test_mul (i, 0, w, w, 10, MPFR_RNDZ);
if (!MPFR_IS_INF(w))
{
printf ("Result is not Inf (i = %d)\n", i);
@@ -153,7 +153,7 @@ main (int argc, char *argv[])
}
mpfr_set_nan (w);
- test_mul (i, 0, w, w, 10, GMP_RNDZ);
+ test_mul (i, 0, w, w, 10, MPFR_RNDZ);
if (!MPFR_IS_NAN(w))
{
printf ("Result is not NaN (i = %d)\n", i);
@@ -162,24 +162,24 @@ main (int argc, char *argv[])
for (k = 0 ; k < numberof(val) ; k+=3)
{
- mpfr_set_str (w, val[k], 16, GMP_RNDN);
- test_mul (i, 0, z, w, 10, GMP_RNDZ);
- if (mpfr_cmp_str (z, val[k+1], 16, GMP_RNDN))
+ mpfr_set_str (w, val[k], 16, MPFR_RNDN);
+ test_mul (i, 0, z, w, 10, MPFR_RNDZ);
+ if (mpfr_cmp_str (z, val[k+1], 16, MPFR_RNDN))
{
printf ("ERROR for x * 2^n (i = %d) for %s\n", i, val[k]);
printf ("Expected: %s\n"
"Got : ", val[k+1]);
- mpfr_out_str (stdout, 16, 0, z, GMP_RNDN);
+ mpfr_out_str (stdout, 16, 0, z, MPFR_RNDN);
putchar ('\n');
exit (1);
}
- test_mul (i, 1, z, w, 10, GMP_RNDZ);
- if (mpfr_cmp_str (z, val[k+2], 16, GMP_RNDN))
+ test_mul (i, 1, z, w, 10, MPFR_RNDZ);
+ if (mpfr_cmp_str (z, val[k+2], 16, MPFR_RNDN))
{
printf ("ERROR for x / 2^n (i = %d) for %s\n", i, val[k]);
printf ("Expected: %s\n"
"Got : ", val[k+2]);
- mpfr_out_str (stdout, 16, 0, z, GMP_RNDN);
+ mpfr_out_str (stdout, 16, 0, z, MPFR_RNDN);
putchar ('\n');
exit (1);
}
@@ -187,15 +187,15 @@ main (int argc, char *argv[])
mpfr_set_inf (w, 1);
mpfr_nextbelow (w);
- test_mul (i, 0, w, w, 1, GMP_RNDN);
+ test_mul (i, 0, w, w, 1, MPFR_RNDN);
if (!mpfr_inf_p (w))
{
printf ("Overflow error (i = %d)!\n", i);
exit (1);
}
- mpfr_set_ui (w, 0, GMP_RNDN);
+ mpfr_set_ui (w, 0, MPFR_RNDN);
mpfr_nextabove (w);
- test_mul (i, 1, w, w, 1, GMP_RNDN);
+ test_mul (i, 1, w, w, 1, MPFR_RNDN);
if (mpfr_cmp_ui (w, 0))
{
printf ("Underflow error (i = %d)!\n", i);
@@ -207,10 +207,10 @@ main (int argc, char *argv[])
{
unsigned long lmp1 = (unsigned long) LONG_MAX + 1;
- mpfr_set_ui (w, 1, GMP_RNDN);
- mpfr_mul_2ui (w, w, LONG_MAX/2, GMP_RNDZ);
- mpfr_div_2ui (w, w, lmp1, GMP_RNDZ);
- mpfr_mul_2ui (w, w, lmp1 - LONG_MAX/2, GMP_RNDZ);
+ mpfr_set_ui (w, 1, MPFR_RNDN);
+ mpfr_mul_2ui (w, w, LONG_MAX/2, MPFR_RNDZ);
+ mpfr_div_2ui (w, w, lmp1, MPFR_RNDZ);
+ mpfr_mul_2ui (w, w, lmp1 - LONG_MAX/2, MPFR_RNDZ);
if (!mpfr_cmp_ui (w, 1))
{
printf ("Underflow LONG_MAX error!\n");
diff --git a/tests/tmul_d.c b/tests/tmul_d.c
index 08b76c8bc..05eb4e0f2 100644
--- a/tests/tmul_d.c
+++ b/tests/tmul_d.c
@@ -40,7 +40,7 @@ check_nans (void)
/* nan * 1.0 is nan */
mpfr_set_nan (x);
mpfr_clear_flags();
- inexact = mpfr_mul_d (y, x, 1.0, GMP_RNDN);
+ inexact = mpfr_mul_d (y, x, 1.0, MPFR_RNDN);
MPFR_ASSERTN (inexact == 0);
MPFR_ASSERTN ((__gmpfr_flags ^ MPFR_FLAGS_NAN) == 0);
MPFR_ASSERTN (mpfr_nan_p (y));
@@ -48,7 +48,7 @@ check_nans (void)
/* +inf * 1.0 == +inf */
mpfr_set_inf (x, 1);
mpfr_clear_flags();
- inexact = mpfr_mul_d (y, x, 1.0, GMP_RNDN);
+ inexact = mpfr_mul_d (y, x, 1.0, MPFR_RNDN);
MPFR_ASSERTN (inexact == 0);
MPFR_ASSERTN (__gmpfr_flags == 0);
MPFR_ASSERTN (mpfr_inf_p (y));
@@ -56,7 +56,7 @@ check_nans (void)
/* +inf * 0.0 is nan */
mpfr_clear_flags();
- inexact = mpfr_mul_d (y, x, 0.0, GMP_RNDN);
+ inexact = mpfr_mul_d (y, x, 0.0, MPFR_RNDN);
MPFR_ASSERTN (inexact == 0);
MPFR_ASSERTN ((__gmpfr_flags ^ MPFR_FLAGS_NAN) == 0);
MPFR_ASSERTN (mpfr_nan_p (y));
@@ -64,7 +64,7 @@ check_nans (void)
/* -inf * 1.0 == -inf */
mpfr_set_inf (x, -1);
mpfr_clear_flags();
- inexact = mpfr_mul_d (y, x, 1.0, GMP_RNDN);
+ inexact = mpfr_mul_d (y, x, 1.0, MPFR_RNDN);
MPFR_ASSERTN (inexact == 0);
MPFR_ASSERTN (__gmpfr_flags == 0);
MPFR_ASSERTN (mpfr_inf_p (y));
@@ -93,24 +93,24 @@ main (void)
mpfr_init2 (y, IEEE_DBL_MANT_DIG);
mpfr_init2 (z, IEEE_DBL_MANT_DIG);
- mpfr_set_str (y, "4096", 10, GMP_RNDN);
+ mpfr_set_str (y, "4096", 10, MPFR_RNDN);
d = 0.125;
mpfr_clear_flags ();
- inexact = mpfr_mul_d (x, y, d, GMP_RNDN);
+ inexact = mpfr_mul_d (x, y, d, MPFR_RNDN);
if (inexact != 0)
{
printf ("Inexact flag error in mpfr_mul_d\n");
exit (1);
}
- mpfr_set_str (z, "512", 10, GMP_RNDN);
+ mpfr_set_str (z, "512", 10, MPFR_RNDN);
if (mpfr_cmp (z, x))
{
printf ("Error in mpfr_mul_d (");
- mpfr_out_str (stdout, 10, 0, y, GMP_RNDN);
+ mpfr_out_str (stdout, 10, 0, y, MPFR_RNDN);
printf (" + %.20g)\nexpected ", d);
- mpfr_out_str (stdout, 10, 0, z, GMP_RNDN);
+ mpfr_out_str (stdout, 10, 0, z, MPFR_RNDN);
printf ("\ngot ");
- mpfr_out_str (stdout, 10, 0, x, GMP_RNDN);
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN);
printf ("\n");
exit (1);
}
diff --git a/tests/tmul_ui.c b/tests/tmul_ui.c
index e947fb8b3..f1a32b4f7 100644
--- a/tests/tmul_ui.c
+++ b/tests/tmul_ui.c
@@ -39,14 +39,14 @@ check_inexact (mp_prec_t p)
mpfr_init2 (z, p + mp_bits_per_limb);
mpfr_urandomb (x, RANDS);
u = randlimb ();
- if (mpfr_mul_ui (z, x, u, GMP_RNDN))
+ if (mpfr_mul_ui (z, x, u, MPFR_RNDN))
{
printf ("Error: result should be exact\n");
exit (1);
}
for (q = 2; q <= p; q++)
- for (rnd = 0; rnd < GMP_RND_MAX; rnd++)
+ for (rnd = 0; rnd < MPFR_RND_MAX; rnd++)
{
mpfr_set_prec (y, q);
inexact = mpfr_mul_ui (y, x, u, (mp_rnd_t) rnd);
@@ -63,8 +63,8 @@ check_inexact (mp_prec_t p)
}
mpfr_set_prec (x, 2);
- mpfr_set_ui (x, 1, GMP_RNDN);
- if (mpfr_mul_ui (x, x, 5, GMP_RNDZ) == 0)
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ if (mpfr_mul_ui (x, x, 5, MPFR_RNDZ) == 0)
{
printf ("mul_ui(1, 5) cannot be exact with prec=2\n");
exit (1);
@@ -98,8 +98,8 @@ main (int argc, char *argv[])
mpfr_init2 (y, 53);
/* checks that result is normalized */
- mpfr_set_str (y, "6.93147180559945286227e-01", 10, GMP_RNDZ);
- mpfr_mul_ui (x, y, 1, GMP_RNDZ);
+ mpfr_set_str (y, "6.93147180559945286227e-01", 10, MPFR_RNDZ);
+ mpfr_mul_ui (x, y, 1, MPFR_RNDZ);
if (MPFR_MANT(x)[MPFR_PREC(x)/mp_bits_per_limb] >> (mp_bits_per_limb-1) == 0)
{
printf ("Error in mpfr_mul_ui: result not normalized\n");
@@ -114,7 +114,7 @@ main (int argc, char *argv[])
}
mpfr_set_inf (x, 1);
- mpfr_mul_ui (x, x, 3, GMP_RNDU);
+ mpfr_mul_ui (x, x, 3, MPFR_RNDU);
if (!mpfr_inf_p (x) || (mpfr_sgn (x) <= 0))
{
printf ("Error in mpfr_mul_ui: +Inf*3 does not give +Inf\n");
@@ -122,7 +122,7 @@ main (int argc, char *argv[])
}
mpfr_set_inf (x, -1);
- mpfr_mul_ui (x, x, 3, GMP_RNDU);
+ mpfr_mul_ui (x, x, 3, MPFR_RNDU);
if (!mpfr_inf_p (x) || (mpfr_sgn (x) >= 0))
{
printf ("Error in mpfr_mul_ui: -Inf*3 does not give -Inf\n");
@@ -130,7 +130,7 @@ main (int argc, char *argv[])
}
mpfr_set_nan (x);
- mpfr_mul_ui (x, x, 3, GMP_RNDU);
+ mpfr_mul_ui (x, x, 3, MPFR_RNDU);
if (!mpfr_nan_p(x))
{
printf ("Error in mpfr_mul_ui: NaN*3 does not give NaN\n");
@@ -138,23 +138,23 @@ main (int argc, char *argv[])
}
mpfr_set_inf (x, 1);
- mpfr_mul_ui (x, x, 0, GMP_RNDU);
+ mpfr_mul_ui (x, x, 0, MPFR_RNDU);
MPFR_ASSERTN(mpfr_nan_p (x));
- mpfr_set_ui (x, 1, GMP_RNDU);
- mpfr_mul_ui (x, x, 0, GMP_RNDU);
+ mpfr_set_ui (x, 1, MPFR_RNDU);
+ mpfr_mul_ui (x, x, 0, MPFR_RNDU);
MPFR_ASSERTN(mpfr_cmp_ui (x, 0) == 0 && MPFR_IS_POS(x));
emax = mpfr_get_emax ();
set_emax (0);
mpfr_set_str_binary (x, "0.1E0");
- mpfr_mul_ui (x, x, 2, GMP_RNDN);
+ mpfr_mul_ui (x, x, 2, MPFR_RNDN);
MPFR_ASSERTN(mpfr_inf_p (x) && MPFR_IS_POS(x));
set_emax (emax);
mpfr_set_str (x, /*1.0/3.0*/
- "0.333333333333333333333333333333333", 10, GMP_RNDZ);
- mpfr_mul_ui (x, x, 3, GMP_RNDU);
+ "0.333333333333333333333333333333333", 10, MPFR_RNDZ);
+ mpfr_mul_ui (x, x, 3, MPFR_RNDU);
if (mpfr_cmp_ui (x, 1))
{
printf ("Error in mpfr_mul_ui: U(Z(1/3)*3) does not give 1\n");
@@ -162,9 +162,9 @@ main (int argc, char *argv[])
}
/* checks sign is correct */
- mpfr_set_si (x, -2, GMP_RNDZ);
- mpfr_set_si (y, 3, GMP_RNDZ);
- mpfr_mul_ui(x, y, 4, GMP_RNDZ);
+ mpfr_set_si (x, -2, MPFR_RNDZ);
+ mpfr_set_si (y, 3, MPFR_RNDZ);
+ mpfr_mul_ui(x, y, 4, MPFR_RNDZ);
if (mpfr_cmp_ui(x, 0) <= 0)
{
printf("Error in mpfr_mul_ui: 4*3.0 does not give a positive result:\n");
@@ -176,7 +176,7 @@ main (int argc, char *argv[])
mpfr_set_prec (x, 9);
mpfr_set_prec (y, 9);
mpfr_set_str_binary (y, "0.100001111E9"); /* 271 */
- mpfr_mul_ui (x, y, 1335, GMP_RNDN);
+ mpfr_mul_ui (x, y, 1335, MPFR_RNDN);
mpfr_set_str_binary (y, "0.101100001E19"); /* 361472 */
if (mpfr_cmp (x, y))
{
@@ -189,7 +189,7 @@ main (int argc, char *argv[])
mpfr_set_prec(x, 100);
/* y = 1199781142214086656 */
mpfr_set_str_binary(y, "0.1000010100110011110101001011110010101111000100001E61");
- mpfr_mul_ui(x, y, 121, GMP_RNDD);
+ mpfr_mul_ui(x, y, 121, MPFR_RNDD);
/* 121*y = 145173518207904485376, representable exactly */
mpfr_set_str_binary(y, "0.1111101111010101111111100011010010111010111110110011001E67");
if (mpfr_cmp(x, y))
@@ -201,12 +201,12 @@ main (int argc, char *argv[])
mpfr_set_prec (x, 32);
mpfr_set_str_binary (x, "0.10000000000000000000000000000000E1");
mpfr_set_prec (y, 93);
- mpfr_mul_ui (y, x, 1, GMP_RNDN);
+ mpfr_mul_ui (y, x, 1, MPFR_RNDN);
mpfr_set_prec (x, 287);
mpfr_set_str_binary (x, "0.1111E7");
mpfr_set_prec (y, 289);
- mpfr_mul_ui (y, x, 6, GMP_RNDN);
+ mpfr_mul_ui (y, x, 6, MPFR_RNDN);
mpfr_set_str_binary (x, "0.101101E10");
if (mpfr_cmp (x, y))
{
@@ -216,8 +216,8 @@ main (int argc, char *argv[])
mpfr_set_prec (x, 68);
mpfr_set_prec (y, 64);
- mpfr_set_str (x, "2143861251406875.0", 10, GMP_RNDN);
- mpfr_mul_ui (y, x, 23, GMP_RNDN);
+ mpfr_set_str (x, "2143861251406875.0", 10, MPFR_RNDN);
+ mpfr_mul_ui (y, x, 23, MPFR_RNDN);
mpfr_set_str_binary (x, "10101111001011100001100110101111110001010010011001101101.0");
if (mpfr_cmp (x, y))
{
@@ -235,7 +235,7 @@ main (int argc, char *argv[])
for (yprec = 53; yprec <= 128; yprec++)
{
mpfr_set_prec (y, yprec);
- mpfr_mul_ui (y, x, 1, GMP_RNDN);
+ mpfr_mul_ui (y, x, 1, MPFR_RNDN);
if (mpfr_cmp(x,y))
{
printf ("multiplication by 1.0 fails for xprec=%u, yprec=%u\n",
@@ -248,11 +248,11 @@ main (int argc, char *argv[])
}
mpfr_set_prec (x, 128);
- mpfr_set_ui (x, 17, GMP_RNDN);
- mpfr_mul_ui (x, x, ULONG_HIGHBIT, GMP_RNDN);
+ mpfr_set_ui (x, 17, MPFR_RNDN);
+ mpfr_mul_ui (x, x, ULONG_HIGHBIT, MPFR_RNDN);
mpfr_set_prec (y, 128);
- mpfr_set_ui (y, ULONG_HIGHBIT, GMP_RNDN);
- mpfr_mul_ui (y, y, 17, GMP_RNDN);
+ mpfr_set_ui (y, ULONG_HIGHBIT, MPFR_RNDN);
+ mpfr_mul_ui (y, y, 17, MPFR_RNDN);
if (mpfr_cmp (x, y))
{
printf ("Error for 17 * ULONG_HIGHBIT\n");
@@ -262,11 +262,11 @@ main (int argc, char *argv[])
/* Check regression */
mpfr_set_prec (x, 32);
mpfr_set_prec (y, 96);
- mpfr_set_ui (x, 1742175942, GMP_RNDN);
- mpfr_mul_ui (y, x, 59, GMP_RNDN);
+ mpfr_set_ui (x, 1742175942, MPFR_RNDN);
+ mpfr_mul_ui (y, x, 59, MPFR_RNDN);
if (mpfr_cmp_str (y, "0.10111111011101010101000110111101000100000000000000"
"0000000000000000000000000000000000000000000000E37",
- 2, GMP_RNDN))
+ 2, MPFR_RNDN))
{
printf ("Regression tested failed for x=1742175942 * 59\n");
exit (1);
diff --git a/tests/tnext.c b/tests/tnext.c
index 9a129c51f..5e45f5335 100644
--- a/tests/tnext.c
+++ b/tests/tnext.c
@@ -51,11 +51,11 @@ generic_abovebelow (void)
MPFR_ASSERTN(mpfr_nan_p (x));
mpfr_nexttoward (x, y);
MPFR_ASSERTN(mpfr_nan_p (x));
- mpfr_set_ui (y, 1, GMP_RNDN);
+ mpfr_set_ui (y, 1, MPFR_RNDN);
mpfr_nexttoward (y, x);
MPFR_ASSERTN(mpfr_nan_p (y));
- mpfr_set_ui (x, 1, GMP_RNDN);
- mpfr_set_ui (y, 1, GMP_RNDN);
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_set_ui (y, 1, MPFR_RNDN);
mpfr_nexttoward (x, y);
MPFR_ASSERTN(mpfr_cmp_ui (x, 1) == 0);
}
@@ -65,26 +65,26 @@ generic_abovebelow (void)
while (mpfr_cmp_ui (x, 0) == 0);
neg = randlimb () & 1;
if (neg)
- mpfr_neg (x, x, GMP_RNDN);
- mpfr_set (y, x, GMP_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN);
+ mpfr_set (y, x, MPFR_RNDN);
below = randlimb () & 1;
if (below)
mpfr_nextbelow (y);
else
mpfr_nextabove (y);
- mpfr_set_si (t, below ? -5 : 5, GMP_RNDN);
- mpfr_mul_2si (t, t, (mpfr_get_exp) (x) - prec - 3, GMP_RNDN);
+ mpfr_set_si (t, below ? -5 : 5, MPFR_RNDN);
+ mpfr_mul_2si (t, t, (mpfr_get_exp) (x) - prec - 3, MPFR_RNDN);
/* t = (1/2 + 1/8) ulp(x) */
- mpfr_add (z, x, t, GMP_RNDN);
+ mpfr_add (z, x, t, MPFR_RNDN);
if (!mpfr_number_p (y) || mpfr_cmp (y, z) != 0)
{
printf ("Error in mpfr_next%s for\n",
below ? "below" : "above");
- mpfr_out_str (stdout, 2, 0, x, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN);
printf (", got\n");
- mpfr_out_str (stdout, 2, 0, y, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN);
printf (" instead of\n");
- mpfr_out_str (stdout, 2, 0, z, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, z, MPFR_RNDN);
printf ("\n");
exit (1);
}
@@ -108,10 +108,10 @@ inverse_test (void)
int sign;
mpfr_inits2 (prec, x, y, (mpfr_ptr) 0);
- mpfr_set_str (x, tests[i], 10, GMP_RNDN);
+ mpfr_set_str (x, tests[i], 10, MPFR_RNDN);
if (neg)
- mpfr_neg (x, x, GMP_RNDN);
- mpfr_set (y, x, GMP_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN);
+ mpfr_set (y, x, MPFR_RNDN);
if (below)
mpfr_nextbelow (y);
else
@@ -125,9 +125,9 @@ inverse_test (void)
" below = %d, prec = %d: x = y", tests[i],
neg, below, (int) prec);
printf ("\nx = ");
- mpfr_out_str (stdout, 2, 0, x, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN);
printf ("\ny = ");
- mpfr_out_str (stdout, 2, 0, y, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN);
printf ("\n");
exit (1);
}
@@ -137,7 +137,7 @@ inverse_test (void)
printf ("Sign error in inverse_test for %s, neg = %d,"
" below = %d, prec = %d\n", tests[i], neg,
below, (int) prec);
- mpfr_out_str (stdout, 2, 0, y, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN);
printf ("\n");
exit (1);
}
@@ -147,9 +147,9 @@ inverse_test (void)
printf ("Error in inverse_test for %s, neg = %d, below = %d,"
" prec = %d", tests[i], neg, below, (int) prec);
printf ("\nx = ");
- mpfr_out_str (stdout, 2, 0, x, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN);
printf ("\ny = ");
- mpfr_out_str (stdout, 2, 0, y, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN);
printf ("\n");
exit (1);
}
diff --git a/tests/tout_str.c b/tests/tout_str.c
index a4b6ca7d1..d79387664 100644
--- a/tests/tout_str.c
+++ b/tests/tout_str.c
@@ -52,18 +52,18 @@ special (void)
mpfr_init (x);
mpfr_set_nan (x);
- mpfr_out_str (fout, 10, 0, x, GMP_RNDN);
+ mpfr_out_str (fout, 10, 0, x, MPFR_RNDN);
mpfr_set_inf (x, 1);
- mpfr_out_str (fout, 10, 0, x, GMP_RNDN);
+ mpfr_out_str (fout, 10, 0, x, MPFR_RNDN);
mpfr_set_inf (x, -1);
- mpfr_out_str (fout, 10, 0, x, GMP_RNDN);
+ mpfr_out_str (fout, 10, 0, x, MPFR_RNDN);
- mpfr_set_ui (x, 0, GMP_RNDN);
- mpfr_out_str (fout, 10, 0, x, GMP_RNDN);
- mpfr_neg (x, x, GMP_RNDN);
- mpfr_out_str (fout, 10, 0, x, GMP_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_out_str (fout, 10, 0, x, MPFR_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN);
+ mpfr_out_str (fout, 10, 0, x, MPFR_RNDN);
mpfr_clear (x);
}
@@ -100,22 +100,22 @@ main (int argc, char *argv[])
special ();
- check (-1.37247529013405550000e+15, GMP_RNDN, 7);
- check (-1.5674376729569697500e+15, GMP_RNDN, 19);
- check (-5.71262771772792640000e-79, GMP_RNDU, 16);
- check (DBL_NEG_ZERO, GMP_RNDU, 7);
- check (-4.5306392613572974756e-308, GMP_RNDN, 8);
- check (-6.7265890111403371523e-165, GMP_RNDN, 4);
- check (-1.3242553591261807653e+156, GMP_RNDN, 16);
- check (-6.606499965302424244461355e233, GMP_RNDN, 10);
- check4 (1.0, GMP_RNDN, 10, 120);
- check (1.0, GMP_RNDU, 10);
- check (4.059650008e-83, GMP_RNDN, 10);
- check (-7.4, GMP_RNDN, 10);
- check (0.997, GMP_RNDN, 10);
- check (-4.53063926135729747564e-308, GMP_RNDN, 10);
- check (2.14478198760196000000e+16, GMP_RNDN, 10);
- check (7.02293374921793516813e-84, GMP_RNDN, 10);
+ check (-1.37247529013405550000e+15, MPFR_RNDN, 7);
+ check (-1.5674376729569697500e+15, MPFR_RNDN, 19);
+ check (-5.71262771772792640000e-79, MPFR_RNDU, 16);
+ check (DBL_NEG_ZERO, MPFR_RNDU, 7);
+ check (-4.5306392613572974756e-308, MPFR_RNDN, 8);
+ check (-6.7265890111403371523e-165, MPFR_RNDN, 4);
+ check (-1.3242553591261807653e+156, MPFR_RNDN, 16);
+ check (-6.606499965302424244461355e233, MPFR_RNDN, 10);
+ check4 (1.0, MPFR_RNDN, 10, 120);
+ check (1.0, MPFR_RNDU, 10);
+ check (4.059650008e-83, MPFR_RNDN, 10);
+ check (-7.4, MPFR_RNDN, 10);
+ check (0.997, MPFR_RNDN, 10);
+ check (-4.53063926135729747564e-308, MPFR_RNDN, 10);
+ check (2.14478198760196000000e+16, MPFR_RNDN, 10);
+ check (7.02293374921793516813e-84, MPFR_RNDN, 10);
/* random tests */
for (i=0;i<N;i++)
diff --git a/tests/toutimpl.c b/tests/toutimpl.c
index a975e2261..043aa3aa4 100644
--- a/tests/toutimpl.c
+++ b/tests/toutimpl.c
@@ -47,28 +47,28 @@ main (void)
tests_start_mpfr ();
/* Check RND_MODE */
- if (strcmp (mpfr_print_rnd_mode(GMP_RNDN), "GMP_RNDN"))
+ if (strcmp (mpfr_print_rnd_mode(MPFR_RNDN), "MPFR_RNDN"))
{
- printf ("Error for printing GMP_RNDN\n");
+ printf ("Error for printing MPFR_RNDN\n");
exit (1);
}
- if (strcmp (mpfr_print_rnd_mode(GMP_RNDU), "GMP_RNDU"))
+ if (strcmp (mpfr_print_rnd_mode(MPFR_RNDU), "MPFR_RNDU"))
{
- printf ("Error for printing GMP_RNDU\n");
+ printf ("Error for printing MPFR_RNDU\n");
exit (1);
}
- if (strcmp (mpfr_print_rnd_mode(GMP_RNDD), "GMP_RNDD"))
+ if (strcmp (mpfr_print_rnd_mode(MPFR_RNDD), "MPFR_RNDD"))
{
- printf ("Error for printing GMP_RNDD\n");
+ printf ("Error for printing MPFR_RNDD\n");
exit (1);
}
- if (strcmp (mpfr_print_rnd_mode(GMP_RNDZ), "GMP_RNDZ"))
+ if (strcmp (mpfr_print_rnd_mode(MPFR_RNDZ), "MPFR_RNDZ"))
{
- printf ("Error for printing GMP_RNDZ\n");
+ printf ("Error for printing MPFR_RNDZ\n");
exit (1);
}
if (mpfr_print_rnd_mode ((mp_rnd_t) -1) != NULL ||
- mpfr_print_rnd_mode (GMP_RND_MAX) != NULL)
+ mpfr_print_rnd_mode (MPFR_RND_MAX) != NULL)
{
printf ("Error for illegal rounding mode values.\n");
exit (1);
diff --git a/tests/tpow.c b/tests/tpow.c
index 53ae22ea6..4011e72ca 100644
--- a/tests/tpow.c
+++ b/tests/tpow.c
@@ -33,7 +33,7 @@ static int
test_pow (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mp_rnd_t rnd_mode)
{
int res;
- int ok = rnd_mode == GMP_RNDN && mpfr_number_p (b) && mpfr_number_p (c)
+ int ok = rnd_mode == MPFR_RNDN && mpfr_number_p (b) && mpfr_number_p (c)
&& mpfr_get_prec (a) >= 53;
if (ok)
{
@@ -82,9 +82,9 @@ check_pow_ui (void)
mpfr_init2 (b, 53);
/* check in-place operations */
- mpfr_set_str (b, "0.6926773", 10, GMP_RNDN);
- mpfr_pow_ui (a, b, 10, GMP_RNDN);
- mpfr_pow_ui (b, b, 10, GMP_RNDN);
+ mpfr_set_str (b, "0.6926773", 10, MPFR_RNDN);
+ mpfr_pow_ui (a, b, 10, MPFR_RNDN);
+ mpfr_pow_ui (b, b, 10, MPFR_RNDN);
if (mpfr_cmp (a, b))
{
printf ("Error for mpfr_pow_ui (b, b, ...)\n");
@@ -92,11 +92,11 @@ check_pow_ui (void)
}
/* check large exponents */
- mpfr_set_ui (b, 1, GMP_RNDN);
- mpfr_pow_ui (a, b, 4294967295UL, GMP_RNDN);
+ mpfr_set_ui (b, 1, MPFR_RNDN);
+ mpfr_pow_ui (a, b, 4294967295UL, MPFR_RNDN);
mpfr_set_inf (a, -1);
- mpfr_pow_ui (a, a, 4049053855UL, GMP_RNDN);
+ mpfr_pow_ui (a, a, 4049053855UL, MPFR_RNDN);
if (!mpfr_inf_p (a) || (mpfr_sgn (a) >= 0))
{
printf ("Error for (-Inf)^4049053855\n");
@@ -104,7 +104,7 @@ check_pow_ui (void)
}
mpfr_set_inf (a, -1);
- mpfr_pow_ui (a, a, (unsigned long) 30002752, GMP_RNDN);
+ mpfr_pow_ui (a, a, (unsigned long) 30002752, MPFR_RNDN);
if (!mpfr_inf_p (a) || (mpfr_sgn (a) <= 0))
{
printf ("Error for (-Inf)^30002752\n");
@@ -113,7 +113,7 @@ check_pow_ui (void)
/* Check underflow */
mpfr_set_str_binary (a, "1E-1");
- res = mpfr_pow_ui (a, a, -mpfr_get_emin (), GMP_RNDN);
+ res = mpfr_pow_ui (a, a, -mpfr_get_emin (), MPFR_RNDN);
if (MPFR_GET_EXP (a) != mpfr_get_emin () + 1)
{
printf ("Error for (1e-1)^MPFR_EMAX_MAX\n");
@@ -122,7 +122,7 @@ check_pow_ui (void)
}
mpfr_set_str_binary (a, "1E-10");
- res = mpfr_pow_ui (a, a, -mpfr_get_emin (), GMP_RNDZ);
+ res = mpfr_pow_ui (a, a, -mpfr_get_emin (), MPFR_RNDZ);
if (!MPFR_IS_ZERO (a))
{
printf ("Error for (1e-10)^MPFR_EMAX_MAX\n");
@@ -132,7 +132,7 @@ check_pow_ui (void)
/* Check overflow */
mpfr_set_str_binary (a, "1E10");
- res = mpfr_pow_ui (a, a, ULONG_MAX, GMP_RNDN);
+ res = mpfr_pow_ui (a, a, ULONG_MAX, MPFR_RNDN);
if (!MPFR_IS_INF (a) || MPFR_SIGN (a) < 0)
{
printf ("Error for (1e10)^ULONG_MAX\n");
@@ -145,7 +145,7 @@ check_pow_ui (void)
gets a wrong sign (positive instead of negative). */
mpfr_set_str_binary (a, "-1E10");
n = (ULONG_MAX ^ (ULONG_MAX >> 1)) + 1;
- res = mpfr_pow_ui (a, a, n, GMP_RNDN);
+ res = mpfr_pow_ui (a, a, n, MPFR_RNDN);
if (!MPFR_IS_INF (a) || MPFR_SIGN (a) > 0)
{
printf ("Error for (-1e10)^%lu, expected -Inf,\ngot ", n);
@@ -156,8 +156,8 @@ check_pow_ui (void)
/* Check 0 */
MPFR_SET_ZERO (a);
MPFR_SET_POS (a);
- mpfr_set_si (b, -1, GMP_RNDN);
- res = mpfr_pow_ui (b, a, 1, GMP_RNDN);
+ mpfr_set_si (b, -1, MPFR_RNDN);
+ res = mpfr_pow_ui (b, a, 1, MPFR_RNDN);
if (res != 0 || MPFR_IS_NEG (b))
{
printf ("Error for (0+)^1\n");
@@ -165,8 +165,8 @@ check_pow_ui (void)
}
MPFR_SET_ZERO (a);
MPFR_SET_NEG (a);
- mpfr_set_ui (b, 1, GMP_RNDN);
- res = mpfr_pow_ui (b, a, 5, GMP_RNDN);
+ mpfr_set_ui (b, 1, MPFR_RNDN);
+ res = mpfr_pow_ui (b, a, 5, MPFR_RNDN);
if (res != 0 || MPFR_IS_POS (b))
{
printf ("Error for (0-)^5\n");
@@ -174,8 +174,8 @@ check_pow_ui (void)
}
MPFR_SET_ZERO (a);
MPFR_SET_NEG (a);
- mpfr_set_si (b, -1, GMP_RNDN);
- res = mpfr_pow_ui (b, a, 6, GMP_RNDN);
+ mpfr_set_si (b, -1, MPFR_RNDN);
+ res = mpfr_pow_ui (b, a, 6, MPFR_RNDN);
if (res != 0 || MPFR_IS_NEG (b))
{
printf ("Error for (0-)^6\n");
@@ -186,7 +186,7 @@ check_pow_ui (void)
mpfr_set_prec (b, 122);
mpfr_set_str_binary (a, "0.10000010010000111101001110100101101010011110011100001111000001001101000110011001001001001011001011010110110110101000111011E1");
mpfr_set_str_binary (b, "0.11111111100101001001000001000001100011100000001110111111100011111000111011100111111111110100011000111011000100100011001011E51290375");
- mpfr_pow_ui (a, a, 2026876995UL, GMP_RNDU);
+ mpfr_pow_ui (a, a, 2026876995UL, MPFR_RNDU);
if (mpfr_cmp (a, b) != 0)
{
printf ("Error for x^2026876995\n");
@@ -197,14 +197,14 @@ check_pow_ui (void)
mpfr_set_prec (b, 29);
mpfr_set_str_binary (a, "1.0000000000000000000000001111");
mpfr_set_str_binary (b, "1.1001101111001100111001010111e165");
- mpfr_pow_ui (a, a, 2055225053, GMP_RNDZ);
+ mpfr_pow_ui (a, a, 2055225053, MPFR_RNDZ);
if (mpfr_cmp (a, b) != 0)
{
printf ("Error for x^2055225053\n");
printf ("Expected ");
- mpfr_out_str (stdout, 2, 0, b, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, b, MPFR_RNDN);
printf ("\nGot ");
- mpfr_out_str (stdout, 2, 0, a, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, a, MPFR_RNDN);
printf ("\n");
exit (1);
}
@@ -214,41 +214,41 @@ check_pow_ui (void)
mpfr_set_prec (b, 53);
mpfr_set_str_binary (a, "1.0000010110000100001000101101101001011101101011010111");
mpfr_set_str_binary (b, "1.0000110111101111011010110100001100010000001010110100E1");
- mpfr_pow_ui (a, a, 35, GMP_RNDN);
+ mpfr_pow_ui (a, a, 35, MPFR_RNDN);
if (mpfr_cmp (a, b) != 0)
{
printf ("Error in mpfr_pow_ui for worst case (1)\n");
printf ("Expected ");
- mpfr_out_str (stdout, 2, 0, b, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, b, MPFR_RNDN);
printf ("\nGot ");
- mpfr_out_str (stdout, 2, 0, a, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, a, MPFR_RNDN);
printf ("\n");
exit (1);
}
/* worst cases found on 2006-11-26 */
mpfr_set_str_binary (a, "1.0110100111010001101001010111001110010100111111000011");
mpfr_set_str_binary (b, "1.1111010011101110001111010110000101110000110110101100E17");
- mpfr_pow_ui (a, a, 36, GMP_RNDD);
+ mpfr_pow_ui (a, a, 36, MPFR_RNDD);
if (mpfr_cmp (a, b) != 0)
{
printf ("Error in mpfr_pow_ui for worst case (2)\n");
printf ("Expected ");
- mpfr_out_str (stdout, 2, 0, b, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, b, MPFR_RNDN);
printf ("\nGot ");
- mpfr_out_str (stdout, 2, 0, a, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, a, MPFR_RNDN);
printf ("\n");
exit (1);
}
mpfr_set_str_binary (a, "1.1001010100001110000110111111100011011101110011000100");
mpfr_set_str_binary (b, "1.1100011101101101100010110001000001110001111110010001E23");
- mpfr_pow_ui (a, a, 36, GMP_RNDU);
+ mpfr_pow_ui (a, a, 36, MPFR_RNDU);
if (mpfr_cmp (a, b) != 0)
{
printf ("Error in mpfr_pow_ui for worst case (3)\n");
printf ("Expected ");
- mpfr_out_str (stdout, 2, 0, b, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, b, MPFR_RNDN);
printf ("\nGot ");
- mpfr_out_str (stdout, 2, 0, a, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, a, MPFR_RNDN);
printf ("\n");
exit (1);
}
@@ -265,37 +265,37 @@ check_pow_si (void)
mpfr_init (x);
mpfr_set_nan (x);
- mpfr_pow_si (x, x, -1, GMP_RNDN);
+ mpfr_pow_si (x, x, -1, MPFR_RNDN);
MPFR_ASSERTN(mpfr_nan_p (x));
mpfr_set_inf (x, 1);
- mpfr_pow_si (x, x, -1, GMP_RNDN);
+ mpfr_pow_si (x, x, -1, MPFR_RNDN);
MPFR_ASSERTN(mpfr_cmp_ui (x, 0) == 0 && MPFR_IS_POS(x));
mpfr_set_inf (x, -1);
- mpfr_pow_si (x, x, -1, GMP_RNDN);
+ mpfr_pow_si (x, x, -1, MPFR_RNDN);
MPFR_ASSERTN(mpfr_cmp_ui (x, 0) == 0 && MPFR_IS_NEG(x));
mpfr_set_inf (x, -1);
- mpfr_pow_si (x, x, -2, GMP_RNDN);
+ mpfr_pow_si (x, x, -2, MPFR_RNDN);
MPFR_ASSERTN(mpfr_cmp_ui (x, 0) == 0 && MPFR_IS_POS(x));
- mpfr_set_ui (x, 0, GMP_RNDN);
- mpfr_pow_si (x, x, -1, GMP_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_pow_si (x, x, -1, MPFR_RNDN);
MPFR_ASSERTN(mpfr_inf_p (x) && mpfr_sgn (x) > 0);
- mpfr_set_ui (x, 0, GMP_RNDN);
- mpfr_neg (x, x, GMP_RNDN);
- mpfr_pow_si (x, x, -1, GMP_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN);
+ mpfr_pow_si (x, x, -1, MPFR_RNDN);
MPFR_ASSERTN(mpfr_inf_p (x) && mpfr_sgn (x) < 0);
- mpfr_set_ui (x, 0, GMP_RNDN);
- mpfr_neg (x, x, GMP_RNDN);
- mpfr_pow_si (x, x, -2, GMP_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN);
+ mpfr_pow_si (x, x, -2, MPFR_RNDN);
MPFR_ASSERTN(mpfr_inf_p (x) && mpfr_sgn (x) > 0);
- mpfr_set_si (x, 2, GMP_RNDN);
- mpfr_pow_si (x, x, LONG_MAX, GMP_RNDN); /* 2^LONG_MAX */
+ mpfr_set_si (x, 2, MPFR_RNDN);
+ mpfr_pow_si (x, x, LONG_MAX, MPFR_RNDN); /* 2^LONG_MAX */
if (LONG_MAX > mpfr_get_emax () - 1) /* LONG_MAX + 1 > emax */
{
MPFR_ASSERTN (mpfr_inf_p (x));
@@ -305,8 +305,8 @@ check_pow_si (void)
MPFR_ASSERTN (mpfr_cmp_si_2exp (x, 1, LONG_MAX));
}
- mpfr_set_si (x, 2, GMP_RNDN);
- mpfr_pow_si (x, x, LONG_MIN, GMP_RNDN); /* 2^LONG_MIN */
+ mpfr_set_si (x, 2, MPFR_RNDN);
+ mpfr_pow_si (x, x, LONG_MIN, MPFR_RNDN); /* 2^LONG_MIN */
if (LONG_MIN + 1 < mpfr_get_emin ())
{
MPFR_ASSERTN (mpfr_zero_p (x));
@@ -316,8 +316,8 @@ check_pow_si (void)
MPFR_ASSERTN (mpfr_cmp_si_2exp (x, 1, LONG_MIN));
}
- mpfr_set_si (x, 2, GMP_RNDN);
- mpfr_pow_si (x, x, LONG_MIN + 1, GMP_RNDN); /* 2^(LONG_MIN+1) */
+ mpfr_set_si (x, 2, MPFR_RNDN);
+ mpfr_pow_si (x, x, LONG_MIN + 1, MPFR_RNDN); /* 2^(LONG_MIN+1) */
if (mpfr_nan_p (x))
{
printf ("Error in pow_si(2, LONG_MIN+1): got NaN\n");
@@ -332,8 +332,8 @@ check_pow_si (void)
MPFR_ASSERTN (mpfr_cmp_si_2exp (x, 1, LONG_MIN + 1));
}
- mpfr_set_si_2exp (x, 1, -1, GMP_RNDN); /* 0.5 */
- mpfr_pow_si (x, x, LONG_MIN, GMP_RNDN); /* 2^(-LONG_MIN) */
+ mpfr_set_si_2exp (x, 1, -1, MPFR_RNDN); /* 0.5 */
+ mpfr_pow_si (x, x, LONG_MIN, MPFR_RNDN); /* 2^(-LONG_MIN) */
if (LONG_MIN < 1 - mpfr_get_emax ()) /* 1 - LONG_MIN > emax */
{
MPFR_ASSERTN (mpfr_inf_p (x));
@@ -354,9 +354,9 @@ check_special_pow_si (void)
mpfr_init (a);
mpfr_init (b);
- mpfr_set_str (a, "2E100000000", 10, GMP_RNDN);
- mpfr_set_si (b, -10, GMP_RNDN);
- test_pow (b, a, b, GMP_RNDN);
+ mpfr_set_str (a, "2E100000000", 10, MPFR_RNDN);
+ mpfr_set_si (b, -10, MPFR_RNDN);
+ test_pow (b, a, b, MPFR_RNDN);
if (!MPFR_IS_ZERO(b))
{
printf("Pow(2E10000000, -10) failed\n");
@@ -367,8 +367,8 @@ check_special_pow_si (void)
emin = mpfr_get_emin ();
mpfr_set_emin (-10);
- mpfr_set_si (a, -2, GMP_RNDN);
- mpfr_pow_si (b, a, -10000, GMP_RNDN);
+ mpfr_set_si (a, -2, MPFR_RNDN);
+ mpfr_pow_si (b, a, -10000, MPFR_RNDN);
if (!MPFR_IS_ZERO (b))
{
printf ("Pow_so (1, -10000) doesn't underflow if emin=-10.\n");
@@ -388,19 +388,19 @@ pow_si_long_min (void)
int inex;
mpfr_inits2 (sizeof(long) * CHAR_BIT + 32, x, y, z, (mpfr_ptr) 0);
- mpfr_set_si_2exp (x, 3, -1, GMP_RNDN); /* 1.5 */
+ mpfr_set_si_2exp (x, 3, -1, MPFR_RNDN); /* 1.5 */
- inex = mpfr_set_si (y, LONG_MIN, GMP_RNDN);
+ inex = mpfr_set_si (y, LONG_MIN, MPFR_RNDN);
MPFR_ASSERTN (inex == 0);
mpfr_nextbelow (y);
- mpfr_pow (y, x, y, GMP_RNDD);
+ mpfr_pow (y, x, y, MPFR_RNDD);
- inex = mpfr_set_si (z, LONG_MIN, GMP_RNDN);
+ inex = mpfr_set_si (z, LONG_MIN, MPFR_RNDN);
MPFR_ASSERTN (inex == 0);
mpfr_nextabove (z);
- mpfr_pow (z, x, z, GMP_RNDU);
+ mpfr_pow (z, x, z, MPFR_RNDU);
- mpfr_pow_si (x, x, LONG_MIN, GMP_RNDN); /* 1.5^LONG_MIN */
+ mpfr_pow_si (x, x, LONG_MIN, MPFR_RNDN); /* 1.5^LONG_MIN */
if (mpfr_cmp (x, y) < 0 || mpfr_cmp (x, z) > 0)
{
printf ("Error in pow_si_long_min\n");
@@ -426,7 +426,7 @@ check_inexact (mp_prec_t p)
mpfr_urandomb (x, RANDS);
u = randlimb () % 2;
for (q = 2; q <= p; q++)
- for (rnd = 0; rnd < GMP_RND_MAX; rnd++)
+ for (rnd = 0; rnd < MPFR_RND_MAX; rnd++)
{
mpfr_set_prec (y, q);
mpfr_set_prec (z, q + 10);
@@ -464,9 +464,9 @@ check_inexact (mp_prec_t p)
mpfr_set_prec (x, p);
mpfr_set_prec (y, p);
mpfr_set_prec (z, p);
- mpfr_set_ui (x, 4, GMP_RNDN);
- mpfr_set_str (y, "0.5", 10, GMP_RNDN);
- test_pow (z, x, y, GMP_RNDZ);
+ mpfr_set_ui (x, 4, MPFR_RNDN);
+ mpfr_set_str (y, "0.5", 10, MPFR_RNDN);
+ test_pow (z, x, y, MPFR_RNDZ);
mpfr_clear (x);
mpfr_clear (y);
@@ -486,16 +486,16 @@ special (void)
mpfr_init2 (z, 53);
mpfr_init2 (t, 2);
- mpfr_set_ui (x, 2, GMP_RNDN);
- mpfr_pow_si (x, x, -2, GMP_RNDN);
+ mpfr_set_ui (x, 2, MPFR_RNDN);
+ mpfr_pow_si (x, x, -2, MPFR_RNDN);
if (mpfr_cmp_ui_2exp (x, 1, -2))
{
printf ("Error in pow_si(x,x,-2) for x=2\n");
exit (1);
}
- mpfr_set_ui (x, 2, GMP_RNDN);
- mpfr_set_si (y, -2, GMP_RNDN);
- test_pow (x, x, y, GMP_RNDN);
+ mpfr_set_ui (x, 2, MPFR_RNDN);
+ mpfr_set_si (y, -2, MPFR_RNDN);
+ test_pow (x, x, y, MPFR_RNDN);
if (mpfr_cmp_ui_2exp (x, 1, -2))
{
printf ("Error in pow(x,x,y) for x=2, y=-2\n");
@@ -507,7 +507,7 @@ special (void)
mpfr_set_prec (y, 53);
mpfr_set_str_binary (y, "0.11010110011100101010110011001010100111000001000101110E-1");
mpfr_set_prec (z, 2);
- test_pow (z, x, y, GMP_RNDZ);
+ test_pow (z, x, y, MPFR_RNDZ);
mpfr_set_str_binary (x, "1.0e-1");
if (mpfr_cmp (x, z))
{
@@ -523,22 +523,22 @@ special (void)
mpfr_set_str_binary (y, "0.111110010100110000011101100011010111000010000100101");
mpfr_set_str_binary (t, "0.1110110011110110001000110100100001001111010011111000010000011001");
- test_pow (z, x, y, GMP_RNDN);
+ test_pow (z, x, y, MPFR_RNDN);
if (mpfr_cmp (z, t))
{
- printf ("Error in mpfr_pow for prec=64, rnd=GMP_RNDN\n");
+ printf ("Error in mpfr_pow for prec=64, rnd=MPFR_RNDN\n");
exit (1);
}
mpfr_set_prec (x, 53);
mpfr_set_prec (y, 53);
mpfr_set_prec (z, 53);
- mpfr_set_str (x, "5.68824667828621954868e-01", 10, GMP_RNDN);
- mpfr_set_str (y, "9.03327850535952658895e-01", 10, GMP_RNDN);
- test_pow (z, x, y, GMP_RNDZ);
+ mpfr_set_str (x, "5.68824667828621954868e-01", 10, MPFR_RNDN);
+ mpfr_set_str (y, "9.03327850535952658895e-01", 10, MPFR_RNDN);
+ test_pow (z, x, y, MPFR_RNDZ);
if (mpfr_cmp_str1 (z, "0.60071044650456473235"))
{
- printf ("Error in mpfr_pow for prec=53, rnd=GMP_RNDZ\n");
+ printf ("Error in mpfr_pow for prec=53, rnd=MPFR_RNDZ\n");
exit (1);
}
@@ -546,29 +546,29 @@ special (void)
mpfr_set_prec (x, 30);
mpfr_set_prec (y, 30);
mpfr_set_prec (z, 30);
- mpfr_set_str (x, "1.00000000001010111110001111011e1", 2, GMP_RNDN);
- mpfr_set_str (t, "-0.5", 10, GMP_RNDN);
- test_pow (z, x, t, GMP_RNDN);
- mpfr_set_str (y, "1.01101001111010101110000101111e-1", 2, GMP_RNDN);
+ mpfr_set_str (x, "1.00000000001010111110001111011e1", 2, MPFR_RNDN);
+ mpfr_set_str (t, "-0.5", 10, MPFR_RNDN);
+ test_pow (z, x, t, MPFR_RNDN);
+ mpfr_set_str (y, "1.01101001111010101110000101111e-1", 2, MPFR_RNDN);
if (mpfr_cmp (z, y))
{
- printf ("Error in mpfr_pow for prec=30, rnd=GMP_RNDN\n");
+ printf ("Error in mpfr_pow for prec=30, rnd=MPFR_RNDN\n");
exit (1);
}
mpfr_set_prec (x, 21);
mpfr_set_prec (y, 21);
mpfr_set_prec (z, 21);
- mpfr_set_str (x, "1.11111100100001100101", 2, GMP_RNDN);
- test_pow (z, x, t, GMP_RNDZ);
- mpfr_set_str (y, "1.01101011010001100000e-1", 2, GMP_RNDN);
+ mpfr_set_str (x, "1.11111100100001100101", 2, MPFR_RNDN);
+ test_pow (z, x, t, MPFR_RNDZ);
+ mpfr_set_str (y, "1.01101011010001100000e-1", 2, MPFR_RNDN);
if (mpfr_cmp (z, y))
{
- printf ("Error in mpfr_pow for prec=21, rnd=GMP_RNDZ\n");
+ printf ("Error in mpfr_pow for prec=21, rnd=MPFR_RNDZ\n");
printf ("Expected ");
- mpfr_out_str (stdout, 2, 0, y, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN);
printf ("\nGot ");
- mpfr_out_str (stdout, 2, 0, z, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, z, MPFR_RNDN);
printf ("\n");
exit (1);
}
@@ -578,26 +578,26 @@ special (void)
mpfr_set_prec (y, 2);
mpfr_set_prec (z, 169);
mpfr_set_str1 (x, "6078673043126084065007902175846955");
- mpfr_set_ui_2exp (y, 3, -1, GMP_RNDN);
- test_pow (z, x, y, GMP_RNDZ);
+ mpfr_set_ui_2exp (y, 3, -1, MPFR_RNDN);
+ test_pow (z, x, y, MPFR_RNDZ);
if (mpfr_cmp_str1 (z, "473928882491000966028828671876527456070714790264144"))
{
printf ("Error in mpfr_pow for 6078673043126084065007902175846955");
- printf ("^(3/2), GMP_RNDZ\nExpected ");
+ printf ("^(3/2), MPFR_RNDZ\nExpected ");
printf ("4.73928882491000966028828671876527456070714790264144e50");
printf ("\nGot ");
- mpfr_out_str (stdout, 10, 0, z, GMP_RNDN);
+ mpfr_out_str (stdout, 10, 0, z, MPFR_RNDN);
printf ("\n");
exit (1);
}
- test_pow (z, x, y, GMP_RNDU);
+ test_pow (z, x, y, MPFR_RNDU);
if (mpfr_cmp_str1 (z, "473928882491000966028828671876527456070714790264145"))
{
printf ("Error in mpfr_pow for 6078673043126084065007902175846955");
- printf ("^(3/2), GMP_RNDU\nExpected ");
+ printf ("^(3/2), MPFR_RNDU\nExpected ");
printf ("4.73928882491000966028828671876527456070714790264145e50");
printf ("\nGot ");
- mpfr_out_str (stdout, 10, 0, z, GMP_RNDN);
+ mpfr_out_str (stdout, 10, 0, z, MPFR_RNDN);
printf ("\n");
exit (1);
}
@@ -605,49 +605,49 @@ special (void)
mpfr_set_inf (x, 1);
mpfr_set_prec (y, 2);
mpfr_set_str_binary (y, "1E10");
- test_pow (z, x, y, GMP_RNDN);
+ test_pow (z, x, y, MPFR_RNDN);
MPFR_ASSERTN(mpfr_inf_p (z) && MPFR_IS_POS(z));
mpfr_set_inf (x, -1);
- test_pow (z, x, y, GMP_RNDN);
+ test_pow (z, x, y, MPFR_RNDN);
MPFR_ASSERTN(mpfr_inf_p (z) && MPFR_IS_POS(z));
mpfr_set_prec (y, 10);
mpfr_set_str_binary (y, "1.000000001E9");
- test_pow (z, x, y, GMP_RNDN);
+ test_pow (z, x, y, MPFR_RNDN);
MPFR_ASSERTN(mpfr_inf_p (z) && MPFR_IS_NEG(z));
mpfr_set_str_binary (y, "1.000000001E8");
- test_pow (z, x, y, GMP_RNDN);
+ test_pow (z, x, y, MPFR_RNDN);
MPFR_ASSERTN(mpfr_inf_p (z) && MPFR_IS_POS(z));
mpfr_set_inf (x, -1);
mpfr_set_prec (y, 2 * mp_bits_per_limb);
- mpfr_set_ui (y, 1, GMP_RNDN);
- mpfr_mul_2exp (y, y, mp_bits_per_limb - 1, GMP_RNDN);
+ mpfr_set_ui (y, 1, MPFR_RNDN);
+ mpfr_mul_2exp (y, y, mp_bits_per_limb - 1, MPFR_RNDN);
/* y = 2^(mp_bits_per_limb - 1) */
- test_pow (z, x, y, GMP_RNDN);
+ test_pow (z, x, y, MPFR_RNDN);
MPFR_ASSERTN(mpfr_inf_p (z) && MPFR_IS_POS(z));
mpfr_nextabove (y);
- test_pow (z, x, y, GMP_RNDN);
+ test_pow (z, x, y, MPFR_RNDN);
/* y = 2^(mp_bits_per_limb - 1) + epsilon */
MPFR_ASSERTN(mpfr_inf_p (z) && MPFR_IS_POS(z));
mpfr_nextbelow (y);
- mpfr_div_2exp (y, y, 1, GMP_RNDN);
+ mpfr_div_2exp (y, y, 1, MPFR_RNDN);
mpfr_nextabove (y);
- test_pow (z, x, y, GMP_RNDN);
+ test_pow (z, x, y, MPFR_RNDN);
/* y = 2^(mp_bits_per_limb - 2) + epsilon */
MPFR_ASSERTN(mpfr_inf_p (z) && MPFR_IS_POS(z));
- mpfr_set_si (x, -1, GMP_RNDN);
+ mpfr_set_si (x, -1, MPFR_RNDN);
mpfr_set_prec (y, 2);
mpfr_set_str_binary (y, "1E10");
- test_pow (z, x, y, GMP_RNDN);
+ test_pow (z, x, y, MPFR_RNDN);
MPFR_ASSERTN(mpfr_cmp_ui (z, 1) == 0);
/* Check (-0)^(17.0001) */
mpfr_set_prec (x, 6);
mpfr_set_prec (y, 640);
MPFR_SET_ZERO (x); MPFR_SET_NEG (x);
- mpfr_set_ui (y, 17, GMP_RNDN); mpfr_nextabove (y);
- test_pow (z, x, y, GMP_RNDN);
+ mpfr_set_ui (y, 17, MPFR_RNDN); mpfr_nextabove (y);
+ test_pow (z, x, y, MPFR_RNDN);
MPFR_ASSERTN (MPFR_IS_ZERO (z) && MPFR_IS_POS (z));
/* Bugs reported by Kevin Rauch on 29 Oct 2007 */
@@ -658,40 +658,40 @@ special (void)
mpfr_set_prec (x, 64);
mpfr_set_prec (y, 64);
mpfr_set_prec (z, 64);
- mpfr_set_str (x, "-0.5", 10, GMP_RNDN);
- mpfr_set_str (y, "-0.ffffffffffffffff", 16, GMP_RNDN);
+ mpfr_set_str (x, "-0.5", 10, MPFR_RNDN);
+ mpfr_set_str (y, "-0.ffffffffffffffff", 16, MPFR_RNDN);
mpfr_set_exp (y, mpfr_get_emax ());
- inex = mpfr_pow (z, x, y, GMP_RNDN);
+ inex = mpfr_pow (z, x, y, MPFR_RNDN);
/* (-0.5)^(-n) = 1/2^n for n even */
MPFR_ASSERTN(mpfr_inf_p (z) && MPFR_IS_POS (z) && inex > 0);
/* (-1)^(-n) = 1 for n even */
- mpfr_set_str (x, "-1", 10, GMP_RNDN);
- inex = mpfr_pow (z, x, y, GMP_RNDN);
+ mpfr_set_str (x, "-1", 10, MPFR_RNDN);
+ inex = mpfr_pow (z, x, y, MPFR_RNDN);
MPFR_ASSERTN(mpfr_cmp_ui (z, 1) == 0 && inex == 0);
/* (-1)^n = 1 for n even */
- mpfr_set_str (x, "-1", 10, GMP_RNDN);
- mpfr_neg (y, y, GMP_RNDN);
- inex = mpfr_pow (z, x, y, GMP_RNDN);
+ mpfr_set_str (x, "-1", 10, MPFR_RNDN);
+ mpfr_neg (y, y, MPFR_RNDN);
+ inex = mpfr_pow (z, x, y, MPFR_RNDN);
MPFR_ASSERTN(mpfr_cmp_ui (z, 1) == 0 && inex == 0);
/* (-1.5)^n = +Inf for n even */
- mpfr_set_str (x, "-1.5", 10, GMP_RNDN);
- inex = mpfr_pow (z, x, y, GMP_RNDN);
+ mpfr_set_str (x, "-1.5", 10, MPFR_RNDN);
+ inex = mpfr_pow (z, x, y, MPFR_RNDN);
MPFR_ASSERTN(mpfr_inf_p (z) && MPFR_IS_POS (z) && inex > 0);
/* (-n)^1.5 = NaN for n even */
- mpfr_neg (y, y, GMP_RNDN);
- mpfr_set_str (x, "1.5", 10, GMP_RNDN);
- inex = mpfr_pow (z, y, x, GMP_RNDN);
+ mpfr_neg (y, y, MPFR_RNDN);
+ mpfr_set_str (x, "1.5", 10, MPFR_RNDN);
+ inex = mpfr_pow (z, y, x, MPFR_RNDN);
MPFR_ASSERTN(mpfr_nan_p (z));
/* x^(-1.5) = NaN for x small < 0 */
- mpfr_set_str (x, "-0.8", 16, GMP_RNDN);
+ mpfr_set_str (x, "-0.8", 16, MPFR_RNDN);
mpfr_set_exp (x, mpfr_get_emin ());
- mpfr_set_str (y, "-1.5", 10, GMP_RNDN);
- inex = mpfr_pow (z, x, y, GMP_RNDN);
+ mpfr_set_str (y, "-1.5", 10, MPFR_RNDN);
+ inex = mpfr_pow (z, x, y, MPFR_RNDN);
MPFR_ASSERTN(mpfr_nan_p (z));
mpfr_set_emin (emin);
@@ -717,12 +717,12 @@ particular_cases (void)
mpfr_set_nan (t[0]);
mpfr_set_inf (t[1], 1);
- mpfr_set_ui (t[3], 0, GMP_RNDN);
- mpfr_set_ui (t[5], 1, GMP_RNDN);
- mpfr_set_ui (t[7], 2, GMP_RNDN);
- mpfr_div_2ui (t[9], t[5], 1, GMP_RNDN);
+ mpfr_set_ui (t[3], 0, MPFR_RNDN);
+ mpfr_set_ui (t[5], 1, MPFR_RNDN);
+ mpfr_set_ui (t[7], 2, MPFR_RNDN);
+ mpfr_div_2ui (t[9], t[5], 1, MPFR_RNDN);
for (i = 1; i < 11; i += 2)
- mpfr_neg (t[i+1], t[i], GMP_RNDN);
+ mpfr_neg (t[i+1], t[i], MPFR_RNDN);
for (i = 0; i < 11; i++)
for (j = 0; j < 11; j++)
@@ -743,10 +743,10 @@ particular_cases (void)
/* +0.5 */ { 0, 2, 1, 128, 128, 64, 256, 32, 512, 90, 180 },
/* -0.5 */ { 0, 2, 1, 128, 128, -64,-256, 32, 512, 0, 0 }
};
- test_pow (r, t[i], t[j], GMP_RNDN);
+ test_pow (r, t[i], t[j], MPFR_RNDN);
p = mpfr_nan_p (r) ? 0 : mpfr_inf_p (r) ? 1 :
mpfr_cmp_ui (r, 0) == 0 ? 2 :
- (d = mpfr_get_d (r, GMP_RNDN), (int) (ABS(d) * 128.0));
+ (d = mpfr_get_d (r, MPFR_RNDN), (int) (ABS(d) * 128.0));
if (p != 0 && MPFR_SIGN(r) < 0)
p = -p;
if (p != q[i][j])
@@ -778,20 +778,20 @@ underflows (void)
mpfr_init2 (x, 64);
mpfr_init2 (y, 64);
- mpfr_set_ui (x, 1, GMP_RNDN);
+ mpfr_set_ui (x, 1, MPFR_RNDN);
mpfr_set_exp (x, mpfr_get_emin());
for (i = 3; i < 10; i++)
{
- mpfr_set_ui (y, i, GMP_RNDN);
- mpfr_div_2ui (y, y, 1, GMP_RNDN);
- test_pow (y, x, y, GMP_RNDN);
+ mpfr_set_ui (y, i, MPFR_RNDN);
+ mpfr_div_2ui (y, y, 1, MPFR_RNDN);
+ test_pow (y, x, y, MPFR_RNDN);
if (!MPFR_IS_FP(y) || mpfr_cmp_ui (y, 0))
{
printf ("Error in mpfr_pow for ");
- mpfr_out_str (stdout, 2, 0, x, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN);
printf (" ^ (%d/2)\nGot ", i);
- mpfr_out_str (stdout, 2, 0, y, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN);
printf (" instead of 0.\n");
exit (1);
}
@@ -799,11 +799,11 @@ underflows (void)
mpfr_init2 (z, 55);
mpfr_set_str (x, "0.110011010011101001110001110100010000110111101E0",
- 2, GMP_RNDN);
+ 2, MPFR_RNDN);
mpfr_set_str (y, "0.101110010011111001011010100011011100111110011E40",
- 2, GMP_RNDN);
+ 2, MPFR_RNDN);
mpfr_clear_flags ();
- inexact = mpfr_pow (z, x, y, GMP_RNDU);
+ inexact = mpfr_pow (z, x, y, MPFR_RNDU);
if (!mpfr_underflow_p ())
{
printf ("Underflow flag is not set for special underflow test.\n");
@@ -814,14 +814,14 @@ underflows (void)
printf ("Ternary value is wrong for special underflow test.\n");
err = 1;
}
- mpfr_set_ui (x, 0, GMP_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
mpfr_nextabove (x);
if (mpfr_cmp (x, z) != 0)
{
printf ("Wrong value for special underflow test.\nGot ");
- mpfr_out_str (stdout, 2, 0, z, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, z, MPFR_RNDN);
printf ("\ninstead of ");
- mpfr_out_str (stdout, 2, 2, x, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 2, x, MPFR_RNDN);
printf ("\n");
err = 1;
}
@@ -835,10 +835,10 @@ underflows (void)
mpfr_set_prec (x, 2);
mpfr_set_prec (y, 2);
mpfr_set_prec (z, 12);
- mpfr_set_ui_2exp (x, 3, -2, GMP_RNDN);
- mpfr_set_ui_2exp (y, 1, mpfr_get_emax () - 1, GMP_RNDN);
+ mpfr_set_ui_2exp (x, 3, -2, MPFR_RNDN);
+ mpfr_set_ui_2exp (y, 1, mpfr_get_emax () - 1, MPFR_RNDN);
mpfr_clear_flags ();
- mpfr_pow (z, x, y, GMP_RNDN);
+ mpfr_pow (z, x, y, MPFR_RNDN);
if (!mpfr_underflow_p () || MPFR_NOTZERO (z))
{
printf ("Underflow test with large y fails.\n");
@@ -850,10 +850,10 @@ underflows (void)
mpfr_set_prec (x, 2);
mpfr_set_prec (y, 2);
mpfr_set_prec (z, 12);
- mpfr_set_ui_2exp (x, 3, -2, GMP_RNDN);
- mpfr_set_ui_2exp (y, 1, 38, GMP_RNDN);
+ mpfr_set_ui_2exp (x, 3, -2, MPFR_RNDN);
+ mpfr_set_ui_2exp (y, 1, 38, MPFR_RNDN);
mpfr_clear_flags ();
- inexact = mpfr_pow (z, x, y, GMP_RNDN);
+ inexact = mpfr_pow (z, x, y, MPFR_RNDN);
if (!mpfr_underflow_p () || MPFR_NOTZERO (z) || inexact >= 0)
{
printf ("Bad underflow detection for 0.75^(2^38). Obtained:\n"
@@ -871,19 +871,19 @@ underflows (void)
mpfr_set_prec (x, 2);
mpfr_set_prec (y, 40);
mpfr_set_prec (z, 12);
- mpfr_set_ui_2exp (x, 3, -1, GMP_RNDN);
- mpfr_set_si_2exp (y, -1, 38, GMP_RNDN);
+ mpfr_set_ui_2exp (x, 3, -1, MPFR_RNDN);
+ mpfr_set_si_2exp (y, -1, 38, MPFR_RNDN);
for (i = 0; i < 4; i++)
{
if (i == 2)
- mpfr_neg (x, x, GMP_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN);
mpfr_clear_flags ();
- inexact = mpfr_pow (z, x, y, GMP_RNDN);
+ inexact = mpfr_pow (z, x, y, MPFR_RNDN);
if (!mpfr_underflow_p () || MPFR_NOTZERO (z) ||
(i == 3 ? (inexact <= 0) : (inexact >= 0)))
{
printf ("Bad underflow detection for (");
- mpfr_out_str (stdout, 10, 0, x, GMP_RNDN);
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN);
printf (")^(-2^38-%d). Obtained:\n"
"Overflow flag.... %-3s (should be 'no')\n"
"Underflow flag... %-3s (should be 'yes')\n"
@@ -895,7 +895,7 @@ underflows (void)
i == 3 ? "positive" : "negative");
exit (1);
}
- inexact = mpfr_sub_ui (y, y, 1, GMP_RNDN);
+ inexact = mpfr_sub_ui (y, y, 1, MPFR_RNDN);
MPFR_ASSERTN (inexact == 0);
}
mpfr_set_emin (emin);
@@ -910,15 +910,15 @@ overflows (void)
/* bug found by Ming J. Tsai <mingjt@delvron.us>, 4 Oct 2003 */
- mpfr_init_set_str (a, "5.1e32", 10, GMP_RNDN);
+ mpfr_init_set_str (a, "5.1e32", 10, MPFR_RNDN);
mpfr_init (b);
- test_pow (b, a, a, GMP_RNDN);
+ test_pow (b, a, a, MPFR_RNDN);
if (!(mpfr_inf_p (b) && mpfr_sgn (b) > 0))
{
printf ("Error for a^a for a=5.1e32\n");
printf ("Expected +Inf, got ");
- mpfr_out_str (stdout, 10, 0, b, GMP_RNDN);
+ mpfr_out_str (stdout, 10, 0, b, MPFR_RNDN);
printf ("\n");
exit (1);
}
@@ -943,13 +943,13 @@ overflows2 (void)
mpfr_inits2 (16, x, y, z, (mpfr_ptr) 0);
- mpfr_set_si_2exp (x, 1, -64, GMP_RNDN); /* 2^(-64) */
- mpfr_set_si_2exp (y, -1, -1, GMP_RNDN); /* -0.5 */
+ mpfr_set_si_2exp (x, 1, -64, MPFR_RNDN); /* 2^(-64) */
+ mpfr_set_si_2exp (y, -1, -1, MPFR_RNDN); /* -0.5 */
for (e = 2; e <= 32; e += 17)
{
set_emax (e);
mpfr_clear_flags ();
- mpfr_pow (z, x, y, GMP_RNDN);
+ mpfr_pow (z, x, y, MPFR_RNDN);
if (MPFR_IS_NEG (z) || ! mpfr_inf_p (z))
{
printf ("Error in overflows2 (e = %d): expected +Inf, got ", e);
@@ -989,10 +989,10 @@ overflows3 (void)
mpfr_inits2 (16, x, y, z, (mpfr_ptr) 0);
- mpfr_set_si_2exp (x, 1, -2 * (MPFR_EMAX_MAX / 3), GMP_RNDN);
- mpfr_set_si_2exp (y, -3, -1, GMP_RNDN);
+ mpfr_set_si_2exp (x, 1, -2 * (MPFR_EMAX_MAX / 3), MPFR_RNDN);
+ mpfr_set_si_2exp (y, -3, -1, MPFR_RNDN);
mpfr_clear_flags ();
- mpfr_pow (z, x, y, GMP_RNDN);
+ mpfr_pow (z, x, y, MPFR_RNDN);
if (MPFR_IS_NEG (z) || ! mpfr_inf_p (z))
{
printf ("Error in overflows3: expected +Inf, got ");
@@ -1022,11 +1022,11 @@ x_near_one (void)
mpfr_init2 (y, 4);
mpfr_init2 (z, 33);
- mpfr_set_ui (x, 1, GMP_RNDN);
+ mpfr_set_ui (x, 1, MPFR_RNDN);
mpfr_nextbelow (x);
- mpfr_set_ui_2exp (y, 11, -2, GMP_RNDN);
- inex = mpfr_pow (z, x, y, GMP_RNDN);
- if (mpfr_cmp_str (z, "0.111111111111111111111111111111011E0", 2, GMP_RNDN)
+ mpfr_set_ui_2exp (y, 11, -2, MPFR_RNDN);
+ inex = mpfr_pow (z, x, y, MPFR_RNDN);
+ if (mpfr_cmp_str (z, "0.111111111111111111111111111111011E0", 2, MPFR_RNDN)
|| inex <= 0)
{
printf ("Failure in x_near_one, got inex = %d and\nz = ", inex);
@@ -1043,8 +1043,8 @@ mpfr_pow275 (mpfr_ptr y, mpfr_srcptr x, mp_rnd_t r)
int inex;
mpfr_init2 (z, 4);
- mpfr_set_ui_2exp (z, 11, -2, GMP_RNDN);
- inex = mpfr_pow (y, x, z, GMP_RNDN);
+ mpfr_set_ui_2exp (z, 11, -2, MPFR_RNDN);
+ inex = mpfr_pow (y, x, z, MPFR_RNDN);
mpfr_clear (z);
return inex;
}
@@ -1062,11 +1062,11 @@ bug20071103 (void)
mpfr_set_emax ( 1000000);
mpfr_inits2 (64, x, y, z, (mpfr_ptr) 0);
- mpfr_set_si_2exp (x, -3, -1, GMP_RNDN); /* x = -1.5 */
- mpfr_set_str (y, "-0.ffffffffffffffff", 16, GMP_RNDN);
+ mpfr_set_si_2exp (x, -3, -1, MPFR_RNDN); /* x = -1.5 */
+ mpfr_set_str (y, "-0.ffffffffffffffff", 16, MPFR_RNDN);
mpfr_set_exp (y, mpfr_get_emax ());
mpfr_clear_flags ();
- mpfr_pow (z, x, y, GMP_RNDN);
+ mpfr_pow (z, x, y, MPFR_RNDN);
MPFR_ASSERTN (mpfr_zero_p (z) && MPFR_SIGN (z) > 0 &&
__gmpfr_flags == (MPFR_FLAGS_UNDERFLOW | MPFR_FLAGS_INEXACT));
mpfr_clears (x, y, z, (mpfr_ptr) 0);
@@ -1089,11 +1089,11 @@ bug20071104 (void)
mpfr_set_emax ( 1000000);
mpfr_inits2 (20, x, y, z, (mpfr_ptr) 0);
- mpfr_set_ui (x, 0, GMP_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
mpfr_nextbelow (x); /* x = -2^(emin-1) */
- mpfr_set_si (y, -2, GMP_RNDN); /* y = -2 */
+ mpfr_set_si (y, -2, MPFR_RNDN); /* y = -2 */
mpfr_clear_flags ();
- inex = mpfr_pow (z, x, y, GMP_RNDN);
+ inex = mpfr_pow (z, x, y, MPFR_RNDN);
if (! mpfr_inf_p (z) || MPFR_SIGN (z) < 0)
{
printf ("Error in bug20071104: expected +Inf, got ");
@@ -1133,13 +1133,13 @@ bug20071127 (void)
mpfr_init2 (y, 128);
mpfr_init2 (z, 128);
- mpfr_set_str (x, "0.80000000000000000000000000000001", 16, GMP_RNDN);
+ mpfr_set_str (x, "0.80000000000000000000000000000001", 16, MPFR_RNDN);
for (i = 1; i < 9; i *= 2)
{
- mpfr_set_str (y, "8000000000000000", 16, GMP_RNDN);
- mpfr_add_si (y, y, i, GMP_RNDN);
- tern = mpfr_pow (z, x, y, GMP_RNDN);
+ mpfr_set_str (y, "8000000000000000", 16, MPFR_RNDN);
+ mpfr_add_si (y, y, i, MPFR_RNDN);
+ tern = mpfr_pow (z, x, y, MPFR_RNDN);
MPFR_ASSERTN(mpfr_zero_p (z) && MPFR_IS_POS(z));
}
@@ -1169,26 +1169,26 @@ bug20071128 (void)
mpfr_init2 (y, 64);
mpfr_init2 (z, 64);
- mpfr_set_str (max_val, "0.ffffffffffffffff", 16, GMP_RNDN);
+ mpfr_set_str (max_val, "0.ffffffffffffffff", 16, MPFR_RNDN);
mpfr_set_exp (max_val, mpfr_get_emax ());
- mpfr_neg (x, max_val, GMP_RNDN);
+ mpfr_neg (x, max_val, MPFR_RNDN);
/* on 64-bit machines */
for (i = 41; i < 45; i++)
{
- mpfr_set_si_2exp (y, -1, i, GMP_RNDN);
- mpfr_add_si (y, y, 1, GMP_RNDN);
- tern = mpfr_pow (z, x, y, GMP_RNDN);
+ mpfr_set_si_2exp (y, -1, i, MPFR_RNDN);
+ mpfr_add_si (y, y, 1, MPFR_RNDN);
+ tern = mpfr_pow (z, x, y, MPFR_RNDN);
MPFR_ASSERTN(mpfr_zero_p (z) && MPFR_SIGN(z) < 0);
}
/* on 32-bit machines */
for (i = 9; i < 13; i++)
{
- mpfr_set_si_2exp (y, -1, i, GMP_RNDN);
- mpfr_add_si (y, y, 1, GMP_RNDN);
- tern = mpfr_pow (z, x, y, GMP_RNDN);
+ mpfr_set_si_2exp (y, -1, i, MPFR_RNDN);
+ mpfr_add_si (y, y, 1, MPFR_RNDN);
+ tern = mpfr_pow (z, x, y, MPFR_RNDN);
MPFR_ASSERTN(mpfr_zero_p (z) && MPFR_SIGN(z) < 0);
}
@@ -1209,11 +1209,11 @@ bug20071218 (void)
int tern;
mpfr_inits2 (64, x, y, z, t, (mpfr_ptr) 0);
- mpfr_set_str (x, "0x.80000000000002P-1023", 0, GMP_RNDN);
- mpfr_set_str (y, "100000.000000002", 16, GMP_RNDN);
- mpfr_set_ui (t, 0, GMP_RNDN);
+ mpfr_set_str (x, "0x.80000000000002P-1023", 0, MPFR_RNDN);
+ mpfr_set_str (y, "100000.000000002", 16, MPFR_RNDN);
+ mpfr_set_ui (t, 0, MPFR_RNDN);
mpfr_nextabove (t);
- tern = mpfr_pow (z, x, y, GMP_RNDN);
+ tern = mpfr_pow (z, x, y, MPFR_RNDN);
if (mpfr_cmp0 (z, t) != 0)
{
printf ("Error in bug20071218 (1): Expected\n");
@@ -1228,8 +1228,8 @@ bug20071218 (void)
" (%d instead of positive)\n", tern);
exit (1);
}
- mpfr_mul_2ui (y, y, 32, GMP_RNDN);
- tern = mpfr_pow (z, x, y, GMP_RNDN);
+ mpfr_mul_2ui (y, y, 32, MPFR_RNDN);
+ tern = mpfr_pow (z, x, y, MPFR_RNDN);
if (MPFR_NOTZERO (z) || MPFR_IS_NEG (z))
{
printf ("Error in bug20071218 (2): expected 0, got\n");
@@ -1264,10 +1264,10 @@ bug20080721 (void)
*/
mpfr_inits2 (4913, x, y, (mpfr_ptr) 0);
mpfr_inits2 (8, z, t[0], t[1], (mpfr_ptr) 0);
- mpfr_set_si (x, -1, GMP_RNDN);
+ mpfr_set_si (x, -1, MPFR_RNDN);
mpfr_nextbelow (x);
- mpfr_set_ui_2exp (y, 1, mpfr_get_prec (y) - 1, GMP_RNDN);
- inex = mpfr_add_ui (y, y, 1, GMP_RNDN);
+ mpfr_set_ui_2exp (y, 1, mpfr_get_prec (y) - 1, MPFR_RNDN);
+ inex = mpfr_add_ui (y, y, 1, MPFR_RNDN);
MPFR_ASSERTN (inex == 0);
mpfr_set_str_binary (t[0], "-0.10101101e2");
mpfr_set_str_binary (t[1], "-0.10101110e2");
@@ -1275,7 +1275,7 @@ bug20080721 (void)
{
int i, inex0;
- i = (rnd == GMP_RNDN || rnd == GMP_RNDD || rnd == GMP_RNDA);
+ i = (rnd == MPFR_RNDN || rnd == MPFR_RNDD || rnd == MPFR_RNDA);
inex0 = i ? -1 : 1;
mpfr_clear_flags ();
inex = mpfr_pow (z, x, y, (mp_rnd_t) rnd);
@@ -1287,11 +1287,11 @@ bug20080721 (void)
printf ("Error in bug20080721 with %s\n",
mpfr_print_rnd_mode ((mp_rnd_t) rnd));
printf ("expected ");
- mpfr_out_str (stdout, 2, 0, t[i], GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, t[i], MPFR_RNDN);
printf (", inex = %d, flags = %u\n", inex0,
(unsigned int) MPFR_FLAGS_INEXACT);
printf ("got ");
- mpfr_out_str (stdout, 2, 0, z, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, z, MPFR_RNDN);
printf (", inex = %d, flags = %u\n", inex, flags);
err = 1;
}
@@ -1302,8 +1302,8 @@ bug20080721 (void)
}
/* The following test fails in r5552 (32-bit and 64-bit). This is due to:
- * mpfr_log (t, absx, GMP_RNDU);
- * mpfr_mul (t, y, t, GMP_RNDU);
+ * mpfr_log (t, absx, MPFR_RNDU);
+ * mpfr_mul (t, y, t, MPFR_RNDU);
* in pow.c, that is supposed to compute an upper bound on exp(y*ln|x|),
* but this is incorrect if y is negative.
*/
@@ -1319,12 +1319,12 @@ bug20080820 (void)
mpfr_init2 (y, sizeof (mp_exp_t) * CHAR_BIT + 32);
mpfr_init2 (z1, 2);
mpfr_init2 (z2, 80);
- mpfr_set_ui (x, 2, GMP_RNDN);
+ mpfr_set_ui (x, 2, MPFR_RNDN);
mpfr_nextbelow (x);
- mpfr_set_exp_t (y, mpfr_get_emin () - 2, GMP_RNDN);
+ mpfr_set_exp_t (y, mpfr_get_emin () - 2, MPFR_RNDN);
mpfr_nextabove (y);
- mpfr_pow (z1, x, y, GMP_RNDN);
- mpfr_pow (z2, x, y, GMP_RNDN);
+ mpfr_pow (z1, x, y, MPFR_RNDN);
+ mpfr_pow (z2, x, y, MPFR_RNDN);
/* As x > 0, the rounded value of x^y to nearest in precision p is equal
to 0 iff x^y <= 2^(emin - 2). In particular, this does not depend on
the precision p. Hence the following test. */
diff --git a/tests/tpow3.c b/tests/tpow3.c
index d17919928..230698f81 100644
--- a/tests/tpow3.c
+++ b/tests/tpow3.c
@@ -64,11 +64,11 @@ main (int argc, char *argv[])
mpfr_urandomb (x, RANDS);
mpfr_urandomb (s, RANDS);
if (randlimb () % 2)
- mpfr_neg (s, s, GMP_RNDN);
+ mpfr_neg (s, s, MPFR_RNDN);
rnd = RND_RAND ();
mpfr_set_prec (y, yprec);
compare = mpfr_pow (y, x, s, rnd);
- err = (rnd == GMP_RNDN) ? yprec + 1 : yprec;
+ err = (rnd == MPFR_RNDN) ? yprec + 1 : yprec;
if (mpfr_can_round (y, err, rnd, rnd, prec))
{
mpfr_set (t, y, rnd);
@@ -76,16 +76,16 @@ main (int argc, char *argv[])
if (mpfr_cmp (t, z))
{
printf ("results differ for x^y with x=");
- mpfr_out_str (stdout, 2, prec, x, GMP_RNDN);
+ mpfr_out_str (stdout, 2, prec, x, MPFR_RNDN);
printf (" y=");
- mpfr_out_str (stdout, 2, 0, s, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, s, MPFR_RNDN);
printf (" prec=%u rnd_mode=%s\n", (unsigned int) prec,
mpfr_print_rnd_mode (rnd));
printf ("got ");
- mpfr_out_str (stdout, 2, prec, z, GMP_RNDN);
+ mpfr_out_str (stdout, 2, prec, z, MPFR_RNDN);
puts ("");
printf ("expected ");
- mpfr_out_str (stdout, 2, prec, t, GMP_RNDN);
+ mpfr_out_str (stdout, 2, prec, t, MPFR_RNDN);
puts ("");
printf ("approx ");
mpfr_print_binary (y);
@@ -95,7 +95,7 @@ main (int argc, char *argv[])
compare2 = mpfr_cmp (t, y);
/* if rounding to nearest, cannot know the sign of t - f(x)
because of composed rounding: y = o(f(x)) and t = o(y) */
- if ((rnd != GMP_RNDN) && (compare * compare2 >= 0))
+ if ((rnd != MPFR_RNDN) && (compare * compare2 >= 0))
compare = compare + compare2;
else
compare = inexact; /* cannot determine sign(t-f(x)) */
diff --git a/tests/tpow_all.c b/tests/tpow_all.c
index db1ceeb49..cf66e95aa 100644
--- a/tests/tpow_all.c
+++ b/tests/tpow_all.c
@@ -58,7 +58,7 @@ err (const char *s, int i, int j, int rnd, mpfr_srcptr z, int inex)
printf ("x = %s, y = %s, %s\n", val[i], val[j],
mpfr_print_rnd_mode ((mp_rnd_t) rnd));
printf ("z = ");
- mpfr_out_str (stdout, 10, 0, z, GMP_RNDN);
+ mpfr_out_str (stdout, 10, 0, z, MPFR_RNDN);
printf ("\ninex = %d\n", inex);
exit (1);
}
@@ -104,7 +104,7 @@ cmpres (int spx, const void *px, const char *sy, mp_rnd_t rnd,
printf ("%s, ", (char *) px);
else
{
- mpfr_out_str (stdout, 16, 0, (mpfr_ptr) px, GMP_RNDN);
+ mpfr_out_str (stdout, 16, 0, (mpfr_ptr) px, MPFR_RNDN);
puts (",");
}
printf ("y = %s, %s\n", sy, mpfr_print_rnd_mode (rnd));
@@ -115,11 +115,11 @@ cmpres (int spx, const void *px, const char *sy, mp_rnd_t rnd,
}
else
{
- mpfr_out_str (stdout, 16, 0, z1, GMP_RNDN);
+ mpfr_out_str (stdout, 16, 0, z1, MPFR_RNDN);
printf (", inex = %d, flags = %u\n", SIGN (inex1), flags1);
}
printf ("Got ");
- mpfr_out_str (stdout, 16, 0, z2, GMP_RNDN);
+ mpfr_out_str (stdout, 16, 0, z2, MPFR_RNDN);
printf (", inex = %d, flags = %u\n", SIGN (inex2), flags2);
if (all_cmpres_errors != 0)
all_cmpres_errors = -1;
@@ -131,8 +131,8 @@ static int
is_odd (mpfr_srcptr x)
{
/* works only with the values from val[] */
- return mpfr_integer_p (x) && mpfr_fits_slong_p (x, GMP_RNDN) &&
- (mpfr_get_si (x, GMP_RNDN) & 1);
+ return mpfr_integer_p (x) && mpfr_fits_slong_p (x, MPFR_RNDN) &&
+ (mpfr_get_si (x, MPFR_RNDN) & 1);
}
/* Compare the result (z1,inex1) of mpfr_pow with all flags cleared
@@ -163,9 +163,9 @@ test_others (const void *sx, const char *sy, mp_rnd_t rnd,
/* If y is an integer that fits in an unsigned long and is not -0,
we can test mpfr_pow_ui. */
if (MPFR_IS_POS (y) && mpfr_integer_p (y) &&
- mpfr_fits_ulong_p (y, GMP_RNDN))
+ mpfr_fits_ulong_p (y, MPFR_RNDN))
{
- unsigned long yy = mpfr_get_ui (y, GMP_RNDN);
+ unsigned long yy = mpfr_get_ui (y, MPFR_RNDN);
mpfr_clear_flags ();
inex2 = mpfr_pow_ui (z2, x, yy, rnd);
@@ -179,9 +179,9 @@ test_others (const void *sx, const char *sy, mp_rnd_t rnd,
/* If x is an integer that fits in an unsigned long and is not -0,
we can also test mpfr_ui_pow_ui. */
if (MPFR_IS_POS (x) && mpfr_integer_p (x) &&
- mpfr_fits_ulong_p (x, GMP_RNDN))
+ mpfr_fits_ulong_p (x, MPFR_RNDN))
{
- unsigned long xx = mpfr_get_ui (x, GMP_RNDN);
+ unsigned long xx = mpfr_get_ui (x, MPFR_RNDN);
mpfr_clear_flags ();
inex2 = mpfr_ui_pow_ui (z2, xx, yy, rnd);
@@ -202,9 +202,9 @@ test_others (const void *sx, const char *sy, mp_rnd_t rnd,
mpz_t yyy;
/* If y fits in a long, we can test mpfr_pow_si. */
- if (mpfr_fits_slong_p (y, GMP_RNDN))
+ if (mpfr_fits_slong_p (y, MPFR_RNDN))
{
- long yy = mpfr_get_si (y, GMP_RNDN);
+ long yy = mpfr_get_si (y, MPFR_RNDN);
mpfr_clear_flags ();
inex2 = mpfr_pow_si (z2, x, yy, rnd);
@@ -244,7 +244,7 @@ test_others (const void *sx, const char *sy, mp_rnd_t rnd,
/* Test mpfr_pow_z. */
mpz_init (yyy);
- mpfr_get_z (yyy, y, GMP_RNDN);
+ mpfr_get_z (yyy, y, MPFR_RNDN);
mpfr_clear_flags ();
inex2 = mpfr_pow_z (z2, x, yyy, rnd);
cmpres (spx, sx, sy, rnd, z1, inex1, z2, inex2, flags,
@@ -291,9 +291,9 @@ test_others (const void *sx, const char *sy, mp_rnd_t rnd,
/* If x is an integer that fits in an unsigned long and is not -0,
we can test mpfr_ui_pow. */
if (MPFR_IS_POS (x) && mpfr_integer_p (x) &&
- mpfr_fits_ulong_p (x, GMP_RNDN))
+ mpfr_fits_ulong_p (x, MPFR_RNDN))
{
- unsigned long xx = mpfr_get_ui (x, GMP_RNDN);
+ unsigned long xx = mpfr_get_ui (x, MPFR_RNDN);
mpfr_clear_flags ();
inex2 = mpfr_ui_pow (z2, xx, y, rnd);
@@ -356,7 +356,7 @@ my_setstr (mpfr_ptr t, const char *s)
MPFR_SET_POS (t);
return 0;
}
- return mpfr_set_str (t, s, 10, GMP_RNDN);
+ return mpfr_set_str (t, s, 10, MPFR_RNDN);
}
static void
@@ -401,7 +401,7 @@ tst (void)
if (mpfr_overflow_p ())
err ("got overflow", i, j, rnd, z, inex);
exact = MPFR_IS_SINGULAR (z) ||
- (mpfr_mul_2ui (tmp, z, 16, GMP_RNDN), mpfr_integer_p (tmp));
+ (mpfr_mul_2ui (tmp, z, 16, MPFR_RNDN), mpfr_integer_p (tmp));
if (exact && inex != 0)
err ("got exact value with ternary flag different from 0",
i, j, rnd, z, inex);
@@ -478,19 +478,19 @@ underflow_up1 (void)
return;
mpfr_init2 (delta, 2);
- inex = mpfr_set_ui_2exp (delta, 1, -2, GMP_RNDN);
+ inex = mpfr_set_ui_2exp (delta, 1, -2, MPFR_RNDN);
MPFR_ASSERTN (inex == 0);
mpfr_init2 (x, 8);
- inex = mpfr_set_ui (x, 2, GMP_RNDN);
+ inex = mpfr_set_ui (x, 2, MPFR_RNDN);
MPFR_ASSERTN (inex == 0);
mpfr_init2 (y, sizeof (long) * CHAR_BIT + 4);
- inex = mpfr_set_si (y, n, GMP_RNDN);
+ inex = mpfr_set_si (y, n, MPFR_RNDN);
MPFR_ASSERTN (inex == 0);
mpfr_init2 (z0, 2);
- mpfr_set_ui (z0, 0, GMP_RNDN);
+ mpfr_set_ui (z0, 0, MPFR_RNDN);
mpfr_init2 (z, 32);
@@ -501,7 +501,7 @@ underflow_up1 (void)
/* Test 2^(emin - i/4).
* --> Underflow iff i > 4.
- * --> Zero in GMP_RNDN iff i >= 8.
+ * --> Zero in MPFR_RNDN iff i >= 8.
*/
if (i != 0 && i != 4)
@@ -515,8 +515,8 @@ underflow_up1 (void)
{
int zero;
- zero = (i > 4 && (rnd == GMP_RNDZ || rnd == GMP_RNDD)) ||
- (i >= 8 && rnd == GMP_RNDN);
+ zero = (i > 4 && (rnd == MPFR_RNDZ || rnd == MPFR_RNDD)) ||
+ (i >= 8 && rnd == MPFR_RNDN);
mpfr_clear_flags ();
inex = mpfr_pow (z, x, y, (mp_rnd_t) rnd);
@@ -526,7 +526,7 @@ underflow_up1 (void)
"underflow_up1");
}
- inex = mpfr_sub (y, y, delta, GMP_RNDN);
+ inex = mpfr_sub (y, y, delta, MPFR_RNDN);
MPFR_ASSERTN (inex == 0);
}
@@ -537,7 +537,7 @@ underflow_up1 (void)
* due to a double-rounding problem when rescaling the result:
* Error with underflow_up2 and extended exponent range
* x = 7.fffffffffffffff0@-1,
- * y = 4611686018427387904, GMP_RNDN
+ * y = 4611686018427387904, MPFR_RNDN
* Expected 1.0000000000000000@-1152921504606846976, inex = 1, flags = 9
* Got 0, inex = -1, flags = 9
* With pow_ui.c r5423, the following test fails on a 64-bit Linux machine
@@ -545,7 +545,7 @@ underflow_up1 (void)
* error is ignored):
* Error with mpfr_pow_ui, flags cleared
* x = 7.fffffffffffffff0@-1,
- * y = 4611686018427387904, GMP_RNDN
+ * y = 4611686018427387904, MPFR_RNDN
* Expected 1.0000000000000000@-1152921504606846976, inex = 1, flags = 9
* Got 0, inex = -1, flags = 9
*/
@@ -563,17 +563,17 @@ underflow_up2 (void)
return;
mpfr_init2 (eps, 2);
- mpfr_set_ui_2exp (eps, 1, -1, GMP_RNDN); /* 1/2 */
- mpfr_div_ui (eps, eps, n, GMP_RNDZ); /* 1/(2n) rounded toward zero */
+ mpfr_set_ui_2exp (eps, 1, -1, MPFR_RNDN); /* 1/2 */
+ mpfr_div_ui (eps, eps, n, MPFR_RNDZ); /* 1/(2n) rounded toward zero */
mpfr_init2 (x, sizeof (unsigned long) * CHAR_BIT + 1);
- inex = mpfr_ui_sub (x, 1, eps, GMP_RNDN);
+ inex = mpfr_ui_sub (x, 1, eps, MPFR_RNDN);
MPFR_ASSERTN (inex == 0); /* since n < 2^(size_of_long_in_bits) */
- inex = mpfr_div_2ui (x, x, 1, GMP_RNDN); /* 1/2 - eps/2 exactly */
+ inex = mpfr_div_2ui (x, x, 1, MPFR_RNDN); /* 1/2 - eps/2 exactly */
MPFR_ASSERTN (inex == 0);
mpfr_init2 (y, sizeof (unsigned long) * CHAR_BIT);
- inex = mpfr_set_ui (y, n, GMP_RNDN);
+ inex = mpfr_set_ui (y, n, MPFR_RNDN);
MPFR_ASSERTN (inex == 0);
/* 0 < eps < 1 / (2n), thus (1 - eps)^n > 1/2,
@@ -585,8 +585,8 @@ underflow_up2 (void)
int expected_inex;
char sy[256];
- mpfr_set_ui (z0, 0, GMP_RNDN);
- expected_inex = rnd == GMP_RNDN || rnd == GMP_RNDU || rnd == GMP_RNDA ?
+ mpfr_set_ui (z0, 0, MPFR_RNDN);
+ expected_inex = rnd == MPFR_RNDN || rnd == MPFR_RNDU || rnd == MPFR_RNDA ?
(mpfr_nextabove (z0), 1) : -1;
sprintf (sy, "%lu", (unsigned long) n);
@@ -614,7 +614,7 @@ underflow_up3 (void)
mpfr_init2 (z, 32);
mpfr_init2 (z0, 2);
- inex = mpfr_set_exp_t (y, mpfr_get_emin () - 2, GMP_RNDN);
+ inex = mpfr_set_exp_t (y, mpfr_get_emin () - 2, MPFR_RNDN);
MPFR_ASSERTN (inex == 0);
for (i = -1; i <= 1; i++)
RND_LOOP (rnd)
@@ -622,17 +622,17 @@ underflow_up3 (void)
unsigned int ufinex = MPFR_FLAGS_UNDERFLOW | MPFR_FLAGS_INEXACT;
int expected_inex;
- mpfr_set_ui (x, 2, GMP_RNDN);
+ mpfr_set_ui (x, 2, MPFR_RNDN);
if (i < 0)
mpfr_nextbelow (x);
if (i > 0)
mpfr_nextabove (x);
/* x = 2 + i * eps, y = emin - 2, x^y ~= 2^(emin - 2) */
- expected_inex = rnd == GMP_RNDU || rnd == GMP_RNDA
- || (rnd == GMP_RNDN && i < 0) ? 1 : -1;
+ expected_inex = rnd == MPFR_RNDU || rnd == MPFR_RNDA
+ || (rnd == MPFR_RNDN && i < 0) ? 1 : -1;
- mpfr_set_ui (z0, 0, GMP_RNDN);
+ mpfr_set_ui (z0, 0, MPFR_RNDN);
if (expected_inex > 0)
mpfr_nextabove (z0);
@@ -667,7 +667,7 @@ overflow_inv (void)
mpfr_init2 (y, 2);
mpfr_init2 (z, 8);
- mpfr_set_si (y, -1, GMP_RNDN);
+ mpfr_set_si (y, -1, MPFR_RNDN);
for (precx = 10; precx <= 100; precx += 90)
{
const char *sp = precx == 10 ?
@@ -676,7 +676,7 @@ overflow_inv (void)
mpfr_init2 (x, precx);
for (s = -1; s <= 1; s += 2)
{
- inex = mpfr_set_si_2exp (x, s, - mpfr_get_emax (), GMP_RNDN);
+ inex = mpfr_set_si_2exp (x, s, - mpfr_get_emax (), MPFR_RNDN);
MPFR_ASSERTN (inex == 0);
for (t = 0; t <= 5; t++)
{
@@ -685,31 +685,31 @@ overflow_inv (void)
* 1/x = s * 2^emax * (1 - t * 2^(-9) + eps) with eps > 0.
* Values of (1/x) / 2^emax and overflow condition for x > 0:
* t = 0: 1 o: always
- * t = 1: 0.11111111 100000000011... o: GMP_RNDN and GMP_RNDU
- * t = 2: 0.11111111 000000001111... o: GMP_RNDU
+ * t = 1: 0.11111111 100000000011... o: MPFR_RNDN and MPFR_RNDU
+ * t = 2: 0.11111111 000000001111... o: MPFR_RNDU
* t = 3: 0.11111110 100000100011... o: never
*
* If precx = 100:
* t = 0: always overflow
- * t > 0: overflow for GMP_RNDN and GMP_RNDU.
+ * t > 0: overflow for MPFR_RNDN and MPFR_RNDU.
*/
RND_LOOP (rnd)
{
int inf, overflow;
mp_rnd_t rnd2;
- if (rnd == GMP_RNDA)
- rnd2 = s < 0 ? GMP_RNDD : GMP_RNDU;
+ if (rnd == MPFR_RNDA)
+ rnd2 = s < 0 ? MPFR_RNDD : MPFR_RNDU;
else
rnd2 = rnd;
overflow = t == 0 ||
- ((mp_rnd_t) rnd == GMP_RNDN && (precx > 10 || t == 1)) ||
- ((mp_rnd_t) rnd2 == (s < 0 ? GMP_RNDD : GMP_RNDU) &&
+ ((mp_rnd_t) rnd == MPFR_RNDN && (precx > 10 || t == 1)) ||
+ ((mp_rnd_t) rnd2 == (s < 0 ? MPFR_RNDD : MPFR_RNDU) &&
(precx > 10 || t <= 2));
inf = overflow &&
- ((mp_rnd_t) rnd == GMP_RNDN ||
- (mp_rnd_t) rnd2 == (s < 0 ? GMP_RNDD : GMP_RNDU));
+ ((mp_rnd_t) rnd == MPFR_RNDN ||
+ (mp_rnd_t) rnd2 == (s < 0 ? MPFR_RNDD : MPFR_RNDU));
mpfr_clear_flags ();
inex = mpfr_pow (z, x, y, (mp_rnd_t) rnd);
if (overflow ^ !! mpfr_overflow_p ())
@@ -726,7 +726,7 @@ overflow_inv (void)
"s = %d, t = %d, %s\nGot ", sp,
ext ? ", extended exponent range" : "",
s, t, mpfr_print_rnd_mode ((mp_rnd_t) rnd));
- mpfr_out_str (stdout, 16, 0, z, GMP_RNDN);
+ mpfr_out_str (stdout, 16, 0, z, MPFR_RNDN);
printf (" instead of %s value.\n",
inf ? "infinite" : "finite");
exit (1);
diff --git a/tests/tpow_z.c b/tests/tpow_z.c
index a90b23f58..c9d866809 100644
--- a/tests/tpow_z.c
+++ b/tests/tpow_z.c
@@ -40,95 +40,95 @@ check_special (void)
mpz_init (z);
/* x^0 = 1 except for NAN */
- mpfr_set_ui (x, 23, GMP_RNDN);
+ mpfr_set_ui (x, 23, MPFR_RNDN);
mpz_set_ui (z, 0);
- res = mpfr_pow_z (y, x, z, GMP_RNDN);
+ res = mpfr_pow_z (y, x, z, MPFR_RNDN);
if (res != 0 || mpfr_cmp_ui (y, 1) != 0)
ERROR ("23^0");
mpfr_set_nan (x);
- res = mpfr_pow_z (y, x, z, GMP_RNDN);
+ res = mpfr_pow_z (y, x, z, MPFR_RNDN);
if (res != 0 || mpfr_nan_p (y) || mpfr_cmp_si (y, 1) != 0)
ERROR ("NAN^0");
mpfr_set_inf (x, 1);
- res = mpfr_pow_z (y, x, z, GMP_RNDN);
+ res = mpfr_pow_z (y, x, z, MPFR_RNDN);
if (res != 0 || mpfr_cmp_ui (y, 1) != 0)
ERROR ("INF^0");
/* sINF^N = INF if s==1 or n even if N > 0*/
mpz_set_ui (z, 42);
mpfr_set_inf (x, 1);
- res = mpfr_pow_z (y, x, z, GMP_RNDN);
+ res = mpfr_pow_z (y, x, z, MPFR_RNDN);
if (res != 0 || mpfr_inf_p (y) == 0 || mpfr_sgn (y) <= 0)
ERROR ("INF^42");
mpfr_set_inf (x, -1);
- res = mpfr_pow_z (y, x, z, GMP_RNDN);
+ res = mpfr_pow_z (y, x, z, MPFR_RNDN);
if (res != 0 || mpfr_inf_p (y) == 0 || mpfr_sgn (y) <= 0)
ERROR ("-INF^42");
mpz_set_ui (z, 17);
mpfr_set_inf (x, 1);
- res = mpfr_pow_z (y, x, z, GMP_RNDN);
+ res = mpfr_pow_z (y, x, z, MPFR_RNDN);
if (res != 0 || mpfr_inf_p (y) == 0 || mpfr_sgn (y) <= 0)
ERROR ("INF^17");
mpfr_set_inf (x, -1);
- res = mpfr_pow_z (y, x, z, GMP_RNDN);
+ res = mpfr_pow_z (y, x, z, MPFR_RNDN);
if (res != 0 || mpfr_inf_p (y) == 0 || mpfr_sgn (y) >= 0)
ERROR ("-INF^17");
mpz_set_si (z, -42);
mpfr_set_inf (x, 1);
- res = mpfr_pow_z (y, x, z, GMP_RNDN);
+ res = mpfr_pow_z (y, x, z, MPFR_RNDN);
if (res != 0 || mpfr_zero_p (y) == 0 || MPFR_SIGN (y) <= 0)
ERROR ("INF^-42");
mpfr_set_inf (x, -1);
- res = mpfr_pow_z (y, x, z, GMP_RNDN);
+ res = mpfr_pow_z (y, x, z, MPFR_RNDN);
if (res != 0 || mpfr_zero_p (y) == 0 || MPFR_SIGN (y) <= 0)
ERROR ("-INF^-42");
mpz_set_si (z, -17);
mpfr_set_inf (x, 1);
- res = mpfr_pow_z (y, x, z, GMP_RNDN);
+ res = mpfr_pow_z (y, x, z, MPFR_RNDN);
if (res != 0 || mpfr_zero_p (y) == 0 || MPFR_SIGN (y) <= 0)
ERROR ("INF^-17");
mpfr_set_inf (x, -1);
- res = mpfr_pow_z (y, x, z, GMP_RNDN);
+ res = mpfr_pow_z (y, x, z, MPFR_RNDN);
if (res != 0 || mpfr_zero_p (y) == 0 || MPFR_SIGN (y) >= 0)
ERROR ("-INF^-17");
/* s0^N = +0 if s==+ or n even if N > 0*/
mpz_set_ui (z, 42);
MPFR_SET_ZERO (x); MPFR_SET_POS (x);
- res = mpfr_pow_z (y, x, z, GMP_RNDN);
+ res = mpfr_pow_z (y, x, z, MPFR_RNDN);
if (res != 0 || mpfr_zero_p (y) == 0 || MPFR_SIGN (y) <= 0)
ERROR ("+0^42");
MPFR_SET_NEG (x);
- res = mpfr_pow_z (y, x, z, GMP_RNDN);
+ res = mpfr_pow_z (y, x, z, MPFR_RNDN);
if (res != 0 || mpfr_zero_p (y) == 0 || MPFR_SIGN (y) <= 0)
ERROR ("-0^42");
mpz_set_ui (z, 17);
MPFR_SET_POS (x);
- res = mpfr_pow_z (y, x, z, GMP_RNDN);
+ res = mpfr_pow_z (y, x, z, MPFR_RNDN);
if (res != 0 || mpfr_zero_p (y) == 0 || MPFR_SIGN (y) <= 0)
ERROR ("+0^17");
MPFR_SET_NEG (x);
- res = mpfr_pow_z (y, x, z, GMP_RNDN);
+ res = mpfr_pow_z (y, x, z, MPFR_RNDN);
if (res != 0 || mpfr_zero_p (y) == 0 || MPFR_SIGN (y) >= 0)
ERROR ("-0^17");
mpz_set_si (z, -42);
MPFR_SET_ZERO (x); MPFR_SET_POS (x);
- res = mpfr_pow_z (y, x, z, GMP_RNDN);
+ res = mpfr_pow_z (y, x, z, MPFR_RNDN);
if (res != 0 || mpfr_inf_p (y) == 0 || MPFR_SIGN (y) <= 0)
ERROR ("+0^-42");
MPFR_SET_NEG (x);
- res = mpfr_pow_z (y, x, z, GMP_RNDN);
+ res = mpfr_pow_z (y, x, z, MPFR_RNDN);
if (res != 0 || mpfr_inf_p (y) == 0 || MPFR_SIGN (y) <= 0)
ERROR ("-0^-42");
mpz_set_si (z, -17);
MPFR_SET_POS (x);
- res = mpfr_pow_z (y, x, z, GMP_RNDN);
+ res = mpfr_pow_z (y, x, z, MPFR_RNDN);
if (res != 0 || mpfr_inf_p (y) == 0 || MPFR_SIGN (y) <= 0)
ERROR ("+0^-17");
MPFR_SET_NEG (x);
- res = mpfr_pow_z (y, x, z, GMP_RNDN);
+ res = mpfr_pow_z (y, x, z, MPFR_RNDN);
if (res != 0 || mpfr_inf_p (y) == 0 || MPFR_SIGN (y) >= 0)
ERROR ("-0^-17");
@@ -160,7 +160,7 @@ check_integer (mp_prec_t begin, mp_prec_t end, unsigned long max)
if ((i & 1) != 0)
mpz_neg (z, z);
mpfr_urandomb (x, RANDS);
- mpfr_mul_2ui (x, x, 1, GMP_RNDN); /* 0 <= x < 2 */
+ mpfr_mul_2ui (x, x, 1, MPFR_RNDN); /* 0 <= x < 2 */
rnd = RND_RAND ();
if (mpz_fits_slong_p (z))
{
@@ -206,8 +206,8 @@ check_regression (void)
mpfr_init2 (y, 122);
mpfr_set_str_binary (x, "0.10000010010000111101001110100101101010011110011100001111000001001101000110011001001001001011001011010110110110101000111011E1");
- res1 = mpfr_pow_z (y, x, z, GMP_RNDU);
- res2 = mpfr_pow_ui (x, x, 2026876995UL, GMP_RNDU);
+ res1 = mpfr_pow_z (y, x, z, MPFR_RNDU);
+ res2 = mpfr_pow_ui (x, x, 2026876995UL, MPFR_RNDU);
if (mpfr_cmp (x, y) || res1 != res2)
{
printf ("Regression (1) tested failed (%d=?%d)\n",res1, res2);
@@ -232,10 +232,10 @@ bug20071104 (void)
mpz_init_set_si (z, -2);
mpfr_inits2 (20, x, y, (mpfr_ptr) 0);
- mpfr_set_ui (x, 0, GMP_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
mpfr_nextbelow (x); /* x = -2^(emin-1) */
mpfr_clear_flags ();
- inex = mpfr_pow_z (y, x, z, GMP_RNDN);
+ inex = mpfr_pow_z (y, x, z, MPFR_RNDN);
if (! mpfr_inf_p (y) || MPFR_SIGN (y) < 0)
{
printf ("Error in bug20071104: expected +Inf, got ");
@@ -268,7 +268,7 @@ check_overflow (void)
mpfr_set_str_binary (a, "1E10");
mpz_init_set_ui (z, ULONG_MAX);
- res = mpfr_pow_z (a, a, z, GMP_RNDN);
+ res = mpfr_pow_z (a, a, z, MPFR_RNDN);
if (!MPFR_IS_INF (a) || MPFR_SIGN (a) < 0)
{
printf ("Error for (1e10)^ULONG_MAX\n");
@@ -283,7 +283,7 @@ check_overflow (void)
mpfr_set_str_binary (a, "-1.1E10");
n = (ULONG_MAX ^ (ULONG_MAX >> 1)) + 1;
mpz_set_ui (z, n);
- res = mpfr_pow_z (a, a, z, GMP_RNDN);
+ res = mpfr_pow_z (a, a, z, MPFR_RNDN);
if (!MPFR_IS_INF (a) || MPFR_SIGN (a) > 0)
{
printf ("Error for (-1e10)^%lu, expected -Inf,\ngot ", n);
@@ -305,11 +305,11 @@ bug20080223 (void)
mpfr_init2 (exp, 53);
mpfr_init2 (answer, 53);
- mpfr_set_si (exp, -1073741824, GMP_RNDN);
+ mpfr_set_si (exp, -1073741824, MPFR_RNDN);
- mpfr_set_str (a, "1.999999999", 10, GMP_RNDN);
+ mpfr_set_str (a, "1.999999999", 10, MPFR_RNDN);
/* a = 562949953139837/2^48 */
- mpfr_pow (answer, a, exp, GMP_RNDN);
+ mpfr_pow (answer, a, exp, MPFR_RNDN);
mpfr_set_str_binary (a, "0.110110101111011001110000111111100011101000111011101E-1073741823");
MPFR_ASSERTN(mpfr_cmp0 (answer, a) == 0);
@@ -335,10 +335,10 @@ bug20080904 (void)
mpz_set_str (exp, "-4eb92f8c7b7bf81e", 16);
mpfr_set_str_binary (a, "1.110000101110100110100011111000011110111101000011111001111001010011100");
- mpfr_pow_z (answer, a, exp, GMP_RNDN);
+ mpfr_pow_z (answer, a, exp, MPFR_RNDN);
/* The correct result is near 2^(-2^62), so it underflows when
MPFR_EMIN_MIN > -2^62 (i.e. with 32 and 64 bits machines). */
- mpfr_set_str (a, "AA500C0D7A69275DBp-4632850503556296886", 16, GMP_RNDN);
+ mpfr_set_str (a, "AA500C0D7A69275DBp-4632850503556296886", 16, MPFR_RNDN);
MPFR_ASSERTN(mpfr_cmp0 (answer, a) == 0);
mpfr_set_emin (emin_default);
diff --git a/tests/tprintf.c b/tests/tprintf.c
index 71cae718c..2a001f45a 100644
--- a/tests/tprintf.c
+++ b/tests/tprintf.c
@@ -164,7 +164,7 @@ check_mixed (void)
mpz_t mpz;
mpq_t mpq;
mpf_t mpf;
- mp_rnd_t rnd = GMP_RNDN;
+ mp_rnd_t rnd = MPFR_RNDN;
mpfr_t mpfr;
mpfr_prec_t prec;
@@ -176,7 +176,7 @@ check_mixed (void)
mpf_init (mpf);
mpf_set_q (mpf, mpq);
mpfr_init (mpfr);
- mpfr_set_f (mpfr, mpf, GMP_RNDN);
+ mpfr_set_f (mpfr, mpf, MPFR_RNDN);
prec = mpfr_get_prec (mpfr);
check_vprintf ("a. %Ra, b. %u, c. %lx%n", mpfr, ui, ulo, &j);
diff --git a/tests/trandom.c b/tests/trandom.c
index 08abb96dc..14dafc31e 100644
--- a/tests/trandom.c
+++ b/tests/trandom.c
@@ -136,7 +136,7 @@ test_random2 (long nbtests, mp_prec_t prec, int verbose)
/* test size=0 */
mpfr_random2 (x, 0, 0);
MPFR_ASSERTN (mpfr_cmp_ui (x, 0) == 0 && MPFR_IS_POS (x));
- mpfr_set_si (x, -1, GMP_RNDN); /* x is negative */
+ mpfr_set_si (x, -1, MPFR_RNDN); /* x is negative */
mpfr_random2 (x, 0, 0);
MPFR_ASSERTN (mpfr_cmp_ui (x, 0) == 0 && MPFR_IS_POS (x));
diff --git a/tests/trec_sqrt.c b/tests/trec_sqrt.c
index 3b33b2a4e..e1776cfe2 100644
--- a/tests/trec_sqrt.c
+++ b/tests/trec_sqrt.c
@@ -42,44 +42,44 @@ special (void)
/* rec_sqrt(NaN) = NaN */
mpfr_set_nan (x);
- inex = mpfr_rec_sqrt (x, x, GMP_RNDN);
+ inex = mpfr_rec_sqrt (x, x, MPFR_RNDN);
MPFR_ASSERTN(mpfr_nan_p (x) && inex == 0);
/* rec_sqrt(+Inf) = +0 */
mpfr_set_inf (x, 1);
- inex = mpfr_rec_sqrt (x, x, GMP_RNDN);
+ inex = mpfr_rec_sqrt (x, x, MPFR_RNDN);
MPFR_ASSERTN(mpfr_zero_p (x) && MPFR_IS_POS(x) && inex == 0);
/* rec_sqrt(-Inf) = NaN */
mpfr_set_inf (x, -1);
- inex = mpfr_rec_sqrt (x, x, GMP_RNDN);
+ inex = mpfr_rec_sqrt (x, x, MPFR_RNDN);
MPFR_ASSERTN(mpfr_nan_p (x) && inex == 0);
/* rec_sqrt(+0) = +Inf */
- mpfr_set_ui (x, 0, GMP_RNDN);
- inex = mpfr_rec_sqrt (x, x, GMP_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ inex = mpfr_rec_sqrt (x, x, MPFR_RNDN);
MPFR_ASSERTN(mpfr_inf_p (x) && MPFR_IS_POS(x) && inex == 0);
/* rec_sqrt(-0) = +Inf */
- mpfr_set_ui (x, 0, GMP_RNDN);
- mpfr_neg (x, x, GMP_RNDN);
- inex = mpfr_rec_sqrt (x, x, GMP_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN);
+ inex = mpfr_rec_sqrt (x, x, MPFR_RNDN);
MPFR_ASSERTN(mpfr_inf_p (x) && MPFR_IS_POS(x) && inex == 0);
/* rec_sqrt(-1) = NaN */
- mpfr_set_si (x, -1, GMP_RNDN);
- inex = mpfr_rec_sqrt (x, x, GMP_RNDN);
+ mpfr_set_si (x, -1, MPFR_RNDN);
+ inex = mpfr_rec_sqrt (x, x, MPFR_RNDN);
MPFR_ASSERTN(mpfr_nan_p (x) && inex == 0);
/* rec_sqrt(1) = 1 */
- mpfr_set_ui (x, 1, GMP_RNDN);
- inex = mpfr_rec_sqrt (x, x, GMP_RNDN);
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ inex = mpfr_rec_sqrt (x, x, MPFR_RNDN);
MPFR_ASSERTN((mpfr_cmp_ui (x, 1) == 0) && (inex == 0));
mpfr_set_prec (x, 23);
mpfr_set_prec (y, 33);
mpfr_set_str_binary (x, "1.0001110110101001010100e-1");
- inex = mpfr_rec_sqrt (y, x, GMP_RNDU);
+ inex = mpfr_rec_sqrt (y, x, MPFR_RNDU);
mpfr_set_prec (x, 33);
mpfr_set_str_binary (x, "1.01010110101110100100100101011");
MPFR_ASSERTN (inex > 0 && mpfr_cmp (x, y) == 0);
@@ -96,17 +96,17 @@ bad_case1 (void)
mpfr_init2 (x, 72);
mpfr_inits2 (6, y, z, (mpfr_ptr) 0);
- mpfr_set_str (x, "1.08310518720928b30e@-120", 16, GMP_RNDN);
- mpfr_set_str (z, "f.8@59", 16, GMP_RNDN);
+ mpfr_set_str (x, "1.08310518720928b30e@-120", 16, MPFR_RNDN);
+ mpfr_set_str (z, "f.8@59", 16, MPFR_RNDN);
/* z = rec_sqrt(x) rounded on 6 bits toward 0, the exact value
being ~= f.bffffffffffffffffa11@59. */
- mpfr_rec_sqrt (y, x, GMP_RNDZ);
+ mpfr_rec_sqrt (y, x, MPFR_RNDZ);
if (mpfr_cmp0 (y, z) != 0)
{
printf ("Error in bad_case1\nexpected ");
- mpfr_out_str (stdout, 16, 0, z, GMP_RNDN);
+ mpfr_out_str (stdout, 16, 0, z, MPFR_RNDN);
printf ("\ngot ");
- mpfr_out_str (stdout, 16, 0, y, GMP_RNDN);
+ mpfr_out_str (stdout, 16, 0, y, MPFR_RNDN);
printf ("\n");
exit (1);
}
diff --git a/tests/tremquo.c b/tests/tremquo.c
index 0f2358a7b..de7d0900c 100644
--- a/tests/tremquo.c
+++ b/tests/tremquo.c
@@ -35,11 +35,11 @@ bug20090227 (void)
mpfr_init2 (y, 181);
mpfr_init2 (r1, 140);
mpfr_init2 (r2, 140);
- mpfr_set_si (x, -1, GMP_RNDN);
+ mpfr_set_si (x, -1, MPFR_RNDN);
mpfr_set_str_binary (y, "1.100100100001111110110101010001000100001011010001100001000110100110001001100011001100010100010111000000011011100000111001101000100101001000000100100111000001000100010100110011111010");
- inex1 = mpfr_remainder (r1, x, y, GMP_RNDU);
+ inex1 = mpfr_remainder (r1, x, y, MPFR_RNDU);
/* since the quotient is -1, r1 is the rounding of x+y */
- inex2 = mpfr_add (r2, x, y, GMP_RNDU);
+ inex2 = mpfr_add (r2, x, y, MPFR_RNDU);
if (mpfr_cmp (r1, r2))
{
printf ("Error in mpfr_remainder (bug20090227)\n");
@@ -61,16 +61,16 @@ main (int argc, char *argv[])
mpfr_t x, y, r;
long q[1];
- if (argc == 3) /* usage: tremquo x y (rnd=GMP_RNDN implicit) */
+ if (argc == 3) /* usage: tremquo x y (rnd=MPFR_RNDN implicit) */
{
mpfr_init2 (x, BITS_PER_MP_LIMB);
mpfr_init2 (y, BITS_PER_MP_LIMB);
mpfr_init2 (r, BITS_PER_MP_LIMB);
- mpfr_set_str (x, argv[1], 10, GMP_RNDN);
- mpfr_set_str (y, argv[2], 10, GMP_RNDN);
- mpfr_remquo (r, q, x, y, GMP_RNDN);
+ mpfr_set_str (x, argv[1], 10, MPFR_RNDN);
+ mpfr_set_str (y, argv[2], 10, MPFR_RNDN);
+ mpfr_remquo (r, q, x, y, MPFR_RNDN);
printf ("r=");
- mpfr_out_str (stdout, 10, 0, r, GMP_RNDN);
+ mpfr_out_str (stdout, 10, 0, r, MPFR_RNDN);
printf (" q=%ld\n", q[0]);
mpfr_clear (x);
mpfr_clear (y);
@@ -88,64 +88,64 @@ main (int argc, char *argv[])
/* special values */
mpfr_set_nan (x);
- mpfr_set_ui (y, 1, GMP_RNDN);
- mpfr_remquo (r, q, x, y, GMP_RNDN);
+ mpfr_set_ui (y, 1, MPFR_RNDN);
+ mpfr_remquo (r, q, x, y, MPFR_RNDN);
MPFR_ASSERTN(mpfr_nan_p (r));
- mpfr_set_ui (x, 1, GMP_RNDN);
+ mpfr_set_ui (x, 1, MPFR_RNDN);
mpfr_set_nan (y);
- mpfr_remquo (r, q, x, y, GMP_RNDN);
+ mpfr_remquo (r, q, x, y, MPFR_RNDN);
MPFR_ASSERTN(mpfr_nan_p (r));
mpfr_set_inf (x, 1); /* +Inf */
- mpfr_set_ui (y, 1, GMP_RNDN);
- mpfr_remquo (r, q, x, y, GMP_RNDN);
+ mpfr_set_ui (y, 1, MPFR_RNDN);
+ mpfr_remquo (r, q, x, y, MPFR_RNDN);
MPFR_ASSERTN (mpfr_nan_p (r));
mpfr_set_inf (x, 1); /* +Inf */
- mpfr_set_ui (y, 0, GMP_RNDN);
- mpfr_remquo (r, q, x, y, GMP_RNDN);
+ mpfr_set_ui (y, 0, MPFR_RNDN);
+ mpfr_remquo (r, q, x, y, MPFR_RNDN);
MPFR_ASSERTN (mpfr_nan_p (r));
mpfr_set_inf (x, 1); /* +Inf */
mpfr_set_inf (y, 1);
- mpfr_remquo (r, q, x, y, GMP_RNDN);
+ mpfr_remquo (r, q, x, y, MPFR_RNDN);
MPFR_ASSERTN (mpfr_nan_p (r));
- mpfr_set_ui (x, 0, GMP_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
mpfr_set_inf (y, 1);
- mpfr_remquo (r, q, x, y, GMP_RNDN);
+ mpfr_remquo (r, q, x, y, MPFR_RNDN);
MPFR_ASSERTN (mpfr_cmp_ui (r, 0) == 0 && MPFR_IS_POS (r));
MPFR_ASSERTN (q[0] == (long) 0);
- mpfr_set_ui (x, 0, GMP_RNDN);
- mpfr_neg (x, x, GMP_RNDN); /* -0 */
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN); /* -0 */
mpfr_set_inf (y, 1);
- mpfr_remquo (r, q, x, y, GMP_RNDN);
+ mpfr_remquo (r, q, x, y, MPFR_RNDN);
MPFR_ASSERTN (mpfr_cmp_ui (r, 0) == 0 && MPFR_IS_NEG (r));
MPFR_ASSERTN (q[0] == (long) 0);
- mpfr_set_ui (x, 17, GMP_RNDN);
+ mpfr_set_ui (x, 17, MPFR_RNDN);
mpfr_set_inf (y, 1);
- mpfr_remquo (r, q, x, y, GMP_RNDN);
+ mpfr_remquo (r, q, x, y, MPFR_RNDN);
MPFR_ASSERTN (mpfr_cmp (r, x) == 0);
MPFR_ASSERTN (q[0] == (long) 0);
- mpfr_set_ui (x, 17, GMP_RNDN);
- mpfr_set_ui (y, 0, GMP_RNDN);
- mpfr_remquo (r, q, x, y, GMP_RNDN);
+ mpfr_set_ui (x, 17, MPFR_RNDN);
+ mpfr_set_ui (y, 0, MPFR_RNDN);
+ mpfr_remquo (r, q, x, y, MPFR_RNDN);
MPFR_ASSERTN (mpfr_nan_p (r));
- mpfr_set_ui (x, 0, GMP_RNDN);
- mpfr_set_ui (y, 17, GMP_RNDN);
- mpfr_remquo (r, q, x, y, GMP_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_set_ui (y, 17, MPFR_RNDN);
+ mpfr_remquo (r, q, x, y, MPFR_RNDN);
MPFR_ASSERTN (mpfr_cmp_ui (r, 0) == 0 && MPFR_IS_POS (r));
MPFR_ASSERTN (q[0] == (long) 0);
- mpfr_set_ui (x, 0, GMP_RNDN);
- mpfr_neg (x, x, GMP_RNDN);
- mpfr_set_ui (y, 17, GMP_RNDN);
- mpfr_remquo (r, q, x, y, GMP_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN);
+ mpfr_set_ui (y, 17, MPFR_RNDN);
+ mpfr_remquo (r, q, x, y, MPFR_RNDN);
MPFR_ASSERTN (mpfr_cmp_ui (r, 0) == 0 && MPFR_IS_NEG (r));
MPFR_ASSERTN (q[0] == (long) 0);
@@ -153,81 +153,81 @@ main (int argc, char *argv[])
mpfr_set_prec (y, 53);
/* check four possible sign combinations */
- mpfr_set_ui (x, 42, GMP_RNDN);
- mpfr_set_ui (y, 17, GMP_RNDN);
- mpfr_remquo (r, q, x, y, GMP_RNDN);
+ mpfr_set_ui (x, 42, MPFR_RNDN);
+ mpfr_set_ui (y, 17, MPFR_RNDN);
+ mpfr_remquo (r, q, x, y, MPFR_RNDN);
MPFR_ASSERTN (mpfr_cmp_ui (r, 8) == 0);
MPFR_ASSERTN (q[0] == (long) 2);
- mpfr_set_si (x, -42, GMP_RNDN);
- mpfr_set_ui (y, 17, GMP_RNDN);
- mpfr_remquo (r, q, x, y, GMP_RNDN);
+ mpfr_set_si (x, -42, MPFR_RNDN);
+ mpfr_set_ui (y, 17, MPFR_RNDN);
+ mpfr_remquo (r, q, x, y, MPFR_RNDN);
MPFR_ASSERTN (mpfr_cmp_si (r, -8) == 0);
MPFR_ASSERTN (q[0] == (long) -2);
- mpfr_set_si (x, -42, GMP_RNDN);
- mpfr_set_si (y, -17, GMP_RNDN);
- mpfr_remquo (r, q, x, y, GMP_RNDN);
+ mpfr_set_si (x, -42, MPFR_RNDN);
+ mpfr_set_si (y, -17, MPFR_RNDN);
+ mpfr_remquo (r, q, x, y, MPFR_RNDN);
MPFR_ASSERTN (mpfr_cmp_si (r, -8) == 0);
MPFR_ASSERTN (q[0] == (long) 2);
- mpfr_set_ui (x, 42, GMP_RNDN);
- mpfr_set_si (y, -17, GMP_RNDN);
- mpfr_remquo (r, q, x, y, GMP_RNDN);
+ mpfr_set_ui (x, 42, MPFR_RNDN);
+ mpfr_set_si (y, -17, MPFR_RNDN);
+ mpfr_remquo (r, q, x, y, MPFR_RNDN);
MPFR_ASSERTN (mpfr_cmp_ui (r, 8) == 0);
MPFR_ASSERTN (q[0] == (long) -2);
mpfr_set_prec (x, 100);
mpfr_set_prec (y, 50);
- mpfr_set_ui (x, 42, GMP_RNDN);
+ mpfr_set_ui (x, 42, MPFR_RNDN);
mpfr_nextabove (x); /* 42 + 2^(-94) */
- mpfr_set_ui (y, 21, GMP_RNDN);
- mpfr_remquo (r, q, x, y, GMP_RNDN);
+ mpfr_set_ui (y, 21, MPFR_RNDN);
+ mpfr_remquo (r, q, x, y, MPFR_RNDN);
MPFR_ASSERTN (mpfr_cmp_ui_2exp (r, 1, -94) == 0);
MPFR_ASSERTN (q[0] == (long) 2);
mpfr_set_prec (x, 50);
mpfr_set_prec (y, 100);
- mpfr_set_ui (x, 42, GMP_RNDN);
+ mpfr_set_ui (x, 42, MPFR_RNDN);
mpfr_nextabove (x); /* 42 + 2^(-44) */
- mpfr_set_ui (y, 21, GMP_RNDN);
- mpfr_remquo (r, q, x, y, GMP_RNDN);
+ mpfr_set_ui (y, 21, MPFR_RNDN);
+ mpfr_remquo (r, q, x, y, MPFR_RNDN);
MPFR_ASSERTN (mpfr_cmp_ui_2exp (r, 1, -44) == 0);
MPFR_ASSERTN (q[0] == (long) 2);
mpfr_set_prec (x, 100);
mpfr_set_prec (y, 50);
- mpfr_set_ui (x, 42, GMP_RNDN);
- mpfr_set_ui (y, 21, GMP_RNDN);
+ mpfr_set_ui (x, 42, MPFR_RNDN);
+ mpfr_set_ui (y, 21, MPFR_RNDN);
mpfr_nextabove (y); /* 21 + 2^(-45) */
- mpfr_remquo (r, q, x, y, GMP_RNDN);
+ mpfr_remquo (r, q, x, y, MPFR_RNDN);
/* r should be 42 - 2*(21 + 2^(-45)) = -2^(-44) */
MPFR_ASSERTN (mpfr_cmp_si_2exp (r, -1, -44) == 0);
MPFR_ASSERTN (q[0] == (long) 2);
mpfr_set_prec (x, 50);
mpfr_set_prec (y, 100);
- mpfr_set_ui (x, 42, GMP_RNDN);
- mpfr_set_ui (y, 21, GMP_RNDN);
+ mpfr_set_ui (x, 42, MPFR_RNDN);
+ mpfr_set_ui (y, 21, MPFR_RNDN);
mpfr_nextabove (y); /* 21 + 2^(-95) */
- mpfr_remquo (r, q, x, y, GMP_RNDN);
+ mpfr_remquo (r, q, x, y, MPFR_RNDN);
/* r should be 42 - 2*(21 + 2^(-95)) = -2^(-94) */
MPFR_ASSERTN (mpfr_cmp_si_2exp (r, -1, -94) == 0);
MPFR_ASSERTN (q[0] == (long) 2);
/* exercise large quotient */
- mpfr_set_ui_2exp (x, 1, 65, GMP_RNDN);
- mpfr_set_ui (y, 1, GMP_RNDN);
+ mpfr_set_ui_2exp (x, 1, 65, MPFR_RNDN);
+ mpfr_set_ui (y, 1, MPFR_RNDN);
/* quotient is 2^65 */
- mpfr_remquo (r, q, x, y, GMP_RNDN);
+ mpfr_remquo (r, q, x, y, MPFR_RNDN);
MPFR_ASSERTN (mpfr_cmp_si (r, 0) == 0);
MPFR_ASSERTN (q[0] % 1073741824L == 0L);
/* another large quotient */
mpfr_set_prec (x, 65);
mpfr_set_prec (y, 65);
- mpfr_const_pi (x, GMP_RNDN);
- mpfr_mul_2exp (x, x, 63, GMP_RNDN);
- mpfr_const_log2 (y, GMP_RNDN);
+ mpfr_const_pi (x, MPFR_RNDN);
+ mpfr_mul_2exp (x, x, 63, MPFR_RNDN);
+ mpfr_const_log2 (y, MPFR_RNDN);
mpfr_set_prec (r, 10);
- mpfr_remquo (r, q, x, y, GMP_RNDN);
+ mpfr_remquo (r, q, x, y, MPFR_RNDN);
/* q should be 41803643793084085130, r should be 605/2048 */
MPFR_ASSERTN (mpfr_cmp_ui_2exp (r, 605, -11) == 0);
MPFR_ASSERTN ((q[0] > 0) && ((q[0] % 1073741824L) == 733836170L));
@@ -236,49 +236,49 @@ main (int argc, char *argv[])
mpfr_set_prec (x, 65);
mpfr_set_prec (y, 65);
mpfr_set_prec (r, 63);
- mpfr_set_ui (x, 3, GMP_RNDN);
- mpfr_set_ui (y, 2, GMP_RNDN);
- mpfr_remquo (r, q, x, y, GMP_RNDN);
+ mpfr_set_ui (x, 3, MPFR_RNDN);
+ mpfr_set_ui (y, 2, MPFR_RNDN);
+ mpfr_remquo (r, q, x, y, MPFR_RNDN);
/* x/y = 1.5, quotient should be 2 (even rule), remainder should be -1 */
MPFR_ASSERTN (mpfr_cmp_si (r, -1) == 0);
MPFR_ASSERTN (q[0] == 2L);
- mpfr_set_ui (x, 3, GMP_RNDN);
+ mpfr_set_ui (x, 3, MPFR_RNDN);
mpfr_nextabove (x); /* 3 + 2^(-63) */
- mpfr_set_ui (y, 2, GMP_RNDN);
- mpfr_remquo (r, q, x, y, GMP_RNDN);
+ mpfr_set_ui (y, 2, MPFR_RNDN);
+ mpfr_remquo (r, q, x, y, MPFR_RNDN);
/* x/y = 1.5 + 2^(-64), quo should be 2, r should be -1 + 2^(-63) */
- MPFR_ASSERTN (mpfr_add_ui (r, r, 1, GMP_RNDN) == 0);
+ MPFR_ASSERTN (mpfr_add_ui (r, r, 1, MPFR_RNDN) == 0);
MPFR_ASSERTN (mpfr_cmp_ui_2exp (r, 1, -63) == 0);
MPFR_ASSERTN (q[0] == 2L);
- mpfr_set_ui (x, 3, GMP_RNDN);
- mpfr_set_ui (y, 2, GMP_RNDN);
+ mpfr_set_ui (x, 3, MPFR_RNDN);
+ mpfr_set_ui (y, 2, MPFR_RNDN);
mpfr_nextabove (y); /* 2 + 2^(-63) */
- mpfr_remquo (r, q, x, y, GMP_RNDN);
+ mpfr_remquo (r, q, x, y, MPFR_RNDN);
/* x/y = 1.5 - eps, quo should be 1, r should be 1 - 2^(-63) */
- MPFR_ASSERTN (mpfr_sub_ui (r, r, 1, GMP_RNDN) == 0);
+ MPFR_ASSERTN (mpfr_sub_ui (r, r, 1, MPFR_RNDN) == 0);
MPFR_ASSERTN (mpfr_cmp_si_2exp (r, -1, -63) == 0);
MPFR_ASSERTN (q[0] == 1L);
/* bug founds by Kaveh Ghazi, 3 May 2007 */
- mpfr_set_ui (x, 2, GMP_RNDN);
- mpfr_set_ui (y, 3, GMP_RNDN);
- mpfr_remainder (r, x, y, GMP_RNDN);
+ mpfr_set_ui (x, 2, MPFR_RNDN);
+ mpfr_set_ui (y, 3, MPFR_RNDN);
+ mpfr_remainder (r, x, y, MPFR_RNDN);
MPFR_ASSERTN (mpfr_cmp_si (r, -1) == 0);
- mpfr_set_si (x, -1, GMP_RNDN);
- mpfr_set_ui (y, 1, GMP_RNDN);
- mpfr_remainder (r, x, y, GMP_RNDN);
+ mpfr_set_si (x, -1, MPFR_RNDN);
+ mpfr_set_ui (y, 1, MPFR_RNDN);
+ mpfr_remainder (r, x, y, MPFR_RNDN);
MPFR_ASSERTN (mpfr_cmp_si (r, 0) == 0 && MPFR_SIGN (r) < 0);
/* check argument reuse */
- mpfr_set_si (x, -1, GMP_RNDN);
- mpfr_set_ui (y, 1, GMP_RNDN);
- mpfr_remainder (x, x, y, GMP_RNDN);
+ mpfr_set_si (x, -1, MPFR_RNDN);
+ mpfr_set_ui (y, 1, MPFR_RNDN);
+ mpfr_remainder (x, x, y, MPFR_RNDN);
MPFR_ASSERTN (mpfr_cmp_si (x, 0) == 0 && MPFR_SIGN (x) < 0);
- mpfr_set_ui_2exp (x, 1, mpfr_get_emax () - 1, GMP_RNDN);
- mpfr_set_ui_2exp (y, 1, mpfr_get_emin (), GMP_RNDN);
- mpfr_remquo (r, q, x, y, GMP_RNDN);
+ mpfr_set_ui_2exp (x, 1, mpfr_get_emax () - 1, MPFR_RNDN);
+ mpfr_set_ui_2exp (y, 1, mpfr_get_emin (), MPFR_RNDN);
+ mpfr_remquo (r, q, x, y, MPFR_RNDN);
MPFR_ASSERTN (mpfr_zero_p (r) && MPFR_SIGN (r) > 0);
MPFR_ASSERTN (q[0] == 0);
diff --git a/tests/trint.c b/tests/trint.c
index 0a76a6d0d..3b6be4516 100644
--- a/tests/trint.c
+++ b/tests/trint.c
@@ -40,31 +40,31 @@ special (void)
mpfr_init (y);
mpfr_set_nan (x);
- mpfr_rint (y, x, GMP_RNDN);
+ mpfr_rint (y, x, MPFR_RNDN);
MPFR_ASSERTN(mpfr_nan_p (y));
mpfr_set_inf (x, 1);
- mpfr_rint (y, x, GMP_RNDN);
+ mpfr_rint (y, x, MPFR_RNDN);
MPFR_ASSERTN(mpfr_inf_p (y) && mpfr_sgn (y) > 0);
mpfr_set_inf (x, -1);
- mpfr_rint (y, x, GMP_RNDN);
+ mpfr_rint (y, x, MPFR_RNDN);
MPFR_ASSERTN(mpfr_inf_p (y) && mpfr_sgn (y) < 0);
- mpfr_set_ui (x, 0, GMP_RNDN);
- mpfr_rint (y, x, GMP_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_rint (y, x, MPFR_RNDN);
MPFR_ASSERTN(mpfr_cmp_ui (y, 0) == 0 && MPFR_IS_POS(y));
- mpfr_set_ui (x, 0, GMP_RNDN);
- mpfr_neg (x, x, GMP_RNDN);
- mpfr_rint (y, x, GMP_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN);
+ mpfr_rint (y, x, MPFR_RNDN);
MPFR_ASSERTN(mpfr_cmp_ui (y, 0) == 0 && MPFR_IS_NEG(y));
/* coverage test */
mpfr_set_prec (x, 2);
- mpfr_set_ui (x, 1, GMP_RNDN);
- mpfr_mul_2exp (x, x, mp_bits_per_limb, GMP_RNDN);
- mpfr_rint (y, x, GMP_RNDN);
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_mul_2exp (x, x, mp_bits_per_limb, MPFR_RNDN);
+ mpfr_rint (y, x, MPFR_RNDN);
MPFR_ASSERTN(mpfr_cmp (y, x) == 0);
/* another coverage test */
@@ -73,7 +73,7 @@ special (void)
mpfr_set_prec (x, 3);
mpfr_set_str_binary (x, "1.11E0");
mpfr_set_prec (y, 2);
- mpfr_rint (y, x, GMP_RNDU); /* x rounds to 1.0E1=0.1E2 which overflows */
+ mpfr_rint (y, x, MPFR_RNDU); /* x rounds to 1.0E1=0.1E2 which overflows */
MPFR_ASSERTN(mpfr_inf_p (y) && mpfr_sgn (y) > 0);
set_emax (emax);
@@ -81,35 +81,35 @@ special (void)
mpfr_set_prec (x, 97);
mpfr_set_prec (y, 96);
mpfr_set_str_binary (x, "-0.1011111001101111000111011100011100000110110110110000000111010001000101001111101010101011010111100E97");
- mpfr_rint (y, x, GMP_RNDN);
+ mpfr_rint (y, x, MPFR_RNDN);
MPFR_ASSERTN(mpfr_cmp (y, x) == 0);
mpfr_set_prec (x, 53);
mpfr_set_prec (y, 53);
mpfr_set_str_binary (x, "0.10101100000000101001010101111111000000011111010000010E-1");
- mpfr_rint (y, x, GMP_RNDU);
+ mpfr_rint (y, x, MPFR_RNDU);
MPFR_ASSERTN(mpfr_cmp_ui (y, 1) == 0);
- mpfr_rint (y, x, GMP_RNDD);
+ mpfr_rint (y, x, MPFR_RNDD);
MPFR_ASSERTN(mpfr_cmp_ui (y, 0) == 0 && MPFR_IS_POS(y));
mpfr_set_prec (x, 36);
mpfr_set_prec (y, 2);
mpfr_set_str_binary (x, "-11000110101010111111110111001.0000100");
- mpfr_rint (y, x, GMP_RNDN);
+ mpfr_rint (y, x, MPFR_RNDN);
mpfr_set_str_binary (x, "-11E27");
MPFR_ASSERTN(mpfr_cmp (y, x) == 0);
mpfr_set_prec (x, 39);
mpfr_set_prec (y, 29);
mpfr_set_str_binary (x, "-0.100010110100011010001111001001001100111E39");
- mpfr_rint (y, x, GMP_RNDN);
+ mpfr_rint (y, x, MPFR_RNDN);
mpfr_set_str_binary (x, "-0.10001011010001101000111100101E39");
MPFR_ASSERTN(mpfr_cmp (y, x) == 0);
mpfr_set_prec (x, 46);
mpfr_set_prec (y, 32);
mpfr_set_str_binary (x, "-0.1011100110100101000001011111101011001001101001E32");
- mpfr_rint (y, x, GMP_RNDN);
+ mpfr_rint (y, x, MPFR_RNDN);
mpfr_set_str_binary (x, "-0.10111001101001010000010111111011E32");
MPFR_ASSERTN(mpfr_cmp (y, x) == 0);
@@ -142,7 +142,7 @@ special (void)
"000000000000000000000E32");
mpfr_round (x, x);
if (mpfr_cmp_str (x, "0.1100110100100010000001111011010100000000000000" \
- "00000000000000000000000000000000000000E32", 2, GMP_RNDN))
+ "00000000000000000000000000000000000000E32", 2, MPFR_RNDN))
{
printf ("Rounding error when dest=src\n");
exit (1);
@@ -175,7 +175,7 @@ test_fct (double (*f)(double), int (*g)(), char *s, mp_rnd_t r)
{
printf ("test_against_libc: incorrect result for %s, rnd = %s,"
" d = %g\ngot ", s, mpfr_print_rnd_mode (r), d);
- mpfr_out_str (stdout, 10, 0, yy, GMP_RNDN);
+ mpfr_out_str (stdout, 10, 0, yy, MPFR_RNDN);
printf (" instead of %g\n", y);
exit (1);
}
@@ -189,7 +189,7 @@ test_fct (double (*f)(double), int (*g)(), char *s, mp_rnd_t r)
static void
test_against_libc (void)
{
- mp_rnd_t r = GMP_RNDN;
+ mp_rnd_t r = MPFR_RNDN;
#if HAVE_ROUND
TEST_FCT (round);
@@ -204,7 +204,7 @@ test_against_libc (void)
TEST_FCT (ceil);
#endif
#if HAVE_NEARBYINT
- for (r = 0; r < GMP_RND_MAX ; r++)
+ for (r = 0; r < MPFR_RND_MAX ; r++)
if (mpfr_set_machine_rnd_mode (r) == 0)
test_fct (&nearbyint, &mpfr_rint, "rint", r);
#endif
@@ -255,38 +255,38 @@ main (int argc, char *argv[])
mpfr_set_prec (x, s);
mpfr_set_prec (t, s);
mpfr_set_prec (u, s);
- if (mpfr_set_z (x, z, GMP_RNDN))
+ if (mpfr_set_z (x, z, MPFR_RNDN))
{
printf ("Error: mpfr_set_z should be exact (s = %u)\n",
(unsigned int) s);
exit (1);
}
if (randlimb () % 2)
- mpfr_neg (x, x, GMP_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN);
if (randlimb () % 2)
- mpfr_div_2ui (x, x, randlimb () % s, GMP_RNDN);
+ mpfr_div_2ui (x, x, randlimb () % s, MPFR_RNDN);
for (p = 2; p < 100; p++)
{
int trint;
mpfr_set_prec (y, p);
mpfr_set_prec (v, p);
- for (r = 0; r < GMP_RND_MAX ; r++)
+ for (r = 0; r < MPFR_RND_MAX ; r++)
for (trint = 0; trint < 3; trint++)
{
if (trint == 2)
inexact = mpfr_rint (y, x, (mp_rnd_t) r);
- else if (r == GMP_RNDN)
+ else if (r == MPFR_RNDN)
inexact = mpfr_round (y, x);
- else if (r == GMP_RNDZ)
+ else if (r == MPFR_RNDZ)
inexact = (trint ? mpfr_trunc (y, x) :
- mpfr_rint_trunc (y, x, GMP_RNDZ));
- else if (r == GMP_RNDU)
+ mpfr_rint_trunc (y, x, MPFR_RNDZ));
+ else if (r == MPFR_RNDU)
inexact = (trint ? mpfr_ceil (y, x) :
- mpfr_rint_ceil (y, x, GMP_RNDU));
- else /* r = GMP_RNDD */
+ mpfr_rint_ceil (y, x, MPFR_RNDU));
+ else /* r = MPFR_RNDD */
inexact = (trint ? mpfr_floor (y, x) :
- mpfr_rint_floor (y, x, GMP_RNDD));
- if (mpfr_sub (t, y, x, GMP_RNDN))
+ mpfr_rint_floor (y, x, MPFR_RNDD));
+ if (mpfr_sub (t, y, x, MPFR_RNDN))
err ("subtraction 1 should be exact",
s, x, y, p, (mp_rnd_t) r, trint, inexact);
sign_t = mpfr_cmp_ui (t, 0);
@@ -298,30 +298,30 @@ main (int argc, char *argv[])
if (inexact == 0)
continue; /* end of the test for exact results */
- if (((r == GMP_RNDD || (r == GMP_RNDZ && MPFR_SIGN (x) > 0))
+ if (((r == MPFR_RNDD || (r == MPFR_RNDZ && MPFR_SIGN (x) > 0))
&& inexact > 0) ||
- ((r == GMP_RNDU || (r == GMP_RNDZ && MPFR_SIGN (x) < 0))
+ ((r == MPFR_RNDU || (r == MPFR_RNDZ && MPFR_SIGN (x) < 0))
&& inexact < 0))
err ("wrong rounding direction",
s, x, y, p, (mp_rnd_t) r, trint, inexact);
if (inexact < 0)
{
- mpfr_add_ui (v, y, 1, GMP_RNDU);
+ mpfr_add_ui (v, y, 1, MPFR_RNDU);
if (mpfr_cmp (v, x) <= 0)
err ("representable integer between x and its "
"rounded value", s, x, y, p, (mp_rnd_t) r, trint, inexact);
}
else
{
- mpfr_sub_ui (v, y, 1, GMP_RNDD);
+ mpfr_sub_ui (v, y, 1, MPFR_RNDD);
if (mpfr_cmp (v, x) >= 0)
err ("representable integer between x and its "
"rounded value", s, x, y, p, (mp_rnd_t) r, trint, inexact);
}
- if (r == GMP_RNDN)
+ if (r == MPFR_RNDN)
{
int cmp;
- if (mpfr_sub (u, v, x, GMP_RNDN))
+ if (mpfr_sub (u, v, x, MPFR_RNDN))
err ("subtraction 2 should be exact",
s, x, y, p, (mp_rnd_t) r, trint, inexact);
cmp = mpfr_cmp_abs (t, u);
@@ -334,20 +334,20 @@ main (int argc, char *argv[])
representable integers. */
if (trint == 2)
{
- /* halfway case for mpfr_rint in GMP_RNDN rounding
+ /* halfway case for mpfr_rint in MPFR_RNDN rounding
mode: round to an even integer or mantissa. */
- mpfr_div_2ui (y, y, 1, GMP_RNDZ);
+ mpfr_div_2ui (y, y, 1, MPFR_RNDZ);
if (!mpfr_integer_p (y))
err ("halfway case for mpfr_rint, result isn't an"
" even integer", s, x, y, p, (mp_rnd_t) r, trint, inexact);
/* If floor(x) and ceil(x) aren't both representable
integers, the mantissa must be even. */
- mpfr_sub (v, v, y, GMP_RNDN);
- mpfr_abs (v, v, GMP_RNDN);
+ mpfr_sub (v, v, y, MPFR_RNDN);
+ mpfr_abs (v, v, MPFR_RNDN);
if (mpfr_cmp_ui (v, 1) != 0)
{
mpfr_div_2si (y, y, MPFR_EXP (y) - MPFR_PREC (y)
- + 1, GMP_RNDN);
+ + 1, MPFR_RNDN);
if (!mpfr_integer_p (y))
err ("halfway case for mpfr_rint, mantissa isn't"
" even", s, x, y, p, (mp_rnd_t) r, trint, inexact);
diff --git a/tests/troot.c b/tests/troot.c
index 789295753..f70f5144d 100644
--- a/tests/troot.c
+++ b/tests/troot.c
@@ -36,7 +36,7 @@ special (void)
/* root(NaN) = NaN */
mpfr_set_nan (x);
- mpfr_root (y, x, 17, GMP_RNDN);
+ mpfr_root (y, x, 17, MPFR_RNDN);
if (!mpfr_nan_p (y))
{
printf ("Error: root(NaN,17) <> NaN\n");
@@ -45,7 +45,7 @@ special (void)
/* root(+Inf) = +Inf */
mpfr_set_inf (x, 1);
- mpfr_root (y, x, 42, GMP_RNDN);
+ mpfr_root (y, x, 42, MPFR_RNDN);
if (!mpfr_inf_p (y) || mpfr_sgn (y) < 0)
{
printf ("Error: root(+Inf,42) <> +Inf\n");
@@ -54,7 +54,7 @@ special (void)
/* root(-Inf, 17) = -Inf */
mpfr_set_inf (x, -1);
- mpfr_root (y, x, 17, GMP_RNDN);
+ mpfr_root (y, x, 17, MPFR_RNDN);
if (!mpfr_inf_p (y) || mpfr_sgn (y) > 0)
{
printf ("Error: root(-Inf,17) <> -Inf\n");
@@ -62,7 +62,7 @@ special (void)
}
/* root(-Inf, 42) = NaN */
mpfr_set_inf (x, -1);
- mpfr_root (y, x, 42, GMP_RNDN);
+ mpfr_root (y, x, 42, MPFR_RNDN);
if (!mpfr_nan_p (y))
{
printf ("Error: root(-Inf,42) <> -Inf\n");
@@ -70,15 +70,15 @@ special (void)
}
/* root(+/-0) = +/-0 */
- mpfr_set_ui (x, 0, GMP_RNDN);
- mpfr_root (y, x, 17, GMP_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_root (y, x, 17, MPFR_RNDN);
if (mpfr_cmp_ui (y, 0) || mpfr_sgn (y) < 0)
{
printf ("Error: root(+0,17) <> +0\n");
exit (1);
}
- mpfr_neg (x, x, GMP_RNDN);
- mpfr_root (y, x, 42, GMP_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN);
+ mpfr_root (y, x, 42, MPFR_RNDN);
if (mpfr_cmp_ui (y, 0) || mpfr_sgn (y) > 0)
{
printf ("Error: root(-0,42) <> -0\n");
@@ -86,8 +86,8 @@ special (void)
}
mpfr_set_prec (x, 53);
- mpfr_set_str (x, "8.39005285514734966412e-01", 10, GMP_RNDN);
- mpfr_root (x, x, 3, GMP_RNDN);
+ mpfr_set_str (x, "8.39005285514734966412e-01", 10, MPFR_RNDN);
+ mpfr_root (x, x, 3, MPFR_RNDN);
if (mpfr_cmp_str1 (x, "9.43166207799662426048e-01"))
{
printf ("Error in root3 (1)\n");
@@ -100,7 +100,7 @@ special (void)
mpfr_set_prec (x, 32);
mpfr_set_prec (y, 32);
mpfr_set_str_binary (x, "0.10000100001100101001001001011001");
- mpfr_root (x, x, 3, GMP_RNDN);
+ mpfr_root (x, x, 3, MPFR_RNDN);
mpfr_set_str_binary (y, "0.11001101011000100111000111111001");
if (mpfr_cmp (x, y))
{
@@ -111,7 +111,7 @@ special (void)
mpfr_set_prec (x, 32);
mpfr_set_prec (y, 32);
mpfr_set_str_binary (x, "-0.1100001110110000010101011001011");
- mpfr_root (x, x, 3, GMP_RNDD);
+ mpfr_root (x, x, 3, MPFR_RNDD);
mpfr_set_str_binary (y, "-0.11101010000100100101000101011001");
if (mpfr_cmp (x, y))
{
@@ -122,7 +122,7 @@ special (void)
mpfr_set_prec (x, 82);
mpfr_set_prec (y, 27);
mpfr_set_str_binary (x, "0.1010001111011101011011000111001011001101100011110110010011011011011010011001100101e-7");
- mpfr_root (y, x, 3, GMP_RNDD);
+ mpfr_root (y, x, 3, MPFR_RNDD);
mpfr_set_str_binary (x, "0.101011110001110001000100011E-2");
if (mpfr_cmp (x, y))
{
@@ -133,7 +133,7 @@ special (void)
mpfr_set_prec (x, 204);
mpfr_set_prec (y, 38);
mpfr_set_str_binary (x, "0.101000000001101000000001100111111011111001110110100001111000100110100111001101100111110001110001011011010110010011100101111001111100001010010100111011101100000011011000101100010000000011000101001010001001E-5");
- mpfr_root (y, x, 3, GMP_RNDD);
+ mpfr_root (y, x, 3, MPFR_RNDD);
mpfr_set_str_binary (x, "0.10001001111010011011101000010110110010E-1");
if (mpfr_cmp (x, y))
{
@@ -145,11 +145,11 @@ special (void)
mpfr_set_prec (x, 53);
mpfr_set_prec (y, 53);
mpfr_set_str_binary (x, "1.0100001101101101001100110001001000000101001101100011E28");
- mpfr_root (y, x, 35, GMP_RNDN);
+ mpfr_root (y, x, 35, MPFR_RNDN);
mpfr_set_str_binary (x, "1.1100000010110101100011101011000010100001101100100011E0");
if (mpfr_cmp (x, y))
{
- printf ("Error in mpfr_root (y, x, 35, GMP_RNDN) for\n"
+ printf ("Error in mpfr_root (y, x, 35, MPFR_RNDN) for\n"
"x = 1.0100001101101101001100110001001000000101001101100011E28\n"
"Expected ");
mpfr_dump (x);
@@ -159,11 +159,11 @@ special (void)
}
/* Worst cases found on 2006-11-26 */
mpfr_set_str_binary (x, "1.1111010011101110001111010110000101110000110110101100E17");
- mpfr_root (y, x, 36, GMP_RNDD);
+ mpfr_root (y, x, 36, MPFR_RNDD);
mpfr_set_str_binary (x, "1.0110100111010001101001010111001110010100111111000010E0");
if (mpfr_cmp (x, y))
{
- printf ("Error in mpfr_root (y, x, 36, GMP_RNDD) for\n"
+ printf ("Error in mpfr_root (y, x, 36, MPFR_RNDD) for\n"
"x = 1.1111010011101110001111010110000101110000110110101100E17\n"
"Expected ");
mpfr_dump (x);
@@ -172,11 +172,11 @@ special (void)
exit (1);
}
mpfr_set_str_binary (x, "1.1100011101101101100010110001000001110001111110010000E23");
- mpfr_root (y, x, 36, GMP_RNDU);
+ mpfr_root (y, x, 36, MPFR_RNDU);
mpfr_set_str_binary (x, "1.1001010100001110000110111111100011011101110011000100E0");
if (mpfr_cmp (x, y))
{
- printf ("Error in mpfr_root (y, x, 36, GMP_RNDU) for\n"
+ printf ("Error in mpfr_root (y, x, 36, MPFR_RNDU) for\n"
"x = 1.1100011101101101100010110001000001110001111110010000E23\n"
"Expected ");
mpfr_dump (x);
@@ -186,8 +186,8 @@ special (void)
}
/* Check for k = 1 */
- mpfr_set_ui (x, 17, GMP_RNDN);
- i = mpfr_root (y, x, 1, GMP_RNDN);
+ mpfr_set_ui (x, 17, MPFR_RNDN);
+ i = mpfr_root (y, x, 1, MPFR_RNDN);
if (mpfr_cmp_ui (x, 17) || i != 0)
{
printf ("Error in root (17^(1/1))\n");
@@ -200,51 +200,51 @@ special (void)
For x = 1 => 1.
For x > 1, => +Inf.
For x < 0 => NaN. */
- i = mpfr_root (y, x, 0, GMP_RNDN);
+ i = mpfr_root (y, x, 0, MPFR_RNDN);
if (!MPFR_IS_INF (y) || !MPFR_IS_POS (y) || i != 0)
{
printf ("Error in root 17^(1/0)\n");
exit (1);
}
- mpfr_set_ui (x, 1, GMP_RNDN);
- i = mpfr_root (y, x, 0, GMP_RNDN);
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ i = mpfr_root (y, x, 0, MPFR_RNDN);
if (mpfr_cmp_ui (y, 1) || i != 0)
{
printf ("Error in root 1^(1/0)\n");
exit (1);
}
- mpfr_set_ui (x, 0, GMP_RNDN);
- i = mpfr_root (y, x, 0, GMP_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ i = mpfr_root (y, x, 0, MPFR_RNDN);
if (!MPFR_IS_ZERO (y) || !MPFR_IS_POS (y) || i != 0)
{
printf ("Error in root 0+^(1/0)\n");
exit (1);
}
MPFR_CHANGE_SIGN (x);
- i = mpfr_root (y, x, 0, GMP_RNDN);
+ i = mpfr_root (y, x, 0, MPFR_RNDN);
if (!MPFR_IS_ZERO (y) || !MPFR_IS_POS (y) || i != 0)
{
printf ("Error in root 0-^(1/0)\n");
exit (1);
}
- mpfr_set_ui_2exp (x, 17, -5, GMP_RNDD);
- i = mpfr_root (y, x, 0, GMP_RNDN);
+ mpfr_set_ui_2exp (x, 17, -5, MPFR_RNDD);
+ i = mpfr_root (y, x, 0, MPFR_RNDN);
if (!MPFR_IS_ZERO (y) || !MPFR_IS_POS (y) || i != 0)
{
printf ("Error in root (17/2^5)^(1/0)\n");
exit (1);
}
#endif
- mpfr_set_ui (x, 0, GMP_RNDN);
- i = mpfr_root (y, x, 0, GMP_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ i = mpfr_root (y, x, 0, MPFR_RNDN);
if (!MPFR_IS_NAN (y) || i != 0)
{
printf ("Error in root 0+^(1/0)\n");
exit (1);
}
/* Check for k==2 */
- mpfr_set_si (x, -17, GMP_RNDD);
- i = mpfr_root (y, x, 2, GMP_RNDN);
+ mpfr_set_si (x, -17, MPFR_RNDD);
+ i = mpfr_root (y, x, 2, MPFR_RNDN);
if (!MPFR_IS_NAN (y) || i != 0)
{
printf ("Error in root (-17)^(1/2)\n");
@@ -277,20 +277,20 @@ main (void)
for (p = 2; p < 100; p++)
{
mpfr_set_prec (x, p);
- for (r = 0; r < GMP_RND_MAX; r++)
+ for (r = 0; r < MPFR_RND_MAX; r++)
{
- mpfr_set_ui (x, 1, GMP_RNDN);
+ mpfr_set_ui (x, 1, MPFR_RNDN);
k = 2 + randlimb () % 4; /* 2 <= k <= 5 */
mpfr_root (x, x, k, (mp_rnd_t) r);
if (mpfr_cmp_ui (x, 1))
{
printf ("Error in mpfr_root(%lu) for x=1, rnd=%s\ngot ",
k, mpfr_print_rnd_mode ((mp_rnd_t) r));
- mpfr_out_str (stdout, 2, 0, x, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN);
printf ("\n");
exit (1);
}
- mpfr_set_si (x, -1, GMP_RNDN);
+ mpfr_set_si (x, -1, MPFR_RNDN);
if (k % 2)
{
mpfr_root (x, x, k, (mp_rnd_t) r);
@@ -298,7 +298,7 @@ main (void)
{
printf ("Error in mpfr_root(%lu) for x=-1, rnd=%s\ngot ",
k, mpfr_print_rnd_mode ((mp_rnd_t) r));
- mpfr_out_str (stdout, 2, 0, x, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN);
printf ("\n");
exit (1);
}
@@ -309,15 +309,15 @@ main (void)
int i;
for (i = -12; i <= 12; i++)
{
- mpfr_set_ui (x, 27, GMP_RNDN);
- mpfr_mul_2si (x, x, 3*i, GMP_RNDN);
- mpfr_root (x, x, 3, GMP_RNDN);
+ mpfr_set_ui (x, 27, MPFR_RNDN);
+ mpfr_mul_2si (x, x, 3*i, MPFR_RNDN);
+ mpfr_root (x, x, 3, MPFR_RNDN);
if (mpfr_cmp_si_2exp (x, 3, i))
{
printf ("Error in mpfr_root(3) for "
"x = 27.0 * 2^(%d), rnd=%s\ngot ",
3*i, mpfr_print_rnd_mode ((mp_rnd_t) r));
- mpfr_out_str (stdout, 2, 0, x, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN);
printf ("\ninstead of 3 * 2^(%d)\n", i);
exit (1);
}
diff --git a/tests/tround_prec.c b/tests/tround_prec.c
index 256ac64d3..59d5e5bed 100644
--- a/tests/tround_prec.c
+++ b/tests/tround_prec.c
@@ -36,83 +36,83 @@ main (void)
mpfr_init (x);
mpfr_set_nan (x);
- mpfr_prec_round (x, 2, GMP_RNDN);
+ mpfr_prec_round (x, 2, MPFR_RNDN);
MPFR_ASSERTN(mpfr_nan_p (x));
mpfr_set_inf (x, 1);
- mpfr_prec_round (x, 2, GMP_RNDN);
+ mpfr_prec_round (x, 2, MPFR_RNDN);
MPFR_ASSERTN(mpfr_inf_p (x) && mpfr_sgn (x) > 0);
mpfr_set_inf (x, -1);
- mpfr_prec_round (x, 2, GMP_RNDN);
+ mpfr_prec_round (x, 2, MPFR_RNDN);
MPFR_ASSERTN(mpfr_inf_p (x) && mpfr_sgn (x) < 0);
- mpfr_set_ui (x, 0, GMP_RNDN);
- mpfr_prec_round (x, 2, GMP_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_prec_round (x, 2, MPFR_RNDN);
MPFR_ASSERTN(mpfr_cmp_ui (x, 0) == 0 && MPFR_IS_POS(x));
- mpfr_set_ui (x, 0, GMP_RNDN);
- mpfr_neg (x, x, GMP_RNDN);
- mpfr_prec_round (x, 2, GMP_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN);
+ mpfr_prec_round (x, 2, MPFR_RNDN);
MPFR_ASSERTN(mpfr_cmp_ui (x, 0) == 0 && MPFR_IS_NEG(x));
emax = mpfr_get_emax ();
set_emax (0);
mpfr_set_prec (x, 3);
mpfr_set_str_binary (x, "0.111");
- mpfr_prec_round (x, 2, GMP_RNDN);
+ mpfr_prec_round (x, 2, MPFR_RNDN);
MPFR_ASSERTN(mpfr_inf_p (x) && mpfr_sgn (x) > 0);
set_emax (emax);
mpfr_set_prec (x, mp_bits_per_limb + 2);
- mpfr_set_ui (x, 1, GMP_RNDN);
+ mpfr_set_ui (x, 1, MPFR_RNDN);
mpfr_nextbelow (x);
- mpfr_prec_round (x, mp_bits_per_limb + 1, GMP_RNDN);
+ mpfr_prec_round (x, mp_bits_per_limb + 1, MPFR_RNDN);
MPFR_ASSERTN(mpfr_cmp_ui (x, 1) == 0);
mpfr_set_prec (x, 3);
- mpfr_set_ui (x, 5, GMP_RNDN);
- mpfr_prec_round (x, 2, GMP_RNDN);
+ mpfr_set_ui (x, 5, MPFR_RNDN);
+ mpfr_prec_round (x, 2, MPFR_RNDN);
if (mpfr_cmp_ui(x, 4))
{
printf ("Error in tround: got ");
- mpfr_out_str (stdout, 10, 0, x, GMP_RNDN);
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN);
printf (" instead of 4\n");
exit (1);
}
/* check case when reallocation is needed */
mpfr_set_prec (x, 3);
- mpfr_set_ui (x, 5, GMP_RNDN); /* exact */
- mpfr_prec_round (x, mp_bits_per_limb + 1, GMP_RNDN);
+ mpfr_set_ui (x, 5, MPFR_RNDN); /* exact */
+ mpfr_prec_round (x, mp_bits_per_limb + 1, MPFR_RNDN);
if (mpfr_cmp_ui(x, 5))
{
printf ("Error in tround: got ");
- mpfr_out_str (stdout, 10, 0, x, GMP_RNDN);
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN);
printf (" instead of 5\n");
exit (1);
}
mpfr_clear(x);
mpfr_init2 (x, 3);
- mpfr_set_si (x, -5, GMP_RNDN); /* exact */
- mpfr_prec_round (x, mp_bits_per_limb + 1, GMP_RNDN);
+ mpfr_set_si (x, -5, MPFR_RNDN); /* exact */
+ mpfr_prec_round (x, mp_bits_per_limb + 1, MPFR_RNDN);
if (mpfr_cmp_si(x, -5))
{
printf ("Error in tround: got ");
- mpfr_out_str (stdout, 10, 0, x, GMP_RNDN);
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN);
printf (" instead of -5\n");
exit (1);
}
/* check case when new precision needs less limbs */
mpfr_set_prec (x, mp_bits_per_limb + 1);
- mpfr_set_ui (x, 5, GMP_RNDN); /* exact */
- mpfr_prec_round (x, 3, GMP_RNDN); /* exact */
+ mpfr_set_ui (x, 5, MPFR_RNDN); /* exact */
+ mpfr_prec_round (x, 3, MPFR_RNDN); /* exact */
if (mpfr_cmp_ui(x, 5))
{
printf ("Error in tround: got ");
- mpfr_out_str (stdout, 10, 0, x, GMP_RNDN);
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN);
printf (" instead of 5\n");
exit (1);
}
diff --git a/tests/tsec.c b/tests/tsec.c
index 005395978..d8032d374 100644
--- a/tests/tsec.c
+++ b/tests/tsec.c
@@ -38,7 +38,7 @@ check_specials (void)
mpfr_init2 (y, 123L);
mpfr_set_nan (x);
- mpfr_sec (y, x, GMP_RNDN);
+ mpfr_sec (y, x, MPFR_RNDN);
if (! mpfr_nan_p (y))
{
printf ("Error: sec(NaN) != NaN\n");
@@ -46,7 +46,7 @@ check_specials (void)
}
mpfr_set_inf (x, 1);
- mpfr_sec (y, x, GMP_RNDN);
+ mpfr_sec (y, x, MPFR_RNDN);
if (! mpfr_nan_p (y))
{
printf ("Error: sec(Inf) != NaN\n");
@@ -54,7 +54,7 @@ check_specials (void)
}
mpfr_set_inf (x, -1);
- mpfr_sec (y, x, GMP_RNDN);
+ mpfr_sec (y, x, MPFR_RNDN);
if (! mpfr_nan_p (y))
{
printf ("Error: sec(-Inf) != NaN\n");
@@ -62,15 +62,15 @@ check_specials (void)
}
/* sec(+/-0) = 1 */
- mpfr_set_ui (x, 0, GMP_RNDN);
- mpfr_sec (y, x, GMP_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_sec (y, x, MPFR_RNDN);
if (mpfr_cmp_ui (y, 1))
{
printf ("Error: sec(+0) != 1\n");
exit (1);
}
- mpfr_neg (x, x, GMP_RNDN);
- mpfr_sec (y, x, GMP_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN);
+ mpfr_sec (y, x, MPFR_RNDN);
if (mpfr_cmp_ui (y, 1))
{
printf ("Error: sec(-0) != 1\n");
@@ -95,13 +95,13 @@ overflowed_sec0 (void)
for (emax = -1; emax <= 0; emax++)
{
- mpfr_set_ui_2exp (y, 1, emax, GMP_RNDN);
+ mpfr_set_ui_2exp (y, 1, emax, MPFR_RNDN);
mpfr_nextbelow (y);
set_emax (emax); /* 1 is not representable. */
for (i = -1; i <= 1; i++)
RND_LOOP (rnd)
{
- mpfr_set_si_2exp (x, i, -512 * ABS (i), GMP_RNDN);
+ mpfr_set_si_2exp (x, i, -512 * ABS (i), MPFR_RNDN);
mpfr_clear_flags ();
inex = mpfr_sec (x, x, (mp_rnd_t) rnd);
if (! mpfr_overflow_p ())
@@ -111,7 +111,7 @@ overflowed_sec0 (void)
i, mpfr_print_rnd_mode ((mp_rnd_t) rnd));
err = 1;
}
- if (rnd == GMP_RNDZ || rnd == GMP_RNDD)
+ if (rnd == MPFR_RNDZ || rnd == MPFR_RNDD)
{
if (inex >= 0)
{
diff --git a/tests/tsech.c b/tests/tsech.c
index 6e9bf970d..bb2e44679 100644
--- a/tests/tsech.c
+++ b/tests/tsech.c
@@ -39,7 +39,7 @@ check_specials (void)
mpfr_init2 (y, 123L);
mpfr_set_nan (x);
- mpfr_sech (y, x, GMP_RNDN);
+ mpfr_sech (y, x, MPFR_RNDN);
if (! mpfr_nan_p (y))
{
printf ("Error: sech(NaN) != NaN\n");
@@ -47,7 +47,7 @@ check_specials (void)
}
mpfr_set_inf (x, 1);
- mpfr_sech (y, x, GMP_RNDN);
+ mpfr_sech (y, x, MPFR_RNDN);
if (! (MPFR_IS_ZERO (y) && MPFR_SIGN (y) > 0))
{
printf ("Error: sech(+Inf) != +0\n");
@@ -55,7 +55,7 @@ check_specials (void)
}
mpfr_set_inf (x, -1);
- mpfr_sech (y, x, GMP_RNDN);
+ mpfr_sech (y, x, MPFR_RNDN);
if (! (MPFR_IS_ZERO (y) && MPFR_SIGN (y) > 0))
{
printf ("Error: sech(-Inf) != +0\n");
@@ -63,15 +63,15 @@ check_specials (void)
}
/* sec(+/-0) = 1 */
- mpfr_set_ui (x, 0, GMP_RNDN);
- mpfr_sech (y, x, GMP_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_sech (y, x, MPFR_RNDN);
if (mpfr_cmp_ui (y, 1))
{
printf ("Error: sech(+0) != 1\n");
exit (1);
}
- mpfr_neg (x, x, GMP_RNDN);
- mpfr_sech (y, x, GMP_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN);
+ mpfr_sech (y, x, MPFR_RNDN);
if (mpfr_cmp_ui (y, 1))
{
printf ("Error: sech(-0) != 1\n");
@@ -79,15 +79,15 @@ check_specials (void)
}
/* check huge x */
- mpfr_set_str (x, "8e8", 10, GMP_RNDN);
- mpfr_sech (y, x, GMP_RNDN);
+ mpfr_set_str (x, "8e8", 10, MPFR_RNDN);
+ mpfr_sech (y, x, MPFR_RNDN);
if (! (mpfr_zero_p (y) && MPFR_SIGN (y) > 0))
{
printf ("Error: sech(8e8) != +0\n");
exit (1);
}
- mpfr_set_str (x, "-8e8", 10, GMP_RNDN);
- mpfr_sech (y, x, GMP_RNDN);
+ mpfr_set_str (x, "-8e8", 10, MPFR_RNDN);
+ mpfr_sech (y, x, MPFR_RNDN);
if (! (mpfr_zero_p (y) && MPFR_SIGN (y) > 0))
{
printf ("Error: sech(-8e8) != +0\n");
@@ -112,17 +112,17 @@ overflowed_sech0 (void)
for (emax = -1; emax <= 0; emax++)
{
- mpfr_set_ui_2exp (y, 1, emax, GMP_RNDN);
+ mpfr_set_ui_2exp (y, 1, emax, MPFR_RNDN);
mpfr_nextbelow (y);
set_emax (emax); /* 1 is not representable. */
/* and if emax < 0, 1 - eps is not representable either. */
for (i = -1; i <= 1; i++)
RND_LOOP (rnd)
{
- mpfr_set_si_2exp (x, i, -512 * ABS (i), GMP_RNDN);
+ mpfr_set_si_2exp (x, i, -512 * ABS (i), MPFR_RNDN);
mpfr_clear_flags ();
inex = mpfr_sech (x, x, (mp_rnd_t) rnd);
- if ((i == 0 || emax < 0 || rnd == GMP_RNDN || rnd == GMP_RNDU) &&
+ if ((i == 0 || emax < 0 || rnd == MPFR_RNDN || rnd == MPFR_RNDU) &&
! mpfr_overflow_p ())
{
printf ("Error in overflowed_sech0 (i = %d, rnd = %s):\n"
@@ -130,7 +130,7 @@ overflowed_sech0 (void)
i, mpfr_print_rnd_mode ((mp_rnd_t) rnd));
err = 1;
}
- if (rnd == GMP_RNDZ || rnd == GMP_RNDD)
+ if (rnd == MPFR_RNDZ || rnd == MPFR_RNDD)
{
if (inex >= 0)
{
diff --git a/tests/tset.c b/tests/tset.c
index 2212236ce..740a4e721 100644
--- a/tests/tset.c
+++ b/tests/tset.c
@@ -33,7 +33,7 @@ check_neg_special (void)
mpfr_init (x);
MPFR_SET_NAN (x);
mpfr_clear_nanflag ();
- mpfr_neg (x, x, GMP_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN);
if (!mpfr_nanflag_p () )
{
printf("ERROR: neg (NaN) doesn't set Nan flag.\n");
@@ -57,30 +57,30 @@ main (void)
tests_start_mpfr ();
/* check prototypes of mpfr_init_set_* */
- inexact = mpfr_init_set_si (x, -1, GMP_RNDN);
- inexact = mpfr_init_set (y, x, GMP_RNDN);
- inexact = mpfr_init_set_ui (z, 1, GMP_RNDN);
- inexact = mpfr_init_set_d (u, 1.0, GMP_RNDN);
+ inexact = mpfr_init_set_si (x, -1, MPFR_RNDN);
+ inexact = mpfr_init_set (y, x, MPFR_RNDN);
+ inexact = mpfr_init_set_ui (z, 1, MPFR_RNDN);
+ inexact = mpfr_init_set_d (u, 1.0, MPFR_RNDN);
mpfr_set_nan (x);
- (mpfr_set) (y, x, GMP_RNDN);
+ (mpfr_set) (y, x, MPFR_RNDN);
MPFR_ASSERTN(mpfr_nan_p (y));
mpfr_set_inf (x, 1);
- mpfr_set (y, x, GMP_RNDN);
+ mpfr_set (y, x, MPFR_RNDN);
MPFR_ASSERTN(mpfr_inf_p (y) && mpfr_sgn (y) > 0);
mpfr_set_inf (x, -1);
- mpfr_set (y, x, GMP_RNDN);
+ mpfr_set (y, x, MPFR_RNDN);
MPFR_ASSERTN(mpfr_inf_p (y) && mpfr_sgn (y) < 0);
- mpfr_set_ui (x, 0, GMP_RNDN);
- mpfr_set (y, x, GMP_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_set (y, x, MPFR_RNDN);
MPFR_ASSERTN(mpfr_cmp_ui (y, 0) == 0 && MPFR_IS_POS(y));
- mpfr_set_ui (x, 0, GMP_RNDN);
- mpfr_neg (x, x, GMP_RNDN);
- mpfr_set (y, x, GMP_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN);
+ mpfr_set (y, x, MPFR_RNDN);
MPFR_ASSERTN(mpfr_cmp_ui (y, 0) == 0 && MPFR_IS_NEG(y));
emax = mpfr_get_emax ();
@@ -88,7 +88,7 @@ main (void)
mpfr_set_prec (x, 3);
mpfr_set_str_binary (x, "0.111");
mpfr_set_prec (y, 2);
- mpfr_set (y, x, GMP_RNDU);
+ mpfr_set (y, x, MPFR_RNDU);
if (!(MPFR_IS_INF (y) && MPFR_SIGN (y) > 0))
{
printf ("Error for y=x=0.111 with px=3, py=2 and emax=0\nx=");
@@ -104,11 +104,11 @@ main (void)
mpfr_set_prec (y, 11);
mpfr_set_str_binary (y, "0.11111111100E-8");
mpfr_set_prec (x, 2);
- mpfr_set (x, y, GMP_RNDN);
+ mpfr_set (x, y, MPFR_RNDN);
mpfr_set_str_binary (y, "1.0E-8");
if (mpfr_cmp (x, y))
{
- printf ("Error for y=0.11111111100E-8, prec=2, rnd=GMP_RNDN\n");
+ printf ("Error for y=0.11111111100E-8, prec=2, rnd=MPFR_RNDN\n");
exit (1);
}
@@ -117,11 +117,11 @@ main (void)
mpfr_set_prec (x, p);
mpfr_urandomb (x, RANDS);
if (randlimb () % 2)
- mpfr_neg (x, x, GMP_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN);
for (q=2; q<2*p; q++)
{
mpfr_set_prec (y, q);
- for (rnd = 0; rnd < GMP_RND_MAX; rnd++)
+ for (rnd = 0; rnd < MPFR_RND_MAX; rnd++)
{
inexact = mpfr_set (y, x, (mp_rnd_t) rnd);
cmp = mpfr_cmp (y, x);
diff --git a/tests/tset_d.c b/tests/tset_d.c
index 85721f2fb..935eed8a5 100644
--- a/tests/tset_d.c
+++ b/tests/tset_d.c
@@ -66,7 +66,7 @@ main (int argc, char *argv[])
mpfr_init (x);
mpfr_set_nan (x);
- d = mpfr_get_d (x, GMP_RNDN);
+ d = mpfr_get_d (x, MPFR_RNDN);
if (! DOUBLE_ISNAN (d))
{
printf ("ERROR for NAN (1)\n");
@@ -77,8 +77,8 @@ main (int argc, char *argv[])
#endif
exit (1);
}
- mpfr_set_ui (x, 0, GMP_RNDN);
- mpfr_set_d (x, d, GMP_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_set_d (x, d, MPFR_RNDN);
if (! mpfr_nan_p (x))
{
printf ("ERROR for NAN (2)\n");
@@ -91,10 +91,10 @@ main (int argc, char *argv[])
}
d = 0.0;
- mpfr_set_d (x, d, GMP_RNDN);
+ mpfr_set_d (x, d, MPFR_RNDN);
MPFR_ASSERTN(mpfr_cmp_ui (x, 0) == 0 && MPFR_IS_POS(x));
d = -d;
- mpfr_set_d (x, d, GMP_RNDN);
+ mpfr_set_d (x, d, MPFR_RNDN);
if (mpfr_cmp_ui (x, 0) != 0 || MPFR_IS_POS(x))
{
printf ("Error in mpfr_set_d on -0\n");
@@ -102,15 +102,15 @@ main (int argc, char *argv[])
}
mpfr_set_inf (x, 1);
- d = mpfr_get_d (x, GMP_RNDN);
- mpfr_set_ui (x, 0, GMP_RNDN);
- mpfr_set_d (x, d, GMP_RNDN);
+ d = mpfr_get_d (x, MPFR_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_set_d (x, d, MPFR_RNDN);
MPFR_ASSERTN(mpfr_inf_p (x) && mpfr_sgn (x) > 0);
mpfr_set_inf (x, -1);
- d = mpfr_get_d (x, GMP_RNDN);
- mpfr_set_ui (x, 0, GMP_RNDN);
- mpfr_set_d (x, d, GMP_RNDN);
+ d = mpfr_get_d (x, MPFR_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_set_d (x, d, MPFR_RNDN);
MPFR_ASSERTN(mpfr_inf_p (x) && mpfr_sgn (x) < 0);
mpfr_set_prec (x, 2);
@@ -120,12 +120,12 @@ main (int argc, char *argv[])
for (n=0; n<52; n++, d /= 2.0)
if (d != 0.0) /* should be 2^(-1022-n) */
{
- mpfr_set_d (x, d, GMP_RNDN);
+ mpfr_set_d (x, d, MPFR_RNDN);
if (mpfr_cmp_ui_2exp (x, 1, -1022-n))
{
printf ("Wrong result for d=2^(%ld), ", -1022-n);
printf ("got ");
- mpfr_out_str (stdout, 10, 10, x, GMP_RNDN);
+ mpfr_out_str (stdout, 10, 10, x, MPFR_RNDN);
printf ("\n");
mpfr_print_binary (x);
puts ("");
@@ -135,14 +135,14 @@ main (int argc, char *argv[])
/* checks that rounds to nearest sets the last
bit to zero in case of equal distance */
- mpfr_set_d (x, 5.0, GMP_RNDN);
+ mpfr_set_d (x, 5.0, MPFR_RNDN);
if (mpfr_cmp_ui (x, 4))
{
printf ("Error in tset_d: expected 4.0, got ");
mpfr_print_binary (x); putchar('\n');
exit (1);
}
- mpfr_set_d (x, -5.0, GMP_RNDN);
+ mpfr_set_d (x, -5.0, MPFR_RNDN);
if (mpfr_cmp_si (x, -4))
{
printf ("Error in tset_d: expected -4.0, got ");
@@ -150,7 +150,7 @@ main (int argc, char *argv[])
exit (1);
}
- mpfr_set_d (x, 9.84891017624509146344e-01, GMP_RNDU);
+ mpfr_set_d (x, 9.84891017624509146344e-01, MPFR_RNDU);
if (mpfr_cmp_ui (x, 1))
{
printf ("Error in tset_d: expected 1.0, got ");
diff --git a/tests/tset_exp.c b/tests/tset_exp.c
index bfd50a1a5..c62df48b0 100644
--- a/tests/tset_exp.c
+++ b/tests/tset_exp.c
@@ -39,7 +39,7 @@ main (int argc, char *argv[])
mpfr_init (x);
- mpfr_set_ui (x, 1, GMP_RNDN);
+ mpfr_set_ui (x, 1, MPFR_RNDN);
ret = mpfr_set_exp (x, 2);
MPFR_ASSERTN(ret == 0 && mpfr_cmp_ui (x, 2) == 0);
diff --git a/tests/tset_f.c b/tests/tset_f.c
index d9fcae02c..aeca58e0a 100644
--- a/tests/tset_f.c
+++ b/tests/tset_f.c
@@ -43,9 +43,9 @@ main (void)
mpf_set_d (y, 0.0);
/* check prototype of mpfr_init_set_f */
- mpfr_init_set_f (x, y, GMP_RNDN);
+ mpfr_init_set_f (x, y, MPFR_RNDN);
mpfr_set_prec (x, 100);
- mpfr_set_f (x, y, GMP_RNDN);
+ mpfr_set_f (x, y, MPFR_RNDN);
mpf_urandomb (y, RANDS, 10 * GMP_NUMB_BITS);
mpfr_set_f (x, y, RND_RAND ());
@@ -56,10 +56,10 @@ main (void)
mpfr_init2 (u, 256);
mpfr_set_str (u,
"7.f10872b020c49ba5e353f7ced916872b020c49ba5e353f7ced916872b020c498@2",
- 16, GMP_RNDN);
+ 16, MPFR_RNDN);
mpf_set_str (y, "2033033E-3", 10); /* avoid 2033.033 which is
locale-sensitive */
- mpfr_set_f (x, y, GMP_RNDN);
+ mpfr_set_f (x, y, MPFR_RNDN);
if (mpfr_cmp (x, u))
{
printf ("mpfr_set_f failed for y=2033033E-3\n");
@@ -67,8 +67,8 @@ main (void)
}
mpf_set_str (y, "-2033033E-3", 10); /* avoid -2033.033 which is
locale-sensitive */
- mpfr_set_f (x, y, GMP_RNDN);
- mpfr_neg (u, u, GMP_RNDN);
+ mpfr_set_f (x, y, MPFR_RNDN);
+ mpfr_neg (u, u, MPFR_RNDN);
if (mpfr_cmp (x, u))
{
printf ("mpfr_set_f failed for y=-2033033E-3\n");
@@ -79,7 +79,7 @@ main (void)
mpf_set_str (y, "1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111", -2);
mpf_mul_2exp (y, y, 600);
mpfr_set_prec (x, 300);
- mpfr_set_f (x, y, GMP_RNDN);
+ mpfr_set_f (x, y, MPFR_RNDN);
if (mpfr_check (x) == 0)
{
printf ("Error in mpfr_set_f: corrupted result\n");
@@ -95,7 +95,7 @@ main (void)
mpf_set_prec (z, pr);
mpf_urandomb (z, RANDS, z->_mp_prec);
mpfr_set_prec (u, ((pr / BITS_PER_MP_LIMB + 1) * BITS_PER_MP_LIMB));
- mpfr_set_f (u, z, GMP_RNDN);
+ mpfr_set_f (u, z, MPFR_RNDN);
if (mpfr_cmp_f (u , z) != 0)
{
printf ("Error in mpfr_set_f:\n");
@@ -103,21 +103,21 @@ main (void)
mpf_out_str (stdout, 16, 0, z);
printf ("\nmpfr(precision=%lu)=",
((pr / BITS_PER_MP_LIMB + 1) * BITS_PER_MP_LIMB));
- mpfr_out_str (stdout, 16, 0, u, GMP_RNDN);
+ mpfr_out_str (stdout, 16, 0, u, MPFR_RNDN);
putchar ('\n');
exit (1);
}
mpfr_set_prec (x, pr);
- mpfr_set_f (x, z, GMP_RNDN);
- mpfr_sub (u, u, x, GMP_RNDN);
- mpfr_abs (u, u, GMP_RNDN);
+ mpfr_set_f (x, z, MPFR_RNDN);
+ mpfr_sub (u, u, x, MPFR_RNDN);
+ mpfr_abs (u, u, MPFR_RNDN);
if (mpfr_cmp_ui_2exp (u, 1, -pr - 1) > 0)
{
printf ("Error in mpfr_set_f: precision=%lu\n", pr);
printf ("mpf =");
mpf_out_str (stdout, 16, 0, z);
printf ("\nmpfr=");
- mpfr_out_str (stdout, 16, 0, x, GMP_RNDN);
+ mpfr_out_str (stdout, 16, 0, x, MPFR_RNDN);
putchar ('\n');
exit (1);
}
@@ -127,13 +127,13 @@ main (void)
mpfr_set_prec (x, 53);
mpf_set_prec (y, 53);
mpf_set_ui (y, 0);
- for (r = 0 ; r < GMP_RND_MAX ; r++)
+ for (r = 0 ; r < MPFR_RND_MAX ; r++)
{
int i;
for (i = -1; i <= 1; i++)
{
if (i)
- mpfr_set_si (x, i, GMP_RNDN);
+ mpfr_set_si (x, i, MPFR_RNDN);
inexact = mpfr_set_f (x, y, (mp_rnd_t) r);
if (!MPFR_IS_ZERO(x) || !MPFR_IS_POS(x) || inexact)
{
@@ -151,19 +151,19 @@ main (void)
for (r = 0; r < mp_bits_per_limb; r++)
{
mpfr_urandomb (x, RANDS); /* to fill low limbs with random data */
- inexact = mpfr_set_f (x, y, GMP_RNDN);
+ inexact = mpfr_set_f (x, y, MPFR_RNDN);
MPFR_ASSERTN(inexact == 0 && mpfr_cmp_ui_2exp (x, 1, r) == 0);
mpf_mul_2exp (y, y, 1);
}
mpf_set_ui (y, 1);
mpf_mul_2exp (y, y, ULONG_MAX);
- mpfr_set_f (x, y, GMP_RNDN);
- mpfr_set_ui (u, 1, GMP_RNDN);
- mpfr_mul_2ui (u, u, ULONG_MAX, GMP_RNDN);
+ mpfr_set_f (x, y, MPFR_RNDN);
+ mpfr_set_ui (u, 1, MPFR_RNDN);
+ mpfr_mul_2ui (u, u, ULONG_MAX, MPFR_RNDN);
if (!mpfr_equal_p (x, u))
{
- printf ("Error: mpfr_set_f (x, y, GMP_RNDN) for y = 2^ULONG_MAX\n");
+ printf ("Error: mpfr_set_f (x, y, MPFR_RNDN) for y = 2^ULONG_MAX\n");
exit (1);
}
@@ -174,11 +174,11 @@ main (void)
{
mpf_set_ui (y, 1);
mpf_mul_2exp (y, y, emax);
- mpfr_set_f (x, y, GMP_RNDN);
- mpfr_set_ui_2exp (u, 1, emax, GMP_RNDN);
+ mpfr_set_f (x, y, MPFR_RNDN);
+ mpfr_set_ui_2exp (u, 1, emax, MPFR_RNDN);
if (!mpfr_equal_p (x, u))
{
- printf ("Error: mpfr_set_f (x, y, GMP_RNDN) for y = 2^emax\n");
+ printf ("Error: mpfr_set_f (x, y, MPFR_RNDN) for y = 2^emax\n");
exit (1);
}
}
@@ -188,11 +188,11 @@ main (void)
{
mpf_set_ui (y, 1);
mpf_mul_2exp (y, y, emax - 1);
- mpfr_set_f (x, y, GMP_RNDN);
- mpfr_set_ui_2exp (u, 1, emax - 1, GMP_RNDN);
+ mpfr_set_f (x, y, MPFR_RNDN);
+ mpfr_set_ui_2exp (u, 1, emax - 1, MPFR_RNDN);
if (!mpfr_equal_p (x, u))
{
- printf ("Error: mpfr_set_f (x, y, GMP_RNDN) for y = 2^(emax-1)\n");
+ printf ("Error: mpfr_set_f (x, y, MPFR_RNDN) for y = 2^(emax-1)\n");
exit (1);
}
}
diff --git a/tests/tset_ld.c b/tests/tset_ld.c
index 378e77f0e..ab5636dbe 100644
--- a/tests/tset_ld.c
+++ b/tests/tset_ld.c
@@ -68,7 +68,7 @@ check_set_get (long double d, mpfr_t x)
long double e;
int inex;
- for (r = 0; r < GMP_RND_MAX; r++)
+ for (r = 0; r < MPFR_RND_MAX; r++)
{
inex = mpfr_set_ld (x, d, (mp_rnd_t) r);
if (inex != 0)
@@ -88,7 +88,7 @@ check_set_get (long double d, mpfr_t x)
printf (" r=%d\n", r);
printf (" d=%1.30Le get_ld(set_ld(d))=%1.30Le\n", d, e);
ld_trace (" d", d);
- printf (" x="); mpfr_out_str (NULL, 16, 0, x, GMP_RNDN);
+ printf (" x="); mpfr_out_str (NULL, 16, 0, x, MPFR_RNDN);
printf ("\n");
ld_trace (" e", e);
#ifdef MPFR_NANISNAN
@@ -113,28 +113,28 @@ test_small (void)
mpfr_init2 (z, 64);
/* x = 11906603631607553907/2^(16381+64) */
- mpfr_set_str (x, "0.1010010100111100110000001110101101000111010110000001111101110011E-16381", 2, GMP_RNDN);
- d = mpfr_get_ld (x, GMP_RNDN); /* infinite loop? */
- mpfr_set_ld (y, d, GMP_RNDN);
- mpfr_sub (z, x, y, GMP_RNDN);
- mpfr_abs (z, z, GMP_RNDN);
+ mpfr_set_str (x, "0.1010010100111100110000001110101101000111010110000001111101110011E-16381", 2, MPFR_RNDN);
+ d = mpfr_get_ld (x, MPFR_RNDN); /* infinite loop? */
+ mpfr_set_ld (y, d, MPFR_RNDN);
+ mpfr_sub (z, x, y, MPFR_RNDN);
+ mpfr_abs (z, z, MPFR_RNDN);
mpfr_clear_erangeflag ();
/* If long double = double, d should be equal to 0;
in this case, everything is OK. */
- if (d != 0 && (mpfr_cmp_str (z, "1E-16434", 2, GMP_RNDN) > 0 ||
+ if (d != 0 && (mpfr_cmp_str (z, "1E-16434", 2, MPFR_RNDN) > 0 ||
mpfr_erangeflag_p ()))
{
printf ("Error with x = ");
- mpfr_out_str (NULL, 10, 21, x, GMP_RNDN);
+ mpfr_out_str (NULL, 10, 21, x, MPFR_RNDN);
printf (" = ");
- mpfr_out_str (NULL, 16, 0, x, GMP_RNDN);
+ mpfr_out_str (NULL, 16, 0, x, MPFR_RNDN);
printf ("\n -> d = %.21Lg", d);
printf ("\n -> y = ");
- mpfr_out_str (NULL, 10, 21, y, GMP_RNDN);
+ mpfr_out_str (NULL, 10, 21, y, MPFR_RNDN);
printf (" = ");
- mpfr_out_str (NULL, 16, 0, y, GMP_RNDN);
+ mpfr_out_str (NULL, 16, 0, y, MPFR_RNDN);
printf ("\n -> |x-y| = ");
- mpfr_out_str (NULL, 16, 0, z, GMP_RNDN);
+ mpfr_out_str (NULL, 16, 0, z, MPFR_RNDN);
printf ("\n");
exit (1);
}
@@ -171,7 +171,7 @@ main (int argc, char *argv[])
/* check NaN */
mpfr_set_nan (x);
- d = mpfr_get_ld (x, GMP_RNDN);
+ d = mpfr_get_ld (x, MPFR_RNDN);
check_set_get (d, x);
/* check +0.0 and -0.0 */
@@ -181,7 +181,7 @@ main (int argc, char *argv[])
check_set_get (d, x);
/* check that the sign of -0.0 is set */
- mpfr_set_ld (x, DBL_NEG_ZERO, GMP_RNDN);
+ mpfr_set_ld (x, DBL_NEG_ZERO, MPFR_RNDN);
if (MPFR_SIGN(x) > 0)
{
printf ("Error: sign of -0.0 is not set correctly\n");
@@ -193,12 +193,12 @@ main (int argc, char *argv[])
/* check +Inf */
mpfr_set_inf (x, 1);
- d = mpfr_get_ld (x, GMP_RNDN);
+ d = mpfr_get_ld (x, MPFR_RNDN);
check_set_get (d, x);
/* check -Inf */
mpfr_set_inf (x, -1);
- d = mpfr_get_ld (x, GMP_RNDN);
+ d = mpfr_get_ld (x, MPFR_RNDN);
check_set_get (d, x);
/* check the largest power of two */
@@ -235,7 +235,7 @@ main (int argc, char *argv[])
for (i = 0; i < 10000; i++)
{
mpfr_urandomb (x, RANDS);
- d = mpfr_get_ld (x, GMP_RNDN);
+ d = mpfr_get_ld (x, MPFR_RNDN);
check_set_get (d, x);
}
@@ -243,11 +243,11 @@ main (int argc, char *argv[])
emax = mpfr_get_emax ();
mpfr_set_prec (x, 2);
set_emax (1);
- mpfr_set_ld (x, (long double) 2.0, GMP_RNDN);
+ mpfr_set_ld (x, (long double) 2.0, MPFR_RNDN);
MPFR_ASSERTN(mpfr_inf_p (x) && mpfr_sgn (x) > 0);
for (d = (long double) 2.0, i = 0; i < 13; i++, d *= d);
/* now d = 2^8192 */
- mpfr_set_ld (x, d, GMP_RNDN);
+ mpfr_set_ld (x, d, MPFR_RNDN);
MPFR_ASSERTN(mpfr_inf_p (x) && mpfr_sgn (x) > 0);
set_emax (emax);
diff --git a/tests/tset_q.c b/tests/tset_q.c
index 2e008ebbf..3c873ad53 100644
--- a/tests/tset_q.c
+++ b/tests/tset_q.c
@@ -44,7 +44,7 @@ check (long int n, long int d, mp_rnd_t rnd, const char *ys)
printf ("Error for q=%ld/%ld and rnd=%s\n", n, d,
mpfr_print_rnd_mode (rnd));
printf ("correct result is %s, mpfr_set_q gives ", ys);
- mpfr_out_str(stdout, 10, 0, x, GMP_RNDN);
+ mpfr_out_str(stdout, 10, 0, x, MPFR_RNDN);
putchar('\n');
exit (1);
}
@@ -81,7 +81,7 @@ static void check0(void)
mpfr_init (x);
mpq_init (y);
mpq_set_si (y, 0, 1);
- for (r = 0; r < GMP_RND_MAX; r++)
+ for (r = 0; r < MPFR_RND_MAX; r++)
{
inexact = mpfr_set_q(x, y, (mp_rnd_t) r);
if (!MPFR_IS_ZERO(x) || !MPFR_IS_POS(x) || inexact)
@@ -100,15 +100,15 @@ main (void)
{
tests_start_mpfr ();
- check(-1647229822, 40619231, GMP_RNDZ, "-4.055295438754120596e1");
- check(-148939696, 1673285490, GMP_RNDZ, "-8.9010331404953485501e-2");
- check(-441322590, 273662545, GMP_RNDZ, "-1.6126525096812205362");
- check(-1631156895, 1677687197, GMP_RNDU, "-9.722652100563177191e-1");
- check(2141332571, 3117601, GMP_RNDZ, "6.8685267004982347316e2");
- check(75504803, 400207282, GMP_RNDU, "1.8866424074712365155e-1");
- check(643562308, 23100894, GMP_RNDD, "2.7858762002890447462e1");
- check(632549085, 1831935802, GMP_RNDN, "3.4528998467600230393e-1");
- check (1, 1, GMP_RNDN, "1.0");
+ check(-1647229822, 40619231, MPFR_RNDZ, "-4.055295438754120596e1");
+ check(-148939696, 1673285490, MPFR_RNDZ, "-8.9010331404953485501e-2");
+ check(-441322590, 273662545, MPFR_RNDZ, "-1.6126525096812205362");
+ check(-1631156895, 1677687197, MPFR_RNDU, "-9.722652100563177191e-1");
+ check(2141332571, 3117601, MPFR_RNDZ, "6.8685267004982347316e2");
+ check(75504803, 400207282, MPFR_RNDU, "1.8866424074712365155e-1");
+ check(643562308, 23100894, MPFR_RNDD, "2.7858762002890447462e1");
+ check(632549085, 1831935802, MPFR_RNDN, "3.4528998467600230393e-1");
+ check (1, 1, MPFR_RNDN, "1.0");
check0();
diff --git a/tests/tset_si.c b/tests/tset_si.c
index a07da8cba..1bb5a7294 100644
--- a/tests/tset_si.c
+++ b/tests/tset_si.c
@@ -36,55 +36,55 @@ test_2exp (void)
mpfr_init2 (x, 32);
- mpfr_set_ui_2exp (x, 1, 0, GMP_RNDN);
+ mpfr_set_ui_2exp (x, 1, 0, MPFR_RNDN);
if (mpfr_cmp_ui(x, 1))
ERROR("(1U,0)");
- mpfr_set_ui_2exp (x, 1024, -10, GMP_RNDN);
+ mpfr_set_ui_2exp (x, 1024, -10, MPFR_RNDN);
if (mpfr_cmp_ui(x, 1))
ERROR("(1024U,-10)");
- mpfr_set_ui_2exp (x, 1024, 10, GMP_RNDN);
+ mpfr_set_ui_2exp (x, 1024, 10, MPFR_RNDN);
if (mpfr_cmp_ui(x, 1024*1024))
ERROR("(1024U,+10)");
- mpfr_set_si_2exp (x, -1024L * 1024L, -10, GMP_RNDN);
+ mpfr_set_si_2exp (x, -1024L * 1024L, -10, MPFR_RNDN);
if (mpfr_cmp_si(x, -1024))
ERROR("(1M,-10)");
- mpfr_set_ui_2exp (x, 0x92345678, 16, GMP_RNDN);
- if (mpfr_cmp_str (x, "92345678@4", 16, GMP_RNDN))
+ mpfr_set_ui_2exp (x, 0x92345678, 16, MPFR_RNDN);
+ if (mpfr_cmp_str (x, "92345678@4", 16, MPFR_RNDN))
ERROR("(x92345678U,+16)");
- mpfr_set_si_2exp (x, -0x1ABCDEF0, -256, GMP_RNDN);
- if (mpfr_cmp_str (x, "-1ABCDEF0@-64", 16, GMP_RNDN))
+ mpfr_set_si_2exp (x, -0x1ABCDEF0, -256, MPFR_RNDN);
+ if (mpfr_cmp_str (x, "-1ABCDEF0@-64", 16, MPFR_RNDN))
ERROR("(-x1ABCDEF0,-256)");
mpfr_set_prec (x, 2);
- res = mpfr_set_si_2exp (x, 7, 10, GMP_RNDU);
+ res = mpfr_set_si_2exp (x, 7, 10, MPFR_RNDU);
if (mpfr_cmp_ui (x, 1<<13) || res <= 0)
ERROR ("Prec 2 + si_2exp");
- res = mpfr_set_ui_2exp (x, 7, 10, GMP_RNDU);
+ res = mpfr_set_ui_2exp (x, 7, 10, MPFR_RNDU);
if (mpfr_cmp_ui (x, 1<<13) || res <= 0)
ERROR ("Prec 2 + ui_2exp");
mpfr_clear_flags ();
- mpfr_set_ui_2exp (x, 17, MPFR_EMAX_MAX, GMP_RNDN);
+ mpfr_set_ui_2exp (x, 17, MPFR_EMAX_MAX, MPFR_RNDN);
if (!mpfr_inf_p (x) || MPFR_IS_NEG (x))
ERROR ("mpfr_set_ui_2exp and overflow (bad result)");
if (!mpfr_overflow_p ())
ERROR ("mpfr_set_ui_2exp and overflow (overflow flag not set)");
mpfr_clear_flags ();
- mpfr_set_si_2exp (x, 17, MPFR_EMAX_MAX, GMP_RNDN);
+ mpfr_set_si_2exp (x, 17, MPFR_EMAX_MAX, MPFR_RNDN);
if (!mpfr_inf_p (x) || MPFR_IS_NEG (x))
ERROR ("mpfr_set_si_2exp (pos) and overflow (bad result)");
if (!mpfr_overflow_p ())
ERROR ("mpfr_set_si_2exp (pos) and overflow (overflow flag not set)");
mpfr_clear_flags ();
- mpfr_set_si_2exp (x, -17, MPFR_EMAX_MAX, GMP_RNDN);
+ mpfr_set_si_2exp (x, -17, MPFR_EMAX_MAX, MPFR_RNDN);
if (!mpfr_inf_p (x) || MPFR_IS_POS (x))
ERROR ("mpfr_set_si_2exp (neg) and overflow (bad result)");
if (!mpfr_overflow_p ())
@@ -145,8 +145,8 @@ main (int argc, char *argv[])
for (k = 1; k <= N; k++)
{
z = (long) (randlimb () & LONG_MAX) + LONG_MIN / 2;
- inex = mpfr_set_si (x, z, GMP_RNDZ);
- d = mpfr_get_si (x, GMP_RNDZ);
+ inex = mpfr_set_si (x, z, MPFR_RNDZ);
+ d = mpfr_get_si (x, MPFR_RNDZ);
if (d != z)
{
printf ("Error in mpfr_set_si: expected %ld got %ld\n", z, d);
@@ -163,8 +163,8 @@ main (int argc, char *argv[])
for (k = 1; k <= N; k++)
{
zl = randlimb ();
- inex = mpfr_set_ui (x, zl, GMP_RNDZ);
- dl = mpfr_get_ui (x, GMP_RNDZ);
+ inex = mpfr_set_ui (x, zl, MPFR_RNDZ);
+ dl = mpfr_get_ui (x, MPFR_RNDZ);
if (dl != zl)
{
printf ("Error in mpfr_set_ui: expected %lu got %lu\n", zl, dl);
@@ -179,56 +179,56 @@ main (int argc, char *argv[])
}
mpfr_set_prec (x, 2);
- if (mpfr_set_si (x, 5, GMP_RNDZ) >= 0)
+ if (mpfr_set_si (x, 5, MPFR_RNDZ) >= 0)
{
- printf ("Wrong inexact flag for x=5, rnd=GMP_RNDZ\n");
+ printf ("Wrong inexact flag for x=5, rnd=MPFR_RNDZ\n");
exit (1);
}
mpfr_set_prec (x, 2);
- if (mpfr_set_si (x, -5, GMP_RNDZ) <= 0)
+ if (mpfr_set_si (x, -5, MPFR_RNDZ) <= 0)
{
- printf ("Wrong inexact flag for x=-5, rnd=GMP_RNDZ\n");
+ printf ("Wrong inexact flag for x=-5, rnd=MPFR_RNDZ\n");
exit (1);
}
mpfr_set_prec (x, 3);
- inex = mpfr_set_si (x, 77617, GMP_RNDD); /* should be 65536 */
+ inex = mpfr_set_si (x, 77617, MPFR_RNDD); /* should be 65536 */
if (MPFR_MANT(x)[0] != ((mp_limb_t)1 << (mp_bits_per_limb-1))
|| inex >= 0)
{
- printf ("Error in mpfr_set_si(x:3, 77617, GMP_RNDD)\n");
+ printf ("Error in mpfr_set_si(x:3, 77617, MPFR_RNDD)\n");
mpfr_print_binary (x);
puts ("");
exit (1);
}
- inex = mpfr_set_ui (x, 77617, GMP_RNDD); /* should be 65536 */
+ inex = mpfr_set_ui (x, 77617, MPFR_RNDD); /* should be 65536 */
if (MPFR_MANT(x)[0] != ((mp_limb_t)1 << (mp_bits_per_limb-1))
|| inex >= 0)
{
- printf ("Error in mpfr_set_ui(x:3, 77617, GMP_RNDD)\n");
+ printf ("Error in mpfr_set_ui(x:3, 77617, MPFR_RNDD)\n");
mpfr_print_binary (x);
puts ("");
exit (1);
}
mpfr_set_prec (x, 2);
- inex = mpfr_set_si (x, 33096, GMP_RNDU);
- if (mpfr_get_si (x, GMP_RNDZ) != 49152 || inex <= 0)
+ inex = mpfr_set_si (x, 33096, MPFR_RNDU);
+ if (mpfr_get_si (x, MPFR_RNDZ) != 49152 || inex <= 0)
{
printf ("Error in mpfr_set_si, exp. 49152, got %ld, inex %d\n",
- mpfr_get_si (x, GMP_RNDZ), inex);
+ mpfr_get_si (x, MPFR_RNDZ), inex);
exit (1);
}
- inex = mpfr_set_ui (x, 33096, GMP_RNDU);
- if (mpfr_get_si (x, GMP_RNDZ) != 49152)
+ inex = mpfr_set_ui (x, 33096, MPFR_RNDU);
+ if (mpfr_get_si (x, MPFR_RNDZ) != 49152)
{
printf ("Error in mpfr_set_ui, exp. 49152, got %ld, inex %d\n",
- mpfr_get_si (x, GMP_RNDZ), inex);
+ mpfr_get_si (x, MPFR_RNDZ), inex);
exit (1);
}
- for (r = 0 ; r < GMP_RND_MAX ; r++)
+ for (r = 0 ; r < MPFR_RND_MAX ; r++)
{
mpfr_set_si (x, -1, (mp_rnd_t) r);
mpfr_set_ui (x, 0, (mp_rnd_t) r);
@@ -252,7 +252,7 @@ main (int argc, char *argv[])
/* check potential bug in case mp_limb_t is unsigned */
emax = mpfr_get_emax ();
set_emax (0);
- mpfr_set_si (x, -1, GMP_RNDN);
+ mpfr_set_si (x, -1, MPFR_RNDN);
if (mpfr_sgn (x) >= 0)
{
printf ("mpfr_set_si (x, -1) fails\n");
@@ -263,7 +263,7 @@ main (int argc, char *argv[])
emax = mpfr_get_emax ();
set_emax (5);
mpfr_set_prec (x, 2);
- mpfr_set_si (x, -31, GMP_RNDN);
+ mpfr_set_si (x, -31, MPFR_RNDN);
if (mpfr_sgn (x) >= 0)
{
printf ("mpfr_set_si (x, -31) fails\n");
@@ -272,100 +272,100 @@ main (int argc, char *argv[])
set_emax (emax);
/* test for get_ui */
- mpfr_set_ui (x, 0, GMP_RNDN);
- MPFR_ASSERTN(mpfr_get_ui (x, GMP_RNDN) == 0);
- mpfr_set_ui (x, ULONG_MAX, GMP_RNDU);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_get_ui (x, MPFR_RNDN) == 0);
+ mpfr_set_ui (x, ULONG_MAX, MPFR_RNDU);
mpfr_nextabove (x);
- mpfr_get_ui (x, GMP_RNDU);
+ mpfr_get_ui (x, MPFR_RNDU);
/* another test for get_ui */
mpfr_set_prec (x, 10);
mpfr_set_str_binary (x, "10.101");
- dl = mpfr_get_ui (x, GMP_RNDN);
+ dl = mpfr_get_ui (x, MPFR_RNDN);
MPFR_ASSERTN (dl == 3);
mpfr_set_str_binary (x, "-1.0");
- mpfr_get_ui (x, GMP_RNDN);
+ mpfr_get_ui (x, MPFR_RNDN);
mpfr_set_str_binary (x, "0.1");
- dl = mpfr_get_ui (x, GMP_RNDN);
+ dl = mpfr_get_ui (x, MPFR_RNDN);
MPFR_ASSERTN (dl == 0);
- dl = mpfr_get_ui (x, GMP_RNDZ);
+ dl = mpfr_get_ui (x, MPFR_RNDZ);
MPFR_ASSERTN (dl == 0);
- dl = mpfr_get_ui (x, GMP_RNDD);
+ dl = mpfr_get_ui (x, MPFR_RNDD);
MPFR_ASSERTN (dl == 0);
- dl = mpfr_get_ui (x, GMP_RNDU);
+ dl = mpfr_get_ui (x, MPFR_RNDU);
MPFR_ASSERTN (dl == 1);
/* coverage tests */
mpfr_set_prec (x, 2);
- mpfr_set_si (x, -7, GMP_RNDD);
+ mpfr_set_si (x, -7, MPFR_RNDD);
MPFR_ASSERTN(mpfr_cmp_si (x, -8) == 0);
mpfr_set_prec (x, 2);
- mpfr_set_ui (x, 7, GMP_RNDU);
+ mpfr_set_ui (x, 7, MPFR_RNDU);
MPFR_ASSERTN(mpfr_cmp_ui (x, 8) == 0);
emax = mpfr_get_emax ();
set_emax (3);
- mpfr_set_ui (x, 7, GMP_RNDU);
+ mpfr_set_ui (x, 7, MPFR_RNDU);
MPFR_ASSERTN(mpfr_inf_p (x) && mpfr_sgn (x) > 0);
set_emax (1);
- MPFR_ASSERTN( mpfr_set_ui (x, 7, GMP_RNDU) );
+ MPFR_ASSERTN( mpfr_set_ui (x, 7, MPFR_RNDU) );
MPFR_ASSERTN(mpfr_inf_p (x) && mpfr_sgn (x) > 0);
set_emax (emax);
- mpfr_set_ui_2exp (x, 17, -50, GMP_RNDN);
- MPFR_ASSERTN (mpfr_get_ui (x, GMP_RNDD) == 0);
- MPFR_ASSERTN (mpfr_get_si (x, GMP_RNDD) == 0);
+ mpfr_set_ui_2exp (x, 17, -50, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_get_ui (x, MPFR_RNDD) == 0);
+ MPFR_ASSERTN (mpfr_get_si (x, MPFR_RNDD) == 0);
/* Test for ERANGE flag + correct behaviour if overflow */
mpfr_set_prec (x, 256);
- mpfr_set_ui (x, ULONG_MAX, GMP_RNDN);
+ mpfr_set_ui (x, ULONG_MAX, MPFR_RNDN);
mpfr_clear_erangeflag ();
- dl = mpfr_get_ui (x, GMP_RNDN);
+ dl = mpfr_get_ui (x, MPFR_RNDN);
if (dl != ULONG_MAX || mpfr_erangeflag_p ())
{
printf ("ERROR for get_ui + ERANGE + ULONG_MAX (1)\n");
exit (1);
}
- mpfr_add_ui (x, x, 1, GMP_RNDN);
- dl = mpfr_get_ui (x, GMP_RNDN);
+ mpfr_add_ui (x, x, 1, MPFR_RNDN);
+ dl = mpfr_get_ui (x, MPFR_RNDN);
if (dl != ULONG_MAX || !mpfr_erangeflag_p ())
{
printf ("ERROR for get_ui + ERANGE + ULONG_MAX (2)\n");
exit (1);
}
- mpfr_set_si (x, -1, GMP_RNDN);
+ mpfr_set_si (x, -1, MPFR_RNDN);
mpfr_clear_erangeflag ();
- dl = mpfr_get_ui (x, GMP_RNDN);
+ dl = mpfr_get_ui (x, MPFR_RNDN);
if (dl != 0 || !mpfr_erangeflag_p ())
{
printf ("ERROR for get_ui + ERANGE + -1 \n");
exit (1);
}
- mpfr_set_si (x, LONG_MAX, GMP_RNDN);
+ mpfr_set_si (x, LONG_MAX, MPFR_RNDN);
mpfr_clear_erangeflag ();
- d = mpfr_get_si (x, GMP_RNDN);
+ d = mpfr_get_si (x, MPFR_RNDN);
if (d != LONG_MAX || mpfr_erangeflag_p ())
{
printf ("ERROR for get_si + ERANGE + LONG_MAX (1): %ld\n", d);
exit (1);
}
- mpfr_add_ui (x, x, 1, GMP_RNDN);
- d = mpfr_get_si (x, GMP_RNDN);
+ mpfr_add_ui (x, x, 1, MPFR_RNDN);
+ d = mpfr_get_si (x, MPFR_RNDN);
if (d != LONG_MAX || !mpfr_erangeflag_p ())
{
printf ("ERROR for get_si + ERANGE + LONG_MAX (2)\n");
exit (1);
}
- mpfr_set_si (x, LONG_MIN, GMP_RNDN);
+ mpfr_set_si (x, LONG_MIN, MPFR_RNDN);
mpfr_clear_erangeflag ();
- d = mpfr_get_si (x, GMP_RNDN);
+ d = mpfr_get_si (x, MPFR_RNDN);
if (d != LONG_MIN || mpfr_erangeflag_p ())
{
printf ("ERROR for get_si + ERANGE + LONG_MIN (1)\n");
exit (1);
}
- mpfr_sub_ui (x, x, 1, GMP_RNDN);
- d = mpfr_get_si (x, GMP_RNDN);
+ mpfr_sub_ui (x, x, 1, MPFR_RNDN);
+ d = mpfr_get_si (x, MPFR_RNDN);
if (d != LONG_MIN || !mpfr_erangeflag_p ())
{
printf ("ERROR for get_si + ERANGE + LONG_MIN (2)\n");
@@ -377,34 +377,34 @@ main (int argc, char *argv[])
mpfr_set_emin (4);
mpfr_clear_flags ();
- mpfr_set_ui (x, 7, GMP_RNDU);
+ mpfr_set_ui (x, 7, MPFR_RNDU);
flag = mpfr_underflow_p ();
mpfr_set_emin (emin);
if (mpfr_cmp_ui (x, 8) != 0)
{
- printf ("Error for mpfr_set_ui (x, 7, GMP_RNDU), prec = 2, emin = 4\n");
+ printf ("Error for mpfr_set_ui (x, 7, MPFR_RNDU), prec = 2, emin = 4\n");
exit (1);
}
if (flag)
{
- printf ("mpfr_set_ui (x, 7, GMP_RNDU) should not underflow "
+ printf ("mpfr_set_ui (x, 7, MPFR_RNDU) should not underflow "
"with prec = 2, emin = 4\n");
exit (1);
}
mpfr_set_emin (4);
mpfr_clear_flags ();
- mpfr_set_si (x, -7, GMP_RNDD);
+ mpfr_set_si (x, -7, MPFR_RNDD);
flag = mpfr_underflow_p ();
mpfr_set_emin (emin);
if (mpfr_cmp_si (x, -8) != 0)
{
- printf ("Error for mpfr_set_si (x, -7, GMP_RNDD), prec = 2, emin = 4\n");
+ printf ("Error for mpfr_set_si (x, -7, MPFR_RNDD), prec = 2, emin = 4\n");
exit (1);
}
if (flag)
{
- printf ("mpfr_set_si (x, -7, GMP_RNDD) should not underflow "
+ printf ("mpfr_set_si (x, -7, MPFR_RNDD) should not underflow "
"with prec = 2, emin = 4\n");
exit (1);
}
diff --git a/tests/tset_sj.c b/tests/tset_sj.c
index 98141309e..7c01a64c7 100644
--- a/tests/tset_sj.c
+++ b/tests/tset_sj.c
@@ -80,8 +80,8 @@ check_set_uj (mp_prec_t pmin, mp_prec_t pmax, int N)
{
/* mp_limb_t may be unsigned long long */
limb = (unsigned long) randlimb ();
- inex1 = mpfr_set_uj (x, limb, GMP_RNDN);
- inex2 = mpfr_set_ui (y, limb, GMP_RNDN);
+ inex1 = mpfr_set_uj (x, limb, MPFR_RNDN);
+ inex2 = mpfr_set_ui (y, limb, MPFR_RNDN);
if (mpfr_cmp (x, y))
{
printf ("ERROR for mpfr_set_uj and j=%lu and p=%lu\n",
@@ -101,14 +101,14 @@ check_set_uj (mp_prec_t pmin, mp_prec_t pmax, int N)
}
/* Special case */
mpfr_set_prec (x, sizeof(uintmax_t)*CHAR_BIT);
- inex1 = mpfr_set_uj (x, UINTMAX_MAX, GMP_RNDN);
+ inex1 = mpfr_set_uj (x, UINTMAX_MAX, MPFR_RNDN);
if (inex1 != 0 || mpfr_sgn(x) <= 0)
ERROR ("inexact / UINTMAX_MAX");
- inex1 = mpfr_add_ui (x, x, 1, GMP_RNDN);
+ inex1 = mpfr_add_ui (x, x, 1, MPFR_RNDN);
if (inex1 != 0 || !mpfr_powerof2_raw (x)
|| MPFR_EXP (x) != (sizeof(uintmax_t)*CHAR_BIT+1) )
ERROR ("power of 2");
- mpfr_set_uj (x, 0, GMP_RNDN);
+ mpfr_set_uj (x, 0, MPFR_RNDN);
if (!MPFR_IS_ZERO (x))
ERROR ("Setting 0");
@@ -123,30 +123,30 @@ check_set_uj_2exp (void)
mpfr_init2 (x, sizeof(uintmax_t)*CHAR_BIT);
- inex = mpfr_set_uj_2exp (x, 1, 0, GMP_RNDN);
+ inex = mpfr_set_uj_2exp (x, 1, 0, MPFR_RNDN);
if (inex || mpfr_cmp_ui(x, 1))
ERROR("(1U,0)");
- inex = mpfr_set_uj_2exp (x, 1024, -10, GMP_RNDN);
+ inex = mpfr_set_uj_2exp (x, 1024, -10, MPFR_RNDN);
if (inex || mpfr_cmp_ui(x, 1))
ERROR("(1024U,-10)");
- inex = mpfr_set_uj_2exp (x, 1024, 10, GMP_RNDN);
+ inex = mpfr_set_uj_2exp (x, 1024, 10, MPFR_RNDN);
if (inex || mpfr_cmp_ui(x, 1024L * 1024L))
ERROR("(1024U,+10)");
- inex = mpfr_set_uj_2exp (x, UINTMAX_MAX, 1000, GMP_RNDN);
- inex |= mpfr_div_2ui (x, x, 1000, GMP_RNDN);
- inex |= mpfr_add_ui (x, x, 1, GMP_RNDN);
+ inex = mpfr_set_uj_2exp (x, UINTMAX_MAX, 1000, MPFR_RNDN);
+ inex |= mpfr_div_2ui (x, x, 1000, MPFR_RNDN);
+ inex |= mpfr_add_ui (x, x, 1, MPFR_RNDN);
if (inex || !mpfr_powerof2_raw (x)
|| MPFR_EXP (x) != (sizeof(uintmax_t)*CHAR_BIT+1) )
ERROR("(UINTMAX_MAX)");
- inex = mpfr_set_uj_2exp (x, UINTMAX_MAX, MPFR_EMAX_MAX-10, GMP_RNDN);
+ inex = mpfr_set_uj_2exp (x, UINTMAX_MAX, MPFR_EMAX_MAX-10, MPFR_RNDN);
if (inex == 0 || !mpfr_inf_p (x))
ERROR ("Overflow");
- inex = mpfr_set_uj_2exp (x, UINTMAX_MAX, MPFR_EMIN_MIN-1000, GMP_RNDN);
+ inex = mpfr_set_uj_2exp (x, UINTMAX_MAX, MPFR_EMIN_MIN-1000, MPFR_RNDN);
if (inex == 0 || !MPFR_IS_ZERO (x))
ERROR ("Underflow");
@@ -161,13 +161,13 @@ check_set_sj (void)
mpfr_init2 (x, sizeof(intmax_t)*CHAR_BIT-1);
- inex = mpfr_set_sj (x, -INTMAX_MAX, GMP_RNDN);
- inex |= mpfr_add_si (x, x, -1, GMP_RNDN);
+ inex = mpfr_set_sj (x, -INTMAX_MAX, MPFR_RNDN);
+ inex |= mpfr_add_si (x, x, -1, MPFR_RNDN);
if (inex || mpfr_sgn (x) >=0 || !mpfr_powerof2_raw (x)
|| MPFR_EXP (x) != (sizeof(intmax_t)*CHAR_BIT) )
ERROR("set_sj (-INTMAX_MAX)");
- inex = mpfr_set_sj (x, 1742, GMP_RNDN);
+ inex = mpfr_set_sj (x, 1742, MPFR_RNDN);
if (inex || mpfr_cmp_ui (x, 1742))
ERROR ("set_sj (1742)");
@@ -182,7 +182,7 @@ check_set_sj_2exp (void)
mpfr_init2 (x, sizeof(intmax_t)*CHAR_BIT-1);
- inex = mpfr_set_sj_2exp (x, INTMAX_MIN, 1000, GMP_RNDN);
+ inex = mpfr_set_sj_2exp (x, INTMAX_MIN, 1000, MPFR_RNDN);
if (inex || mpfr_sgn (x) >=0 || !mpfr_powerof2_raw (x)
|| MPFR_EXP (x) != (sizeof(intmax_t)*CHAR_BIT+1000) )
ERROR("set_sj_2exp (INTMAX_MIN)");
diff --git a/tests/tset_str.c b/tests/tset_str.c
index 57b8847ff..dffa18aee 100644
--- a/tests/tset_str.c
+++ b/tests/tset_str.c
@@ -56,10 +56,10 @@ check_underflow (void)
/* Check underflow */
emin = mpfr_get_emin ();
set_emin (-20);
- res = mpfr_set_str (a, "0.00000000001", 10, GMP_RNDZ);
+ res = mpfr_set_str (a, "0.00000000001", 10, MPFR_RNDZ);
if (!MPFR_IS_ZERO (a))
{
- printf("ERROR for mpfr_set_str (a, \"0.00000000001\", 10, GMP_RNDN)\n"
+ printf("ERROR for mpfr_set_str (a, \"0.00000000001\", 10, MPFR_RNDN)\n"
" with emin=-20\n"
"res=%d\n", res);
mpfr_dump (a);
@@ -70,10 +70,10 @@ check_underflow (void)
/* check overflow */
emax = mpfr_get_emax ();
set_emax (1073741823); /* 2^30-1 */
- mpfr_set_str (a, "2E1000000000", 10, GMP_RNDN);
+ mpfr_set_str (a, "2E1000000000", 10, MPFR_RNDN);
if (!mpfr_inf_p (a) || mpfr_sgn (a) < 0)
{
- printf("ERROR for mpfr_set_str (a, \"2E1000000000\", 10, GMP_RNDN);\n");
+ printf("ERROR for mpfr_set_str (a, \"2E1000000000\", 10, MPFR_RNDN);\n");
exit (1);
}
set_emax (emax);
@@ -89,7 +89,7 @@ bug20081028 (void)
const char *s = "0.10000000000000000000000000000001E1";
mpfr_init2 (x, 32);
- mpfr_set_str (x, "1.00000000000000000006", 10, GMP_RNDU);
+ mpfr_set_str (x, "1.00000000000000000006", 10, MPFR_RNDU);
if (! mpfr_greater_p (x, __gmpfr_one))
{
printf ("Error in bug20081028:\nExpected %s\nGot ", s);
@@ -116,8 +116,8 @@ main (int argc, char *argv[])
base = (argc >= 4) ? atoi (argv[3]) : 2;
obase = (argc >= 5) ? atoi (argv[4]) : 10;
mpfr_init2 (x, prec);
- mpfr_set_str (x, argv[1], base, GMP_RNDN);
- mpfr_out_str (stdout, obase, 0, x, GMP_RNDN);
+ mpfr_set_str (x, argv[1], base, MPFR_RNDN);
+ mpfr_out_str (stdout, obase, 0, x, MPFR_RNDN);
puts ("");
mpfr_clear (x);
return 0;
@@ -155,7 +155,7 @@ main (int argc, char *argv[])
mpfr_set_prec (x, 54);
mpfr_set_str_binary (x, "0.100100100110110101001010010101111000001011100100101010E-529");
mpfr_init2 (y, 54);
- mpfr_set_str (y, "4.936a52bc17254@-133", 16, GMP_RNDN);
+ mpfr_set_str (y, "4.936a52bc17254@-133", 16, MPFR_RNDN);
if (mpfr_cmp (x, y))
{
printf ("Error in mpfr_set_str (1a):\n");
@@ -169,7 +169,7 @@ main (int argc, char *argv[])
}
mpfr_set_str_binary (x, "0.111111101101110010111010100110000111011001010100001101E-529");
- mpfr_set_str (y, "0.fedcba98765434P-529", 16, GMP_RNDN);
+ mpfr_set_str (y, "0.fedcba98765434P-529", 16, MPFR_RNDN);
if (mpfr_cmp (x, y))
{
printf ("Error in mpfr_set_str (1b):\n");
@@ -207,11 +207,11 @@ main (int argc, char *argv[])
exit (1);
}
- mpfr_set_str (x, "+243495834958.53452345E1", 10, GMP_RNDN);
- mpfr_set_str (x, "9007199254740993", 10, GMP_RNDN);
- mpfr_set_str (x, "9007199254740992", 10, GMP_RNDU);
- mpfr_set_str (x, "9007199254740992", 10, GMP_RNDD);
- mpfr_set_str (x, "9007199254740992", 10, GMP_RNDZ);
+ mpfr_set_str (x, "+243495834958.53452345E1", 10, MPFR_RNDN);
+ mpfr_set_str (x, "9007199254740993", 10, MPFR_RNDN);
+ mpfr_set_str (x, "9007199254740992", 10, MPFR_RNDU);
+ mpfr_set_str (x, "9007199254740992", 10, MPFR_RNDD);
+ mpfr_set_str (x, "9007199254740992", 10, MPFR_RNDZ);
/* check a random number printed and read is not modified */
prec = 53;
@@ -256,7 +256,7 @@ main (int argc, char *argv[])
for (i = 2; i <= 36; i++)
{
- if (mpfr_set_str (x, "@NaN@(garbage)", i, GMP_RNDN) != 0 ||
+ if (mpfr_set_str (x, "@NaN@(garbage)", i, MPFR_RNDN) != 0 ||
!mpfr_nan_p(x))
{
printf ("mpfr_set_str failed on @NaN@(garbage)\n");
@@ -264,21 +264,21 @@ main (int argc, char *argv[])
}
/*
- if (mpfr_set_str (x, "@Inf@garbage", i, GMP_RNDN) != 0 ||
+ if (mpfr_set_str (x, "@Inf@garbage", i, MPFR_RNDN) != 0 ||
!mpfr_inf_p(x) || MPFR_SIGN(x) < 0)
{
printf ("mpfr_set_str failed on @Inf@garbage\n");
exit (1);
}
- if (mpfr_set_str (x, "-@Inf@garbage", i, GMP_RNDN) != 0 ||
+ if (mpfr_set_str (x, "-@Inf@garbage", i, MPFR_RNDN) != 0 ||
!mpfr_inf_p(x) || MPFR_SIGN(x) > 0)
{
printf ("mpfr_set_str failed on -@Inf@garbage\n");
exit (1);
}
- if (mpfr_set_str (x, "+@Inf@garbage", i, GMP_RNDN) != 0 ||
+ if (mpfr_set_str (x, "+@Inf@garbage", i, MPFR_RNDN) != 0 ||
!mpfr_inf_p(x) || MPFR_SIGN(x) < 0)
{
printf ("mpfr_set_str failed on +@Inf@garbage\n");
@@ -289,28 +289,28 @@ main (int argc, char *argv[])
if (i > 16)
continue;
- if (mpfr_set_str (x, "NaN", i, GMP_RNDN) != 0 ||
+ if (mpfr_set_str (x, "NaN", i, MPFR_RNDN) != 0 ||
!mpfr_nan_p(x))
{
printf ("mpfr_set_str failed on NaN\n");
exit (1);
}
- if (mpfr_set_str (x, "Inf", i, GMP_RNDN) != 0 ||
+ if (mpfr_set_str (x, "Inf", i, MPFR_RNDN) != 0 ||
!mpfr_inf_p(x) || MPFR_SIGN(x) < 0)
{
printf ("mpfr_set_str failed on Inf\n");
exit (1);
}
- if (mpfr_set_str (x, "-Inf", i, GMP_RNDN) != 0 ||
+ if (mpfr_set_str (x, "-Inf", i, MPFR_RNDN) != 0 ||
!mpfr_inf_p(x) || MPFR_SIGN(x) > 0)
{
printf ("mpfr_set_str failed on -Inf\n");
exit (1);
}
- if (mpfr_set_str (x, "+Inf", i, GMP_RNDN) != 0 ||
+ if (mpfr_set_str (x, "+Inf", i, MPFR_RNDN) != 0 ||
!mpfr_inf_p(x) || MPFR_SIGN(x) < 0)
{
printf ("mpfr_set_str failed on +Inf\n");
@@ -320,7 +320,7 @@ main (int argc, char *argv[])
/* check that mpfr_set_str works for uppercase letters too */
mpfr_set_prec (x, 10);
- mpfr_set_str (x, "B", 16, GMP_RNDN);
+ mpfr_set_str (x, "B", 16, MPFR_RNDN);
if (mpfr_cmp_ui (x, 11) != 0)
{
printf ("mpfr_set_str does not work for uppercase letters\n");
@@ -333,7 +333,7 @@ main (int argc, char *argv[])
mpfr_set_prec (x, 64);
mpfr_set_prec (y, 64);
mpfr_set_str_binary (x, "1.0E-532");
- mpfr_set_str (y, "0.71128279983522479470@-160", 10, GMP_RNDU);
+ mpfr_set_str (y, "0.71128279983522479470@-160", 10, MPFR_RNDU);
if (mpfr_cmp (x, y))
{
printf ("Error in mpfr_set_str (2):\n");
@@ -353,7 +353,7 @@ main (int argc, char *argv[])
mpfr_set_prec (x, 64);
mpfr_set_prec (y, 64);
mpfr_set_str_binary (x, "1.111111111110000000000000000111111111111111111111111110000000001E184");
- mpfr_set_str (y, "0.jo08hg31hc5mmpj5mjjmgn55p2h35g@39", 27, GMP_RNDU);
+ mpfr_set_str (y, "0.jo08hg31hc5mmpj5mjjmgn55p2h35g@39", 27, MPFR_RNDU);
/* y = 49027884868983130654865109690613178467841148597221480052 */
if (mpfr_cmp (x, y))
{
@@ -370,14 +370,14 @@ main (int argc, char *argv[])
/* not exact rounding in mpfr_set_str
same number with more precision is : 1.111111111111111111111111111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011011111101000001101110110010101101000010100110011101110010001110e195
this result is the same as mpfr_set_str */
- /* problem was : can_round was call with GMP_RNDN round mode,
+ /* problem was : can_round was call with MPFR_RNDN round mode,
so can_round use an error : 1/2 * 2^err * ulp(y)
instead of 2^err * ulp(y)
I have increase err by 1 */
mpfr_set_prec (x, 64); /* it was round down instead of up */
mpfr_set_prec (y, 64);
mpfr_set_str_binary (x, "1.111111111111111111111111111000000000000000000000000000000000001e195");
- mpfr_set_str (y, "0.6e23ekb6acgh96abk10b6c9f2ka16i@45", 21, GMP_RNDU);
+ mpfr_set_str (y, "0.6e23ekb6acgh96abk10b6c9f2ka16i@45", 21, MPFR_RNDU);
/* y = 100433627392042473064661483711179345482301462325708736552078 */
if (mpfr_cmp (x, y))
{
@@ -396,7 +396,7 @@ main (int argc, char *argv[])
mpfr_set_prec (x, 64); /* it was round down instead of up */
mpfr_set_prec (y, 64);
mpfr_set_str_binary (x, "1.111111100000001111110000000000011111011111111111111111111111111e180");
- mpfr_set_str (y, "0.10j8j2k82ehahha56390df0a1de030@41", 23, GMP_RNDZ);
+ mpfr_set_str (y, "0.10j8j2k82ehahha56390df0a1de030@41", 23, MPFR_RNDZ);
/* y = 3053110535624388280648330929253842828159081875986159414 */
if (mpfr_cmp (x, y))
{
@@ -412,7 +412,7 @@ main (int argc, char *argv[])
mpfr_set_prec (x, 64);
mpfr_set_prec (y, 64);
- mpfr_set_str (y, "0.jrchfhpp9en7hidqm9bmcofid9q3jg@39", 28, GMP_RNDU);
+ mpfr_set_str (y, "0.jrchfhpp9en7hidqm9bmcofid9q3jg@39", 28, MPFR_RNDU);
/* y = 196159429139499688661464718784226062699788036696626429952 */
mpfr_set_str_binary (x, "0.1111111111111111111111111111111000000000000011100000001111100001E187");
if (mpfr_cmp (x, y))
@@ -429,7 +429,7 @@ main (int argc, char *argv[])
mpfr_set_prec (x, 64);
mpfr_set_prec (y, 64);
- mpfr_set_str (y, "0.h148m5ld5cf8gk1kd70b6ege92g6ba@47", 24, GMP_RNDZ);
+ mpfr_set_str (y, "0.h148m5ld5cf8gk1kd70b6ege92g6ba@47", 24, MPFR_RNDZ);
/* y = 52652933527468502324759448399183654588831274530295083078827114496 */
mpfr_set_str_binary (x, "0.1111111111111100000000001000000000000000000011111111111111101111E215");
if (mpfr_cmp (x, y))
@@ -448,7 +448,7 @@ main (int argc, char *argv[])
mpfr_set_prec (x, 53);
mpfr_set_prec (y, 53);
- mpfr_set_str (y, "5e125", 10, GMP_RNDN);
+ mpfr_set_str (y, "5e125", 10, MPFR_RNDN);
mpfr_set_str_binary (x, "0.10111101000101110110011000100000101001010000000111111E418");
if (mpfr_cmp (x, y))
{
@@ -462,7 +462,7 @@ main (int argc, char *argv[])
exit (1);
}
- mpfr_set_str (y, "69e267", 10, GMP_RNDN);
+ mpfr_set_str (y, "69e267", 10, MPFR_RNDN);
mpfr_set_str_binary (x, "0.10000101101111100101101100000110010011001010011011010E894");
if (mpfr_cmp (x, y))
{
@@ -476,7 +476,7 @@ main (int argc, char *argv[])
exit (1);
}
- mpfr_set_str (y, "623e100", 10, GMP_RNDN);
+ mpfr_set_str (y, "623e100", 10, MPFR_RNDN);
mpfr_set_str_binary (x, "0.10110010000001010011000101111001110101000001111011111E342");
if (mpfr_cmp (x, y))
{
@@ -490,7 +490,7 @@ main (int argc, char *argv[])
exit (1);
}
- mpfr_set_str (y, "3571e263", 10, GMP_RNDN);
+ mpfr_set_str (y, "3571e263", 10, MPFR_RNDN);
mpfr_set_str_binary (x, "0.10110001001100100010011000110000111010100000110101010E886");
if (mpfr_cmp (x, y))
{
@@ -504,7 +504,7 @@ main (int argc, char *argv[])
exit (1);
}
- mpfr_set_str (y, "75569e-254", 10, GMP_RNDN);
+ mpfr_set_str (y, "75569e-254", 10, MPFR_RNDN);
mpfr_set_str_binary (x, "0.10101101001000110001011011001000111000110101010110011E-827");
if (mpfr_cmp (x, y))
{
@@ -518,7 +518,7 @@ main (int argc, char *argv[])
exit (1);
}
- mpfr_set_str (y, "920657e-23", 10, GMP_RNDN);
+ mpfr_set_str (y, "920657e-23", 10, MPFR_RNDN);
mpfr_set_str_binary (x, "0.10101001110101001100110000101110110111101111001101100E-56");
if (mpfr_cmp (x, y))
{
@@ -532,7 +532,7 @@ main (int argc, char *argv[])
exit (1);
}
- mpfr_set_str (y, "9210917e80", 10, GMP_RNDN);
+ mpfr_set_str (y, "9210917e80", 10, MPFR_RNDN);
mpfr_set_str_binary (x, "0.11101101000100011001000110100011111100110000000110010E289");
if (mpfr_cmp (x, y))
{
@@ -546,7 +546,7 @@ main (int argc, char *argv[])
exit (1);
}
- mpfr_set_str (y, "87575437e-309", 10, GMP_RNDN);
+ mpfr_set_str (y, "87575437e-309", 10, MPFR_RNDN);
mpfr_set_str_binary (x, "0.11110000001110011001000000110000000100000010101101100E-1000");
if (mpfr_cmp (x, y))
{
@@ -560,7 +560,7 @@ main (int argc, char *argv[])
exit (1);
}
- mpfr_set_str (y, "245540327e122", 10, GMP_RNDN);
+ mpfr_set_str (y, "245540327e122", 10, MPFR_RNDN);
mpfr_set_str_binary (x, "0.10001101101100010001100011110000110001100010111001011E434");
if (mpfr_cmp (x, y))
{
@@ -574,7 +574,7 @@ main (int argc, char *argv[])
exit (1);
}
- mpfr_set_str (y, "491080654e122", 10, GMP_RNDN);
+ mpfr_set_str (y, "491080654e122", 10, MPFR_RNDN);
mpfr_set_str_binary (x, "0.10001101101100010001100011110000110001100010111001011E435");
if (mpfr_cmp (x, y))
{
@@ -588,7 +588,7 @@ main (int argc, char *argv[])
exit (1);
}
- mpfr_set_str (y, "83356057653e193", 10, GMP_RNDN);
+ mpfr_set_str (y, "83356057653e193", 10, MPFR_RNDN);
mpfr_set_str_binary (x, "0.10101010001001110011011011010111011100010101000011000E678");
if (mpfr_cmp (x, y))
{
@@ -602,150 +602,150 @@ main (int argc, char *argv[])
exit (1);
}
- CHECK53(y, "83356057653e193", GMP_RNDN, x,
+ CHECK53(y, "83356057653e193", MPFR_RNDN, x,
"0.10101010001001110011011011010111011100010101000011000E678",
18);
- CHECK53(y, "619534293513e124", GMP_RNDN, x,
+ CHECK53(y, "619534293513e124", MPFR_RNDN, x,
"0.10001000011000010000000110000001111111110000011110001e452",
19);
- CHECK53(y, "3142213164987e-294", GMP_RNDN, x,
+ CHECK53(y, "3142213164987e-294", MPFR_RNDN, x,
"0.11101001101000000100111011111101111001010001001101111e-935",
20);
- CHECK53(y, "36167929443327e-159", GMP_RNDN, x,
+ CHECK53(y, "36167929443327e-159", MPFR_RNDN, x,
"0.11100111001110111110000101011001100110010100011111100e-483",
21);
- CHECK53(y, "904198236083175e-161", GMP_RNDN, x,
+ CHECK53(y, "904198236083175e-161", MPFR_RNDN, x,
"0.11100111001110111110000101011001100110010100011111100e-485",
22);
- CHECK53(y, "3743626360493413e-165", GMP_RNDN, x,
+ CHECK53(y, "3743626360493413e-165", MPFR_RNDN, x,
"0.11000100000100011101001010111101011011011111011111001e-496",
23);
- CHECK53(y, "94080055902682397e-242", GMP_RNDN, x,
+ CHECK53(y, "94080055902682397e-242", MPFR_RNDN, x,
"0.10110010010011000000111100011100111100110011011001010e-747",
24);
- CHECK53(y, "7e-303", GMP_RNDD, x,
+ CHECK53(y, "7e-303", MPFR_RNDD, x,
"0.10011001100111001000100110001110001000110111110001011e-1003",
25);
- CHECK53(y, "7e-303", GMP_RNDU, x,
+ CHECK53(y, "7e-303", MPFR_RNDU, x,
"0.10011001100111001000100110001110001000110111110001100e-1003",
26);
- CHECK53(y, "93e-234", GMP_RNDD, x,
+ CHECK53(y, "93e-234", MPFR_RNDD, x,
"0.10010011110110010111001001111001000010000000001110101E-770",
27);
- CHECK53(y, "93e-234", GMP_RNDU, x,
+ CHECK53(y, "93e-234", MPFR_RNDU, x,
"0.10010011110110010111001001111001000010000000001110110E-770",
28);
- CHECK53(y, "755e174", GMP_RNDD, x,
+ CHECK53(y, "755e174", MPFR_RNDD, x,
"0.10111110110010011000110010011111101111000111111000101E588",
29);
- CHECK53(y, "755e174", GMP_RNDU, x,
+ CHECK53(y, "755e174", MPFR_RNDU, x,
"0.10111110110010011000110010011111101111000111111000110E588",
30);
- CHECK53(y, "8699e-276", GMP_RNDD, x,
+ CHECK53(y, "8699e-276", MPFR_RNDD, x,
"0.10010110100101101111100100100011011101100110100101100E-903",
31);
- CHECK53(y, "8699e-276", GMP_RNDU, x,
+ CHECK53(y, "8699e-276", MPFR_RNDU, x,
"0.10010110100101101111100100100011011101100110100101101E-903",
32);
- CHECK53(y, "82081e41", GMP_RNDD, x,
+ CHECK53(y, "82081e41", MPFR_RNDD, x,
"0.10111000000010000010111011111001111010100011111001011E153",
33);
- CHECK53(y, "82081e41", GMP_RNDU, x,
+ CHECK53(y, "82081e41", MPFR_RNDU, x,
"0.10111000000010000010111011111001111010100011111001100E153",
34);
- CHECK53(y, "584169e229", GMP_RNDD, x,
+ CHECK53(y, "584169e229", MPFR_RNDD, x,
"0.11101011001010111000001011001110111000111100110101010E780",
35);
- CHECK53(y, "584169e229", GMP_RNDU, x,
+ CHECK53(y, "584169e229", MPFR_RNDU, x,
"0.11101011001010111000001011001110111000111100110101011E780",
36);
- CHECK53(y, "5783893e-128", GMP_RNDD, x,
+ CHECK53(y, "5783893e-128", MPFR_RNDD, x,
"0.10011000111100000110011110000101100111110011101110100E-402",
37);
- CHECK53(y, "5783893e-128", GMP_RNDU, x,
+ CHECK53(y, "5783893e-128", MPFR_RNDU, x,
"0.10011000111100000110011110000101100111110011101110101E-402",
38);
- CHECK53(y, "87575437e-310", GMP_RNDD, x,
+ CHECK53(y, "87575437e-310", MPFR_RNDD, x,
"0.11000000001011100000110011110011010000000010001010110E-1003",
39);
- CHECK53(y, "87575437e-310", GMP_RNDU, x,
+ CHECK53(y, "87575437e-310", MPFR_RNDU, x,
"0.11000000001011100000110011110011010000000010001010111E-1003",
40);
- CHECK53(y, "245540327e121", GMP_RNDD, x,
+ CHECK53(y, "245540327e121", MPFR_RNDD, x,
"0.11100010101101001111010010110100011100000100101000100E430",
41);
- CHECK53(y, "245540327e121", GMP_RNDU, x,
+ CHECK53(y, "245540327e121", MPFR_RNDU, x,
"0.11100010101101001111010010110100011100000100101000101E430",
42);
- CHECK53(y, "9078555839e-109", GMP_RNDD, x,
+ CHECK53(y, "9078555839e-109", MPFR_RNDD, x,
"0.11111110001010111010110000110011100110001010011101101E-329",
43);
- CHECK53(y, "9078555839e-109", GMP_RNDU, x,
+ CHECK53(y, "9078555839e-109", MPFR_RNDU, x,
"0.11111110001010111010110000110011100110001010011101110E-329",
44);
- CHECK53(y, "42333842451e201", GMP_RNDD, x,
+ CHECK53(y, "42333842451e201", MPFR_RNDD, x,
"0.10000000110001001101000100110110111110101011101011111E704",
45);
- CHECK53(y, "42333842451e201", GMP_RNDU, x,
+ CHECK53(y, "42333842451e201", MPFR_RNDU, x,
"0.10000000110001001101000100110110111110101011101100000E704",
46);
- CHECK53(y, "778380362293e218", GMP_RNDD, x,
+ CHECK53(y, "778380362293e218", MPFR_RNDD, x,
"0.11001101010111000001001100001100110010000001010010010E764",
47);
- CHECK53(y, "778380362293e218", GMP_RNDU, x,
+ CHECK53(y, "778380362293e218", MPFR_RNDU, x,
"0.11001101010111000001001100001100110010000001010010011E764",
48);
- CHECK53(y, "7812878489261e-179", GMP_RNDD, x,
+ CHECK53(y, "7812878489261e-179", MPFR_RNDD, x,
"0.10010011011011010111001111011101111101101101001110100E-551",
49);
- CHECK53(y, "7812878489261e-179", GMP_RNDU, x,
+ CHECK53(y, "7812878489261e-179", MPFR_RNDU, x,
"0.10010011011011010111001111011101111101101101001110101E-551",
50);
- CHECK53(y, "77003665618895e-73", GMP_RNDD, x,
+ CHECK53(y, "77003665618895e-73", MPFR_RNDD, x,
"0.11000101111110111111001111111101001101111000000101001E-196",
51);
- CHECK53(y, "77003665618895e-73", GMP_RNDU, x,
+ CHECK53(y, "77003665618895e-73", MPFR_RNDU, x,
"0.11000101111110111111001111111101001101111000000101010E-196",
52);
- CHECK53(y, "834735494917063e-300", GMP_RNDD, x,
+ CHECK53(y, "834735494917063e-300", MPFR_RNDD, x,
"0.11111110001101100001001101111100010011001110111010001E-947",
53);
- CHECK53(y, "834735494917063e-300", GMP_RNDU, x,
+ CHECK53(y, "834735494917063e-300", MPFR_RNDU, x,
"0.11111110001101100001001101111100010011001110111010010E-947",
54);
- CHECK53(y, "6182410494241627e-119", GMP_RNDD, x,
+ CHECK53(y, "6182410494241627e-119", MPFR_RNDD, x,
"0.10001101110010110010001011000010001000101110100000111E-342",
55);
- CHECK53(y, "6182410494241627e-119", GMP_RNDU, x,
+ CHECK53(y, "6182410494241627e-119", MPFR_RNDU, x,
"0.10001101110010110010001011000010001000101110100001000E-342",
56);
- CHECK53(y, "26153245263757307e49", GMP_RNDD, x,
+ CHECK53(y, "26153245263757307e49", MPFR_RNDD, x,
"0.10011110111100000000001011011110101100010000011011110E218",
57);
- CHECK53(y, "26153245263757307e49", GMP_RNDU, x,
+ CHECK53(y, "26153245263757307e49", MPFR_RNDU, x,
"0.10011110111100000000001011011110101100010000011011111E218",
58);
@@ -758,7 +758,7 @@ main (int argc, char *argv[])
size_t nb_digit = mp_bits_per_limb;
mp_limb_t check_limb[2] = {MPFR_LIMB_HIGHBIT, ~(MPFR_LIMB_HIGHBIT >> 1)};
int base[3] = {10, 16, 19};
- mp_rnd_t rnd[3] = {GMP_RNDU, GMP_RNDN, GMP_RNDD};
+ mp_rnd_t rnd[3] = {MPFR_RNDU, MPFR_RNDN, MPFR_RNDD};
int cbase, climb, crnd;
char *str;
@@ -767,7 +767,7 @@ main (int argc, char *argv[])
str = (char*) (*__gmp_allocate_func) (N + 20);
- mpfr_set_ui (x, 1, GMP_RNDN); /* ensures that x is not NaN or Inf */
+ mpfr_set_ui (x, 1, MPFR_RNDN); /* ensures that x is not NaN or Inf */
for (; nb_digit < N; nb_digit *= 10)
for (cbase = 0; cbase < 3; cbase++)
for (climb = 0; climb < 2; climb++)
@@ -813,13 +813,13 @@ main (int argc, char *argv[])
/* check that flags are correctly cleared */
mpfr_set_nan (x);
- mpfr_set_str (x, "+0.0", 10, GMP_RNDN);
+ mpfr_set_str (x, "+0.0", 10, MPFR_RNDN);
if (!mpfr_number_p(x) || mpfr_cmp_ui (x, 0) != 0 || mpfr_sgn (x) < 0)
{
printf ("x <- +0.0 failed after x=NaN\n");
exit (1);
}
- mpfr_set_str (x, "-0.0", 10, GMP_RNDN);
+ mpfr_set_str (x, "-0.0", 10, MPFR_RNDN);
if (!mpfr_number_p(x) || mpfr_cmp_ui (x, 0) != 0 || mpfr_sgn (x) > 0)
{
printf ("x <- -0.0 failed after x=NaN\n");
@@ -827,24 +827,24 @@ main (int argc, char *argv[])
}
/* check invalid input */
- ret = mpfr_set_str (x, "1E10toto", 10, GMP_RNDN);
+ ret = mpfr_set_str (x, "1E10toto", 10, MPFR_RNDN);
MPFR_ASSERTN (ret == -1);
- ret = mpfr_set_str (x, "1p10toto", 16, GMP_RNDN);
+ ret = mpfr_set_str (x, "1p10toto", 16, MPFR_RNDN);
MPFR_ASSERTN (ret == -1);
- ret = mpfr_set_str (x, "", 16, GMP_RNDN);
+ ret = mpfr_set_str (x, "", 16, MPFR_RNDN);
MPFR_ASSERTN (ret == -1);
- ret = mpfr_set_str (x, "+", 16, GMP_RNDN);
+ ret = mpfr_set_str (x, "+", 16, MPFR_RNDN);
MPFR_ASSERTN (ret == -1);
- ret = mpfr_set_str (x, "-", 16, GMP_RNDN);
+ ret = mpfr_set_str (x, "-", 16, MPFR_RNDN);
MPFR_ASSERTN (ret == -1);
- ret = mpfr_set_str (x, "this_is_an_invalid_number_in_base_36", 36, GMP_RNDN);
+ ret = mpfr_set_str (x, "this_is_an_invalid_number_in_base_36", 36, MPFR_RNDN);
MPFR_ASSERTN (ret == -1);
- ret = mpfr_set_str (x, "1.2.3", 10, GMP_RNDN);
+ ret = mpfr_set_str (x, "1.2.3", 10, MPFR_RNDN);
MPFR_ASSERTN (ret == -1);
mpfr_set_prec (x, 135);
- ret = mpfr_set_str (x, "thisisavalidnumberinbase36", 36, GMP_RNDN);
+ ret = mpfr_set_str (x, "thisisavalidnumberinbase36", 36, MPFR_RNDN);
mpfr_set_prec (y, 135);
- mpfr_set_str (y, "23833565676460972739462619524519814462546", 10, GMP_RNDN);
+ mpfr_set_str (y, "23833565676460972739462619524519814462546", 10, MPFR_RNDN);
MPFR_ASSERTN (mpfr_cmp (x, y) == 0 && ret == 0);
/* coverage test for set_str_binary */
diff --git a/tests/tset_z.c b/tests/tset_z.c
index 1db6c2796..f46387eda 100644
--- a/tests/tset_z.c
+++ b/tests/tset_z.c
@@ -36,7 +36,7 @@ static void check0(void)
mpfr_init (x);
mpz_init (y);
mpz_set_si (y, 0);
- for(r = 0; r < GMP_RND_MAX; r++)
+ for(r = 0; r < MPFR_RND_MAX; r++)
{
inexact = mpfr_set_z (x, y, (mp_rnd_t) r);
if (!MPFR_IS_ZERO(x) || !MPFR_IS_POS(x) || inexact)
@@ -64,7 +64,7 @@ check (long i, mp_rnd_t rnd)
mpz_init (z);
mpz_set_ui (z, i);
mpfr_set_z (f, z, rnd);
- if (mpfr_get_si (f, GMP_RNDZ) != i)
+ if (mpfr_get_si (f, MPFR_RNDZ) != i)
{
printf ("Error in mpfr_set_z for i=%ld rnd_mode=%d\n", i, rnd);
exit (1);
@@ -85,7 +85,7 @@ check_large (void)
mpfr_init2 (y, 160);
mpz_set_str (z, "77031627725494291259359895954016675357279104942148788042", 10);
- mpfr_set_z (x, z, GMP_RNDN);
+ mpfr_set_z (x, z, MPFR_RNDN);
mpfr_set_str_binary (y, "0.1100100100001111110110101010001000100001011010001100001000110100110001001100011001100010100010111000000011011100000111001101000100101001000000100100111000001001E186");
if (mpfr_cmp (x, y))
{
@@ -97,12 +97,12 @@ check_large (void)
emax = mpfr_get_emax ();
set_emax (2);
mpz_set_str (z, "7", 10);
- mpfr_set_z (x, z, GMP_RNDU);
+ mpfr_set_z (x, z, MPFR_RNDU);
MPFR_ASSERTN(mpfr_inf_p (x) && mpfr_sgn (x) > 0);
set_emax (3);
mpfr_set_prec (x, 2);
mpz_set_str (z, "7", 10);
- mpfr_set_z (x, z, GMP_RNDU);
+ mpfr_set_z (x, z, MPFR_RNDU);
MPFR_ASSERTN(mpfr_inf_p (x) && mpfr_sgn (x) > 0);
set_emax (emax);
@@ -110,10 +110,10 @@ check_large (void)
emin = mpfr_get_emin ();
set_emin (3);
mpz_set_str (z, "1", 10);
- mpfr_set_z (x, z, GMP_RNDZ);
+ mpfr_set_z (x, z, MPFR_RNDZ);
MPFR_ASSERTN(mpfr_cmp_ui (x, 0) == 0 && MPFR_IS_POS(x));
set_emin (2);
- mpfr_set_z (x, z, GMP_RNDN);
+ mpfr_set_z (x, z, MPFR_RNDN);
MPFR_ASSERTN(mpfr_cmp_ui (x, 0) == 0 && MPFR_IS_POS(x));
set_emin (emin);
@@ -131,7 +131,7 @@ main (int argc, char *argv[])
tests_start_mpfr ();
check_large ();
- check (0, GMP_RNDN);
+ check (0, MPFR_RNDN);
for (j = 0; j < 200000; j++)
check (randlimb () & LONG_MAX, RND_RAND ());
check0 ();
diff --git a/tests/tsi_op.c b/tests/tsi_op.c
index 47af9668f..f709b0696 100644
--- a/tests/tsi_op.c
+++ b/tests/tsi_op.c
@@ -30,7 +30,7 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
{\
printf("Error for "s" and i=%d\n", i);\
printf("Expected %s\n", exp);\
- printf("Got "); mpfr_out_str (stdout, 16, 0, z, GMP_RNDN);\
+ printf("Got "); mpfr_out_str (stdout, 16, 0, z, MPFR_RNDN);\
putchar ('\n');\
exit(1);\
}
@@ -55,8 +55,8 @@ check_invert (void)
mpfr_t x;
mpfr_init2 (x, MPFR_PREC_MIN);
- mpfr_set_ui (x, 0xC, GMP_RNDN);
- mpfr_si_sub (x, -1, x, GMP_RNDD); /* -0001 - 1100 = - 1101 --> -1 0000 */
+ mpfr_set_ui (x, 0xC, MPFR_RNDN);
+ mpfr_si_sub (x, -1, x, MPFR_RNDD); /* -0001 - 1100 = - 1101 --> -1 0000 */
if (mpfr_cmp_si (x, -0x10) )
{
printf ("Special rounding error\n");
@@ -105,30 +105,30 @@ main (int argc, char *argv[])
mpfr_inits2 (53, x, z, (mpfr_ptr) 0);
for(i = 0 ; i < numberof (tab) ; i++)
{
- mpfr_set_str (x, tab[i].op1, 16, GMP_RNDN);
+ mpfr_set_str (x, tab[i].op1, 16, MPFR_RNDN);
y = tab[i].op2;
- mpfr_add_si (z, x, y, GMP_RNDZ);
- if (mpfr_cmp_str (z, tab[i].res_add, 16, GMP_RNDN))
+ mpfr_add_si (z, x, y, MPFR_RNDZ);
+ if (mpfr_cmp_str (z, tab[i].res_add, 16, MPFR_RNDN))
ERROR1("add_si", i, z, tab[i].res_add);
- mpfr_sub_si (z, x, y, GMP_RNDZ);
- if (mpfr_cmp_str (z, tab[i].res_sub, 16, GMP_RNDN))
+ mpfr_sub_si (z, x, y, MPFR_RNDZ);
+ if (mpfr_cmp_str (z, tab[i].res_sub, 16, MPFR_RNDN))
ERROR1("sub_si", i, z, tab[i].res_sub);
- mpfr_si_sub (z, y, x, GMP_RNDZ);
- mpfr_neg (z, z, GMP_RNDZ);
- if (mpfr_cmp_str (z, tab[i].res_sub, 16, GMP_RNDN))
+ mpfr_si_sub (z, y, x, MPFR_RNDZ);
+ mpfr_neg (z, z, MPFR_RNDZ);
+ if (mpfr_cmp_str (z, tab[i].res_sub, 16, MPFR_RNDN))
ERROR1("si_sub", i, z, tab[i].res_sub);
- mpfr_mul_si (z, x, y, GMP_RNDZ);
- if (mpfr_cmp_str (z, tab[i].res_mul, 16, GMP_RNDN))
+ mpfr_mul_si (z, x, y, MPFR_RNDZ);
+ if (mpfr_cmp_str (z, tab[i].res_mul, 16, MPFR_RNDN))
ERROR1("mul_si", i, z, tab[i].res_mul);
- mpfr_div_si (z, x, y, GMP_RNDZ);
- if (mpfr_cmp_str (z, tab[i].res_div, 16, GMP_RNDN))
+ mpfr_div_si (z, x, y, MPFR_RNDZ);
+ if (mpfr_cmp_str (z, tab[i].res_div, 16, MPFR_RNDN))
ERROR1("div_si", i, z, tab[i].res_div);
}
mpfr_set_str1 (x, "1");
- mpfr_si_div (z, 1024, x, GMP_RNDN);
+ mpfr_si_div (z, 1024, x, MPFR_RNDN);
if (mpfr_cmp_str1 (z, "1024"))
ERROR1("si_div", i, z, "1024");
- mpfr_si_div (z, -1024, x, GMP_RNDN);
+ mpfr_si_div (z, -1024, x, MPFR_RNDN);
if (mpfr_cmp_str1 (z, "-1024"))
ERROR1("si_div", i, z, "-1024");
diff --git a/tests/tsin.c b/tests/tsin.c
index d9670317c..df662d503 100644
--- a/tests/tsin.c
+++ b/tests/tsin.c
@@ -31,7 +31,7 @@ static int
test_sin (mpfr_ptr a, mpfr_srcptr b, mp_rnd_t rnd_mode)
{
int res;
- int ok = rnd_mode == GMP_RNDN && mpfr_number_p (b) && mpfr_get_prec (a)>=53;
+ int ok = rnd_mode == MPFR_RNDN && mpfr_number_p (b) && mpfr_get_prec (a)>=53;
if (ok)
{
mpfr_print_raw (b);
@@ -63,7 +63,7 @@ check53 (const char *xs, const char *sin_xs, mp_rnd_t rnd_mode)
printf ("mpfr_sin failed for x=%s, rnd=%s\n",
xs, mpfr_print_rnd_mode (rnd_mode));
printf ("mpfr_sin gives sin(x)=");
- mpfr_out_str (stdout, 10, 0, s, GMP_RNDN);
+ mpfr_out_str (stdout, 10, 0, s, MPFR_RNDN);
printf (", expected %s\n", sin_xs);
exit (1);
}
@@ -78,14 +78,14 @@ check53b (const char *xs, const char *sin_xs, mp_rnd_t rnd_mode)
mpfr_init2 (xx, 53);
mpfr_init2 (s, 53);
- mpfr_set_str (xx, xs, 2, GMP_RNDN); /* should be exact */
+ mpfr_set_str (xx, xs, 2, MPFR_RNDN); /* should be exact */
test_sin (s, xx, rnd_mode);
- if (mpfr_cmp_str (s, sin_xs, 2, GMP_RNDN))
+ if (mpfr_cmp_str (s, sin_xs, 2, MPFR_RNDN))
{
printf ("mpfr_sin failed in rounding mode %s for\n x = %s\n",
mpfr_print_rnd_mode (rnd_mode), xs);
printf (" got ");
- mpfr_out_str (stdout, 2, 0, s, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, s, MPFR_RNDN);
printf ("\nexpected %s\n", sin_xs);
exit (1);
}
@@ -100,17 +100,17 @@ test_sign (void)
int p, k;
mpfr_init2 (pid, 4096);
- mpfr_const_pi (pid, GMP_RNDD);
+ mpfr_const_pi (pid, MPFR_RNDD);
mpfr_init2 (piu, 4096);
- mpfr_const_pi (piu, GMP_RNDU);
+ mpfr_const_pi (piu, MPFR_RNDU);
mpfr_init (x);
mpfr_init2 (y, 2);
for (p = 8; p <= 128; p++)
for (k = 2; k <= 6; k += 2)
{
mpfr_set_prec (x, p);
- mpfr_mul_ui (x, pid, k, GMP_RNDD);
- test_sin (y, x, GMP_RNDN);
+ mpfr_mul_ui (x, pid, k, MPFR_RNDD);
+ test_sin (y, x, MPFR_RNDN);
if (MPFR_SIGN(y) > 0)
{
printf ("Error in test_sign for sin(%dpi-epsilon), prec = %d"
@@ -118,8 +118,8 @@ test_sign (void)
k, p);
exit (1);
}
- mpfr_mul_ui (x, piu, k, GMP_RNDU);
- test_sin (y, x, GMP_RNDN);
+ mpfr_mul_ui (x, piu, k, MPFR_RNDU);
+ test_sin (y, x, MPFR_RNDN);
if (MPFR_SIGN(y) < 0)
{
printf ("Error in test_sign for sin(%dpi+epsilon), prec = %d"
@@ -132,15 +132,15 @@ test_sign (void)
/* worst case on 53 bits */
mpfr_set_prec (x, 53);
mpfr_set_prec (y, 53);
- mpfr_set_str (x, "6134899525417045", 10, GMP_RNDN);
- test_sin (y, x, GMP_RNDN);
+ mpfr_set_str (x, "6134899525417045", 10, MPFR_RNDN);
+ test_sin (y, x, MPFR_RNDN);
mpfr_set_str_binary (x, "11011010111101011110111100010101010101110000000001011E-106");
MPFR_ASSERTN(mpfr_cmp (x, y) == 0);
/* Bug on Special cases */
mpfr_set_str_binary (x, "0.100011011010111101E-32");
- test_sin (y, x, GMP_RNDN);
- if (mpfr_cmp_str (y, "0.10001101101011110100000000000000000000000000000000000E-32", 2, GMP_RNDN))
+ test_sin (y, x, MPFR_RNDN);
+ if (mpfr_cmp_str (y, "0.10001101101011110100000000000000000000000000000000000E-32", 2, MPFR_RNDN))
{
printf("sin special 97 error:\nx=");
mpfr_dump (x); printf("y=");
@@ -152,7 +152,7 @@ test_sign (void)
mpfr_set_prec (y, 53);
mpfr_set_str_binary (x, "1.1001001000011111101101010100010001000010110100010011");
mpfr_set_str_binary (y, "1.1111111111111111111111111111111111111111111111111111e-1");
- test_sin (x, x, GMP_RNDZ);
+ test_sin (x, x, MPFR_RNDZ);
MPFR_ASSERTN(mpfr_cmp (x, y) == 0);
mpfr_clear (pid);
@@ -170,7 +170,7 @@ check_nans (void)
mpfr_init2 (y, 123L);
mpfr_set_nan (x);
- test_sin (y, x, GMP_RNDN);
+ test_sin (y, x, MPFR_RNDN);
if (! mpfr_nan_p (y))
{
printf ("Error: sin(NaN) != NaN\n");
@@ -178,7 +178,7 @@ check_nans (void)
}
mpfr_set_inf (x, 1);
- test_sin (y, x, GMP_RNDN);
+ test_sin (y, x, MPFR_RNDN);
if (! mpfr_nan_p (y))
{
printf ("Error: sin(Inf) != NaN\n");
@@ -186,7 +186,7 @@ check_nans (void)
}
mpfr_set_inf (x, -1);
- test_sin (y, x, GMP_RNDN);
+ test_sin (y, x, MPFR_RNDN);
if (! mpfr_nan_p (y))
{
printf ("Error: sin(-Inf) != NaN\n");
@@ -213,11 +213,11 @@ check_regression (void)
p = strlen (xs) - 2 - 3;
mpfr_inits2 (p, x, y, (mpfr_ptr) 0);
- mpfr_set_str (x, xs, 2, GMP_RNDN);
- i = mpfr_sin (y, x, GMP_RNDN);
+ mpfr_set_str (x, xs, 2, MPFR_RNDN);
+ i = mpfr_sin (y, x, MPFR_RNDN);
if (i >= 0
|| mpfr_cmp_str (y, "0.111001110011110011110001010110011101110E-1",
- 2, GMP_RNDN))
+ 2, MPFR_RNDN))
{
printf ("Regression test failed (1) i=%d\ny=", i);
mpfr_dump (y);
@@ -235,33 +235,33 @@ check_tiny (void)
mpfr_init2 (x, 53);
mpfr_init2 (y, 53);
- mpfr_set_ui (x, 1, GMP_RNDN);
+ mpfr_set_ui (x, 1, MPFR_RNDN);
mpfr_set_exp (x, mpfr_get_emin ());
- mpfr_sin (y, x, GMP_RNDD);
+ mpfr_sin (y, x, MPFR_RNDD);
if (mpfr_cmp (x, y) < 0)
{
printf ("Error in check_tiny: got sin(x) > x for x = 2^(emin-1)\n");
exit (1);
}
- mpfr_sin (y, x, GMP_RNDU);
- mpfr_mul_2ui (y, y, 1, GMP_RNDU);
+ mpfr_sin (y, x, MPFR_RNDU);
+ mpfr_mul_2ui (y, y, 1, MPFR_RNDU);
if (mpfr_cmp (x, y) > 0)
{
printf ("Error in check_tiny: got sin(x) < x/2 for x = 2^(emin-1)\n");
exit (1);
}
- mpfr_neg (x, x, GMP_RNDN);
- mpfr_sin (y, x, GMP_RNDU);
+ mpfr_neg (x, x, MPFR_RNDN);
+ mpfr_sin (y, x, MPFR_RNDU);
if (mpfr_cmp (x, y) > 0)
{
printf ("Error in check_tiny: got sin(x) < x for x = -2^(emin-1)\n");
exit (1);
}
- mpfr_sin (y, x, GMP_RNDD);
- mpfr_mul_2ui (y, y, 1, GMP_RNDD);
+ mpfr_sin (y, x, MPFR_RNDD);
+ mpfr_mul_2ui (y, y, 1, MPFR_RNDD);
if (mpfr_cmp (x, y) < 0)
{
printf ("Error in check_tiny: got sin(x) > x/2 for x = -2^(emin-1)\n");
@@ -283,38 +283,38 @@ main (int argc, char *argv[])
check_nans ();
/* worst case from PhD thesis of Vincent Lefe`vre: x=8980155785351021/2^54 */
- check53 ("4.984987858808754279e-1", "4.781075595393330379e-1", GMP_RNDN);
- check53 ("4.984987858808754279e-1", "4.781075595393329824e-1", GMP_RNDD);
- check53 ("4.984987858808754279e-1", "4.781075595393329824e-1", GMP_RNDZ);
- check53 ("4.984987858808754279e-1", "4.781075595393330379e-1", GMP_RNDU);
- check53 ("1.00031274099908640274", "8.416399183372403892e-1", GMP_RNDN);
- check53 ("1.00229256850978698523", "8.427074524447979442e-1", GMP_RNDZ);
- check53 ("1.00288304857059840103", "8.430252033025980029e-1", GMP_RNDZ);
- check53 ("1.00591265847407274059", "8.446508805292128885e-1", GMP_RNDN);
+ check53 ("4.984987858808754279e-1", "4.781075595393330379e-1", MPFR_RNDN);
+ check53 ("4.984987858808754279e-1", "4.781075595393329824e-1", MPFR_RNDD);
+ check53 ("4.984987858808754279e-1", "4.781075595393329824e-1", MPFR_RNDZ);
+ check53 ("4.984987858808754279e-1", "4.781075595393330379e-1", MPFR_RNDU);
+ check53 ("1.00031274099908640274", "8.416399183372403892e-1", MPFR_RNDN);
+ check53 ("1.00229256850978698523", "8.427074524447979442e-1", MPFR_RNDZ);
+ check53 ("1.00288304857059840103", "8.430252033025980029e-1", MPFR_RNDZ);
+ check53 ("1.00591265847407274059", "8.446508805292128885e-1", MPFR_RNDN);
/* Other worst cases showing a bug introduced on 2005-01-29 in rev 3248 */
check53b ("1.0111001111010111010111111000010011010001110001111011e-21",
"1.0111001111010111010111111000010011010001101001110001e-21",
- GMP_RNDU);
+ MPFR_RNDU);
check53b ("1.1011101111111010000001010111000010000111100100101101",
"1.1111100100101100001111100000110011110011010001010101e-1",
- GMP_RNDU);
+ MPFR_RNDU);
mpfr_init2 (x, 2);
- mpfr_set_str (x, "0.5", 10, GMP_RNDN);
- test_sin (x, x, GMP_RNDD);
+ mpfr_set_str (x, "0.5", 10, MPFR_RNDN);
+ test_sin (x, x, MPFR_RNDD);
if (mpfr_cmp_ui_2exp (x, 3, -3)) /* x != 0.375 = 3/8 */
{
- printf ("mpfr_sin(0.5, GMP_RNDD) failed with precision=2\n");
+ printf ("mpfr_sin(0.5, MPFR_RNDD) failed with precision=2\n");
exit (1);
}
/* bug found by Kevin Ryde */
- mpfr_const_pi (x, GMP_RNDN);
- mpfr_mul_ui (x, x, 3L, GMP_RNDN);
- mpfr_div_ui (x, x, 2L, GMP_RNDN);
- test_sin (x, x, GMP_RNDN);
+ mpfr_const_pi (x, MPFR_RNDN);
+ mpfr_mul_ui (x, x, 3L, MPFR_RNDN);
+ mpfr_div_ui (x, x, 2L, MPFR_RNDN);
+ test_sin (x, x, MPFR_RNDN);
if (mpfr_cmp_ui (x, 0) >= 0)
{
printf ("Error: wrong sign for sin(3*Pi/2)\n");
@@ -323,13 +323,13 @@ main (int argc, char *argv[])
/* Can fail on an assert */
mpfr_set_prec (x, 53);
- mpfr_set_str (x, "77291789194529019661184401408", 10, GMP_RNDN);
+ mpfr_set_str (x, "77291789194529019661184401408", 10, MPFR_RNDN);
mpfr_init2 (c, 4); mpfr_init2 (s, 42);
mpfr_init2 (c2, 4); mpfr_init2 (s2, 42);
- test_sin (s, x, GMP_RNDN);
- mpfr_cos (c, x, GMP_RNDN);
- mpfr_sin_cos (s2, c2, x, GMP_RNDN);
+ test_sin (s, x, MPFR_RNDN);
+ mpfr_cos (c, x, MPFR_RNDN);
+ mpfr_sin_cos (s2, c2, x, MPFR_RNDN);
if (mpfr_cmp (c2, c))
{
printf("cos differs for x=77291789194529019661184401408");
@@ -342,8 +342,8 @@ main (int argc, char *argv[])
}
mpfr_set_str_binary (x, "1.1001001000011111101101010100010001000010110100010011");
- test_sin (x, x, GMP_RNDZ);
- if (mpfr_cmp_str (x, "1.1111111111111111111111111111111111111111111111111111e-1", 2, GMP_RNDN))
+ test_sin (x, x, MPFR_RNDZ);
+ if (mpfr_cmp_str (x, "1.1111111111111111111111111111111111111111111111111111e-1", 2, MPFR_RNDN))
{
printf ("Error for x= 1.1001001000011111101101010100010001000010110100010011\nGot ");
mpfr_dump (x);
diff --git a/tests/tsin_cos.c b/tests/tsin_cos.c
index f637493d5..b44ab8e32 100644
--- a/tests/tsin_cos.c
+++ b/tests/tsin_cos.c
@@ -34,11 +34,11 @@ large_test (int prec, int N)
mpfr_init2 (x, prec);
mpfr_init2 (s, prec);
mpfr_init2 (c, prec);
- mpfr_set_ui (x, 3, GMP_RNDN);
- mpfr_sqrt (x, x, GMP_RNDN);
+ mpfr_set_ui (x, 3, MPFR_RNDN);
+ mpfr_sqrt (x, x, MPFR_RNDN);
for (i=0; i<N; i++)
- mpfr_sin_cos (s, c, x, GMP_RNDN);
- mpfr_out_str (stdout, 10, 0, s, GMP_RNDN); puts ("");
+ mpfr_sin_cos (s, c, x, MPFR_RNDN);
+ mpfr_out_str (stdout, 10, 0, s, MPFR_RNDN); puts ("");
mpfr_clear (x);
mpfr_clear (s);
mpfr_clear (c);
@@ -58,7 +58,7 @@ check53 (const char *xs, const char *sin_xs, const char *cos_xs,
printf ("mpfr_sin_cos failed for x=%s, rnd=%s\n",
xs, mpfr_print_rnd_mode (rnd_mode));
printf ("mpfr_sin_cos gives sin(x)=");
- mpfr_out_str(stdout, 10, 0, s, GMP_RNDN);
+ mpfr_out_str(stdout, 10, 0, s, MPFR_RNDN);
printf(", expected %s\n", sin_xs);
exit (1);
}
@@ -67,7 +67,7 @@ check53 (const char *xs, const char *sin_xs, const char *cos_xs,
printf ("mpfr_sin_cos failed for x=%s, rnd=%s\n",
xs, mpfr_print_rnd_mode (rnd_mode));
printf ("mpfr_sin_cos gives cos(x)=");
- mpfr_out_str(stdout, 10, 0, c, GMP_RNDN);
+ mpfr_out_str(stdout, 10, 0, c, MPFR_RNDN);
printf(", expected %s\n", cos_xs);
exit (1);
}
@@ -87,7 +87,7 @@ check53sin (const char *xs, const char *sin_xs, mp_rnd_t rnd_mode)
printf ("mpfr_sin_cos failed for x=%s, rnd=%s\n",
xs, mpfr_print_rnd_mode (rnd_mode));
printf ("mpfr_sin_cos gives sin(x)=");
- mpfr_out_str(stdout, 10, 0, s, GMP_RNDN);
+ mpfr_out_str(stdout, 10, 0, s, MPFR_RNDN);
printf(", expected %s\n", sin_xs);
exit (1);
}
@@ -107,7 +107,7 @@ check53cos (const char *xs, const char *cos_xs, mp_rnd_t rnd_mode)
printf ("mpfr_sin_cos failed for x=%s, rnd=%s\n",
xs, mpfr_print_rnd_mode (rnd_mode));
printf ("mpfr_sin_cos gives cos(x)=");
- mpfr_out_str(stdout, 10, 0, c, GMP_RNDN);
+ mpfr_out_str(stdout, 10, 0, c, MPFR_RNDN);
printf(", expected %s\n", cos_xs);
exit (1);
}
@@ -125,38 +125,38 @@ check_nans (void)
/* sin(NaN)==NaN, cos(NaN)==NaN */
mpfr_set_nan (x);
- mpfr_sin_cos (s, c, x, GMP_RNDN);
+ mpfr_sin_cos (s, c, x, MPFR_RNDN);
MPFR_ASSERTN (mpfr_nan_p (s));
MPFR_ASSERTN (mpfr_nan_p (c));
/* sin(+Inf)==NaN, cos(+Inf)==NaN */
mpfr_set_inf (x, 1);
- mpfr_sin_cos (s, c, x, GMP_RNDN);
+ mpfr_sin_cos (s, c, x, MPFR_RNDN);
MPFR_ASSERTN (mpfr_nan_p (s));
MPFR_ASSERTN (mpfr_nan_p (c));
/* sin(-Inf)==NaN, cos(-Inf)==NaN */
mpfr_set_inf (x, -1);
- mpfr_sin_cos (s, c, x, GMP_RNDN);
+ mpfr_sin_cos (s, c, x, MPFR_RNDN);
MPFR_ASSERTN (mpfr_nan_p (s));
MPFR_ASSERTN (mpfr_nan_p (c));
/* check zero */
- mpfr_set_ui (x, 0, GMP_RNDN);
- mpfr_sin_cos (s, c, x, GMP_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_sin_cos (s, c, x, MPFR_RNDN);
MPFR_ASSERTN (mpfr_cmp_ui (s, 0) == 0 && MPFR_IS_POS (s));
MPFR_ASSERTN (mpfr_cmp_ui (c, 1) == 0);
- mpfr_neg (x, x, GMP_RNDN);
- mpfr_sin_cos (s, c, x, GMP_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN);
+ mpfr_sin_cos (s, c, x, MPFR_RNDN);
MPFR_ASSERTN (mpfr_cmp_ui (s, 0) == 0 && MPFR_IS_NEG (s));
MPFR_ASSERTN (mpfr_cmp_ui (c, 1) == 0);
/* coverage test */
mpfr_set_prec (x, 2);
- mpfr_set_ui (x, 4, GMP_RNDN);
+ mpfr_set_ui (x, 4, MPFR_RNDN);
mpfr_set_prec (s, 2);
mpfr_set_prec (c, 2);
- mpfr_sin_cos (s, c, x, GMP_RNDN);
+ mpfr_sin_cos (s, c, x, MPFR_RNDN);
MPFR_ASSERTN (mpfr_cmp_si_2exp (s, -3, -2) == 0);
MPFR_ASSERTN (mpfr_cmp_si_2exp (c, -3, -2) == 0);
@@ -180,14 +180,14 @@ overflowed_sin_cos0 (void)
for (emax = -1; emax <= 0; emax++)
{
- mpfr_set_ui_2exp (z, 1, emax, GMP_RNDN);
+ mpfr_set_ui_2exp (z, 1, emax, MPFR_RNDN);
mpfr_nextbelow (z);
set_emax (emax); /* 1 is not representable. */
/* and if emax < 0, 1 - eps is not representable either. */
RND_LOOP (rnd)
{
- mpfr_set_si (x, 0, GMP_RNDN);
- mpfr_neg (x, x, GMP_RNDN);
+ mpfr_set_si (x, 0, MPFR_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN);
mpfr_clear_flags ();
inex = mpfr_sin_cos (x, y, x, (mp_rnd_t) rnd);
if (! mpfr_overflow_p ())
@@ -205,7 +205,7 @@ overflowed_sin_cos0 (void)
printf (" instead of -0.\n");
err = 1;
}
- if (rnd == GMP_RNDZ || rnd == GMP_RNDD)
+ if (rnd == MPFR_RNDZ || rnd == MPFR_RNDD)
{
if (inex == 0)
{
@@ -264,9 +264,9 @@ tiny (void)
for (i = -1; i <= 1; i += 2)
{
- mpfr_set_si (x, i, GMP_RNDN);
+ mpfr_set_si (x, i, MPFR_RNDN);
mpfr_set_exp (x, mpfr_get_emin ());
- inex = mpfr_sin_cos (s, c, x, GMP_RNDN);
+ inex = mpfr_sin_cos (s, c, x, MPFR_RNDN);
MPFR_ASSERTN (inex != 0);
MPFR_ASSERTN (mpfr_equal_p (s, x));
MPFR_ASSERTN (!mpfr_nan_p (c) && mpfr_cmp_ui (c, 1) == 0);
@@ -284,8 +284,8 @@ test20071214 (void)
mpfr_init2 (a, 4);
mpfr_init2 (b, 4);
- mpfr_set_ui_2exp (a, 3, -4, GMP_RNDN);
- mpfr_sin_cos (a, b, a, GMP_RNDD);
+ mpfr_set_ui_2exp (a, 3, -4, MPFR_RNDN);
+ mpfr_sin_cos (a, b, a, MPFR_RNDD);
MPFR_ASSERTN(mpfr_cmp_ui_2exp (a, 11, -6) == 0);
MPFR_ASSERTN(mpfr_cmp_ui_2exp (b, 15, -4) == 0);
@@ -308,25 +308,25 @@ main(int argc, char *argv[])
/* worst case from PhD thesis of Vincent Lefe`vre: x=8980155785351021/2^54 */
check53 ("4.984987858808754279e-1", "4.781075595393330379e-1",
- "8.783012931285841817e-1", GMP_RNDN);
+ "8.783012931285841817e-1", MPFR_RNDN);
check53 ("4.984987858808754279e-1", "4.781075595393329824e-1",
- "8.783012931285840707e-1", GMP_RNDD);
+ "8.783012931285840707e-1", MPFR_RNDD);
check53 ("4.984987858808754279e-1", "4.781075595393329824e-1",
- "8.783012931285840707e-1", GMP_RNDZ);
+ "8.783012931285840707e-1", MPFR_RNDZ);
check53 ("4.984987858808754279e-1", "4.781075595393330379e-1",
- "8.783012931285841817e-1", GMP_RNDU);
+ "8.783012931285841817e-1", MPFR_RNDU);
check53 ("1.00031274099908640274", "8.416399183372403892e-1",
- "0.540039116973283217504", GMP_RNDN);
+ "0.540039116973283217504", MPFR_RNDN);
check53 ("1.00229256850978698523", "8.427074524447979442e-1",
- "0.538371757797526551137", GMP_RNDZ);
+ "0.538371757797526551137", MPFR_RNDZ);
check53 ("1.00288304857059840103", "8.430252033025980029e-1",
- "0.537874062022526966409", GMP_RNDZ);
+ "0.537874062022526966409", MPFR_RNDZ);
check53 ("1.00591265847407274059", "8.446508805292128885e-1",
- "0.53531755997839769456", GMP_RNDN);
+ "0.53531755997839769456", MPFR_RNDN);
/* check one argument only */
- check53sin ("1.00591265847407274059", "8.446508805292128885e-1", GMP_RNDN);
- check53cos ("1.00591265847407274059", "0.53531755997839769456", GMP_RNDN);
+ check53sin ("1.00591265847407274059", "8.446508805292128885e-1", MPFR_RNDN);
+ check53cos ("1.00591265847407274059", "0.53531755997839769456", MPFR_RNDN);
overflowed_sin_cos0 ();
tiny ();
diff --git a/tests/tsinh.c b/tests/tsinh.c
index 74ba83758..3368d9b03 100644
--- a/tests/tsinh.c
+++ b/tests/tsinh.c
@@ -39,51 +39,51 @@ special (void)
mpfr_init (x);
mpfr_set_nan (x);
- mpfr_sinh (x, x, GMP_RNDN);
+ mpfr_sinh (x, x, MPFR_RNDN);
MPFR_ASSERTN(mpfr_nan_p (x));
mpfr_set_inf (x, 1);
- mpfr_sinh (x, x, GMP_RNDN);
+ mpfr_sinh (x, x, MPFR_RNDN);
MPFR_ASSERTN(mpfr_inf_p (x) && mpfr_sgn (x) > 0);
mpfr_set_inf (x, -1);
- mpfr_sinh (x, x, GMP_RNDN);
+ mpfr_sinh (x, x, MPFR_RNDN);
MPFR_ASSERTN(mpfr_inf_p (x) && mpfr_sgn (x) < 0);
mpfr_set_prec (x, 10);
mpfr_set_str_binary (x, "-0.1001011001");
- mpfr_sinh (x, x, GMP_RNDN);
+ mpfr_sinh (x, x, MPFR_RNDN);
MPFR_ASSERTN(mpfr_cmp_si_2exp (x, -159, -8) == 0);
/* corner case */
mpfr_set_prec (x, 2);
mpfr_set_str_binary (x, "1E-6");
- mpfr_sinh (x, x, GMP_RNDN);
+ mpfr_sinh (x, x, MPFR_RNDN);
MPFR_ASSERTN(mpfr_cmp_ui_2exp (x, 1, -6) == 0);
mpfr_clear_flags ();
mpfr_set_str_binary (x, "1E1000000000");
- i = mpfr_sinh (x, x, GMP_RNDN);
+ i = mpfr_sinh (x, x, MPFR_RNDN);
MPFR_ASSERTN (MPFR_IS_INF (x) && MPFR_SIGN (x) > 0);
MPFR_ASSERTN (mpfr_overflow_p ());
MPFR_ASSERTN (i == 1);
mpfr_clear_flags ();
mpfr_set_str_binary (x, "-1E1000000000");
- i = mpfr_sinh (x, x, GMP_RNDN);
+ i = mpfr_sinh (x, x, MPFR_RNDN);
MPFR_ASSERTN (MPFR_IS_INF (x) && MPFR_SIGN (x) < 0);
MPFR_ASSERTN (mpfr_overflow_p () && !mpfr_underflow_p ());
MPFR_ASSERTN (i == -1);
mpfr_clear_flags ();
mpfr_set_str_binary (x, "-1E1000000000");
- i = mpfr_sinh (x, x, GMP_RNDD);
+ i = mpfr_sinh (x, x, MPFR_RNDD);
MPFR_ASSERTN (MPFR_IS_INF (x) && MPFR_SIGN (x) < 0);
MPFR_ASSERTN (mpfr_overflow_p () && !mpfr_underflow_p ());
MPFR_ASSERTN (i == -1);
mpfr_clear_flags ();
mpfr_set_str_binary (x, "-1E1000000000");
- i = mpfr_sinh (x, x, GMP_RNDU);
+ i = mpfr_sinh (x, x, MPFR_RNDU);
MPFR_ASSERTN (!MPFR_IS_INF (x) && MPFR_SIGN (x) < 0);
MPFR_ASSERTN (mpfr_overflow_p () && !mpfr_underflow_p ());
MPFR_ASSERTN (i == 1);
diff --git a/tests/tsinh_cosh.c b/tests/tsinh_cosh.c
index 58467ad19..edbc86c4a 100644
--- a/tests/tsinh_cosh.c
+++ b/tests/tsinh_cosh.c
@@ -31,15 +31,15 @@ static void
failed (mpfr_t x, mpfr_t esh, mpfr_t gsh, mpfr_t ech, mpfr_t gch)
{
printf ("error : mpfr_sinh_cosh (x) x = ");
- mpfr_out_str (stdout, 10, 0, x, GMP_RNDD);
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDD);
printf ("\nsinh(x) expected ");
- mpfr_out_str (stdout, 10, 0, esh, GMP_RNDD);
+ mpfr_out_str (stdout, 10, 0, esh, MPFR_RNDD);
printf ("\n got ");
- mpfr_out_str (stdout, 10, 0, gsh, GMP_RNDD);
+ mpfr_out_str (stdout, 10, 0, gsh, MPFR_RNDD);
printf ("\ncosh(x) expected ");
- mpfr_out_str (stdout, 10, 0, ech, GMP_RNDD);
+ mpfr_out_str (stdout, 10, 0, ech, MPFR_RNDD);
printf ("\n got ");
- mpfr_out_str (stdout, 10, 0, gch, GMP_RNDD);
+ mpfr_out_str (stdout, 10, 0, gch, MPFR_RNDD);
putchar ('\n');
mpfr_clears (x, esh, gsh, ech, gch, (mpfr_ptr) 0);
@@ -77,13 +77,13 @@ check_nans (void)
/* nan */
mpfr_set_nan (x);
- mpfr_sinh_cosh (sh, ch, x, GMP_RNDN);
+ mpfr_sinh_cosh (sh, ch, x, MPFR_RNDN);
MPFR_ASSERTN (mpfr_nan_p (sh));
MPFR_ASSERTN (mpfr_nan_p (ch));
/* +inf */
mpfr_set_inf (x, 1);
- mpfr_sinh_cosh (sh, ch, x, GMP_RNDN);
+ mpfr_sinh_cosh (sh, ch, x, MPFR_RNDN);
MPFR_ASSERTN (mpfr_inf_p (sh));
MPFR_ASSERTN (mpfr_sgn (sh) > 0);
MPFR_ASSERTN (mpfr_inf_p (ch));
@@ -91,7 +91,7 @@ check_nans (void)
/* -inf */
mpfr_set_inf (x, -1);
- mpfr_sinh_cosh (sh, ch, x, GMP_RNDN);
+ mpfr_sinh_cosh (sh, ch, x, MPFR_RNDN);
MPFR_ASSERTN (mpfr_inf_p (sh));
MPFR_ASSERTN (mpfr_sgn (sh) < 0);
MPFR_ASSERTN (mpfr_inf_p (ch));
@@ -114,16 +114,16 @@ main (int argc, char *argv[])
/* check against values given by sinh(x), cosh(x) */
mpfr_init2 (x, 53);
- mpfr_set_str (x, "FEDCBA987654321p-48", 16, GMP_RNDN);
+ mpfr_set_str (x, "FEDCBA987654321p-48", 16, MPFR_RNDN);
for (i = 0; i < 10; ++i)
{
/* x = i - x / 2 : boggle sign and bits */
- mpfr_ui_sub (x, i, x, GMP_RNDD);
- mpfr_div_2ui (x, x, 2, GMP_RNDD);
+ mpfr_ui_sub (x, i, x, MPFR_RNDD);
+ mpfr_div_2ui (x, x, 2, MPFR_RNDD);
- check (x, GMP_RNDN);
- check (x, GMP_RNDU);
- check (x, GMP_RNDD);
+ check (x, MPFR_RNDN);
+ check (x, MPFR_RNDU);
+ check (x, MPFR_RNDD);
}
mpfr_clear (x);
diff --git a/tests/tsprintf.c b/tests/tsprintf.c
index a1ee9787a..0fdbb9ef8 100644
--- a/tests/tsprintf.c
+++ b/tests/tsprintf.c
@@ -255,8 +255,8 @@ decimal (void)
check_sprintf (" nan", "%010Re", x);
/* positive numbers */
- mpfr_set_str (x, "18993474.61279296875", 10, GMP_RNDN);
- mpfr_set_ui (z, 0, GMP_RNDD);
+ mpfr_set_str (x, "18993474.61279296875", 10, MPFR_RNDN);
+ mpfr_set_ui (z, 0, MPFR_RNDD);
/* simplest case right justified */
check_sprintf (" 1.899347461279296875e+07", "%30Re", x);
@@ -283,12 +283,12 @@ decimal (void)
check_sprintf ("+0e+00 ", "%+-30.0Re", z);
check_sprintf ("+0 ", "%+-30.0Rf", z);
/* decimal point, left justified, precision and rounding parameter */
- check_vsprintf ("1.9E+07 ", "%#-10.*R*E", 1, GMP_RNDN, x);
- check_vsprintf ("2.E+07 ", "%#*.*R*E", -10, 0, GMP_RNDN, x);
- check_vsprintf ("2.E+07 ", "%#-10.*R*G", 0, GMP_RNDN, x);
- check_vsprintf ("0.E+00 ", "%#-10.*R*E", 0, GMP_RNDN, z);
- check_vsprintf ("0. ", "%#-10.*R*F", 0, GMP_RNDN, z);
- check_vsprintf ("0. ", "%#-10.*R*G", 0, GMP_RNDN, z);
+ check_vsprintf ("1.9E+07 ", "%#-10.*R*E", 1, MPFR_RNDN, x);
+ check_vsprintf ("2.E+07 ", "%#*.*R*E", -10, 0, MPFR_RNDN, x);
+ check_vsprintf ("2.E+07 ", "%#-10.*R*G", 0, MPFR_RNDN, x);
+ check_vsprintf ("0.E+00 ", "%#-10.*R*E", 0, MPFR_RNDN, z);
+ check_vsprintf ("0. ", "%#-10.*R*F", 0, MPFR_RNDN, z);
+ check_vsprintf ("0. ", "%#-10.*R*G", 0, MPFR_RNDN, z);
/* sign or space */
check_sprintf (" 1.899e+07", "% .3RNe", x);
check_sprintf (" 2e+07", "% .0RNe", x);
@@ -305,8 +305,8 @@ decimal (void)
check_sprintf (" 1.E+07 ", "%- #11.0RDE", x);
/* negative numbers */
- mpfr_mul_si (x, x, -1, GMP_RNDD);
- mpfr_mul_si (z, z, -1, GMP_RNDD);
+ mpfr_mul_si (x, x, -1, MPFR_RNDD);
+ mpfr_mul_si (z, z, -1, MPFR_RNDD);
/* sign + or - */
check_sprintf (" -1.8e+07", "%+10.1RUe", x);
@@ -316,7 +316,7 @@ decimal (void)
/* neighborhood of 1 */
- mpfr_set_str (x, "0.9999", 10, GMP_RNDN);
+ mpfr_set_str (x, "0.9999", 10, MPFR_RNDN);
check_sprintf ("1E+00 ", "%-10.0RE", x);
check_sprintf ("1.0E+00 ", "%-10.1RE", x);
check_sprintf ("9.9990E-01", "%-10.4RE", x);
@@ -331,7 +331,7 @@ decimal (void)
check_sprintf ("0.9999 ", "%-#10.4RG", x);
/* multiple of 10 */
- mpfr_set_str (x, "1e17", 10, GMP_RNDN);
+ mpfr_set_str (x, "1e17", 10, MPFR_RNDN);
check_sprintf ("1e+17", "%Re", x);
check_sprintf ("1.000e+17", "%.3Re", x);
check_sprintf ("100000000000000000", "%Rf", x);
@@ -339,7 +339,7 @@ decimal (void)
check_sprintf ("100000000000000000", "%'Rf", x);
check_sprintf ("100000000000000000.0", "%'.1Rf", x);
- mpfr_ui_div (x, 1, x, GMP_RNDN); /* x=1e-17 */
+ mpfr_ui_div (x, 1, x, MPFR_RNDN); /* x=1e-17 */
check_sprintf ("1e-17", "%Re", x);
check_sprintf ("0.00000000000000001", "%Rf", x);
check_sprintf ("1e-17", "%Rg", x);
@@ -349,20 +349,20 @@ decimal (void)
check_sprintf ("1", "%.0RUf", x);
/* check rounding mode */
- mpfr_set_str (x, "0.0076", 10, GMP_RNDN);
+ mpfr_set_str (x, "0.0076", 10, MPFR_RNDN);
check_sprintf ("0.007", "%.3RDF", x);
check_sprintf ("0.007", "%.3RZF", x);
check_sprintf ("0.008", "%.3RF", x);
check_sprintf ("0.008", "%.3RUF", x);
/* limit test for the choice beetwen %f-style and %g-style */
- mpfr_set_str (x, "0.0000999", 10, GMP_RNDN);
+ mpfr_set_str (x, "0.0000999", 10, MPFR_RNDN);
check_sprintf ("0.0001", "%.0Rg", x);
check_sprintf ("9e-05", "%.0RDg", x);
check_sprintf ("0.0001", "%.2Rg", x);
/* trailing zeros */
- mpfr_set_si_2exp (x, -1, -15, GMP_RNDN); /* x=-2^-15 */
+ mpfr_set_si_2exp (x, -1, -15, MPFR_RNDN); /* x=-2^-15 */
check_sprintf ("-3.0517578125e-05", "%.30Rg", x);
check_sprintf ("-3.051757812500000000000000000000e-05", "%.30Re", x);
check_sprintf ("-3.05175781250000000000000000000e-05", "%#.30Rg", x);
@@ -370,13 +370,13 @@ decimal (void)
/* bug 20081023 */
check_sprintf ("-3.0517578125e-05", "%.30Rg", x);
- mpfr_set_str (x, "1.9999", 10, GMP_RNDN);
+ mpfr_set_str (x, "1.9999", 10, MPFR_RNDN);
check_sprintf ("1.999900 ", "%-#10.7RG", x);
check_sprintf ("1.9999 ", "%-10.7RG", x);
- mpfr_set_ui (x, 1, GMP_RNDN);
+ mpfr_set_ui (x, 1, MPFR_RNDN);
check_sprintf ("1.00000000000000000000000000000", "%#.30Rg", x);
check_sprintf ("1", "%.30Rg", x);
- mpfr_set_ui (x, 0, GMP_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
check_sprintf ("0.000000000000000000000000000000", "%#.30Rg", x);
check_sprintf ("0", "%.30Rg", x);
@@ -384,11 +384,11 @@ decimal (void)
mpfr_set_prec (x, 53);
/* Exponent zero has a plus sign */
- mpfr_set_str (x, "-9.95645044213728791504536275169812142849e-01", 10, GMP_RNDN);
+ mpfr_set_str (x, "-9.95645044213728791504536275169812142849e-01", 10, MPFR_RNDN);
check_sprintf ("-1.0e+00", "%- #0.1Re", x);
/* Decimal point and no figure after it with '#' flag and 'G' style */
- mpfr_set_str (x, "-9.90597761233942053494e-01", 10, GMP_RNDN);
+ mpfr_set_str (x, "-9.90597761233942053494e-01", 10, MPFR_RNDN);
check_sprintf ("-1.", "%- #0.1RG", x);
mpfr_clears (x, z, (mpfr_ptr) 0);
@@ -415,8 +415,8 @@ hexadecimal (void)
check_sprintf (nan_uc_str, "%RA", x);
/* regular numbers */
- mpfr_set_str (x, "FEDCBA9.87654321", 16, GMP_RNDN);
- mpfr_set_ui (z, 0, GMP_RNDZ);
+ mpfr_set_str (x, "FEDCBA9.87654321", 16, MPFR_RNDN);
+ mpfr_set_ui (z, 0, MPFR_RNDZ);
/* simplest case right justified */
check_sprintf (" 0xf.edcba987654321p+24", "%25Ra", x);
@@ -431,9 +431,9 @@ hexadecimal (void)
check_sprintf ("+0x8p+25 ", "%+-25.0Ra", x);
check_sprintf ("+0x0p+0 ", "%+-25.0Ra", z);
/* decimal point, left justified, precision and rounding parameter */
- check_vsprintf ("0XF.FP+24 ", "%#-10.*R*A", 1, GMP_RNDN, x);
- check_vsprintf ("0X8.P+25 ", "%#-10.*R*A", 0, GMP_RNDN, x);
- check_vsprintf ("0X0.P+0 ", "%#-10.*R*A", 0, GMP_RNDN, z);
+ check_vsprintf ("0XF.FP+24 ", "%#-10.*R*A", 1, MPFR_RNDN, x);
+ check_vsprintf ("0X8.P+25 ", "%#-10.*R*A", 0, MPFR_RNDN, x);
+ check_vsprintf ("0X0.P+0 ", "%#-10.*R*A", 0, MPFR_RNDN, z);
/* sign or space */
check_sprintf (" 0xf.eddp+24", "% .3RNa", x);
check_sprintf (" 0x8p+25", "% .0RNa", x);
@@ -448,8 +448,8 @@ hexadecimal (void)
check_sprintf (" 0XF.EP+24 " , "%- #11.1RDA", x);
check_sprintf (" 0XF.P+24 " , "%- #11.0RDA", x);
- mpfr_mul_si (x, x, -1, GMP_RNDD);
- mpfr_mul_si (z, z, -1, GMP_RNDD);
+ mpfr_mul_si (x, x, -1, MPFR_RNDD);
+ mpfr_mul_si (z, z, -1, MPFR_RNDD);
/* sign + or - */
check_sprintf ("-0xf.ep+24", "%+10.1RUa", x);
@@ -457,12 +457,12 @@ hexadecimal (void)
check_sprintf (" -0x0p+0", "%+10.0RUa", z);
/* rounding bit is zero */
- mpfr_set_str (x, "0xF.7", 16, GMP_RNDN);
+ mpfr_set_str (x, "0xF.7", 16, MPFR_RNDN);
check_sprintf ("0XFP+0", "%.0RNA", x);
/* tie case in round to nearest mode */
- mpfr_set_str (x, "0x0.8800000000000000p+3", 16, GMP_RNDN);
+ mpfr_set_str (x, "0x0.8800000000000000p+3", 16, MPFR_RNDN);
check_sprintf ("0x8.p-1", "%#.0RNa", x);
- mpfr_set_str (x, "-0x0.9800000000000000p+3", 16, GMP_RNDN);
+ mpfr_set_str (x, "-0x0.9800000000000000p+3", 16, MPFR_RNDN);
check_sprintf ("-0xap-1", "%.0RNa", x);
/* trailing zeros in fractional part */
check_sprintf ("-0X4.C0000000000000000000P+0", "%.20RNA", x);
@@ -489,8 +489,8 @@ binary (void)
check_sprintf (nan_str, "%Rb", x);
/* regular numbers */
- mpfr_set_str (x, "1110010101.1001101", 2, GMP_RNDN);
- mpfr_set_ui (z, 0, GMP_RNDN);
+ mpfr_set_str (x, "1110010101.1001101", 2, MPFR_RNDN);
+ mpfr_set_ui (z, 0, MPFR_RNDN);
/* simplest case: right justified */
check_sprintf (" 1.1100101011001101p+9", "%25Rb", x);
@@ -515,8 +515,8 @@ binary (void)
check_sprintf (" 1.1p+9 " , "%- #11.1RDb", x);
check_sprintf (" 1.1p+9 " , "%- #11.0RDb", x);
- mpfr_mul_si (x, x, -1, GMP_RNDD);
- mpfr_mul_si (z, z, -1, GMP_RNDD);
+ mpfr_mul_si (x, x, -1, MPFR_RNDD);
+ mpfr_mul_si (z, z, -1, MPFR_RNDD);
/* sign + or - */
check_sprintf (" -1.1p+9", "%+10.1RUb", x);
@@ -554,8 +554,8 @@ mixed (void)
mpz_init (mpz);
mpz_fib_ui (mpz, 64);
mpfr_init (x);
- mpfr_set_str (x, "-12345678.875", 10, GMP_RNDN);
- rnd = GMP_RNDD;
+ mpfr_set_str (x, "-12345678.875", 10, MPFR_RNDN);
+ rnd = MPFR_RNDD;
check_vsprintf ("121%", "%i%%", i);
check_vsprintf ("121% -1.2345678875E+07", "%i%% %RNE", i, x);
@@ -563,7 +563,7 @@ mixed (void)
check_vsprintf ("10610209857723, -1.2345678875e+07", "%Zi, %R*e", mpz, rnd,
x);
check_vsprintf ("-12345678.9, 121", "%.1Rf, %i", x, i);
- check_vsprintf ("-12345678, 1e240/45b352", "%.0R*f, %Qx", GMP_RNDZ, x, mpq);
+ check_vsprintf ("-12345678, 1e240/45b352", "%.0R*f, %Qx", MPFR_RNDZ, x, mpq);
n1 = check_vsprintf ("121, -12345678.875000000000, 1.290323", "%i, %.*Rf, %Ff%n",
i, 12, x, mpf, &n2);
if (n1 != n2)
@@ -600,7 +600,7 @@ locale_da_DK (void)
mpfr_init2 (x, p);
/* positive numbers */
- mpfr_set_str (x, "18993474.61279296875", 10, GMP_RNDN);
+ mpfr_set_str (x, "18993474.61279296875", 10, MPFR_RNDN);
/* simplest case right justified with thousands separator */
check_sprintf (" 1,899347461279296875e+07", "%'30Re", x);
@@ -614,8 +614,8 @@ locale_da_DK (void)
check_sprintf (" 000000018.993.474,61279296875", "%' 030.19RG", x);
check_sprintf (" 000000018.993.474,61279296875", "%' 030RF", x);
- mpfr_set_ui (x, 50, GMP_RNDN);
- mpfr_exp10 (x, x, GMP_RNDN);
+ mpfr_set_ui (x, 50, MPFR_RNDN);
+ mpfr_exp10 (x, x, MPFR_RNDN);
check_sprintf ("100000000000000000000000000000000000000000000000000", "%Rf",
x);
check_sprintf
@@ -697,8 +697,8 @@ random_double (void)
if (randlimb () % 2 == 0)
y = -y;
- mpfr_set_d (x, y, GMP_RNDN);
- if (y != mpfr_get_d (x, GMP_RNDN))
+ mpfr_set_d (x, y, MPFR_RNDN);
+ if (y != mpfr_get_d (x, MPFR_RNDN))
/* conversion error: skip this one */
continue;
@@ -787,7 +787,7 @@ bug20080610 (void)
mpfr_init2 (x, MPFR_LDBL_MANT_DIG);
y = -9.95645044213728791504536275169812142849e-01;
- mpfr_set_d (x, y, GMP_RNDN);
+ mpfr_set_d (x, y, MPFR_RNDN);
xi = mpfr_asprintf (&xs, "%- #0.*Re", 1, x);
yi = mpfr_asprintf (&ys, "%- #0.*e", 1, y);
@@ -822,7 +822,7 @@ bug20081214 (void)
mpfr_init2 (x, MPFR_LDBL_MANT_DIG);
y = -9.90597761233942053494e-01;
- mpfr_set_d (x, y, GMP_RNDN);
+ mpfr_set_d (x, y, MPFR_RNDN);
xi = mpfr_asprintf (&xs, "%- #0.*RG", 1, x);
yi = mpfr_asprintf (&ys, "%- #0.*G", 1, y);
diff --git a/tests/tsqr.c b/tests/tsqr.c
index a7988f9f0..15f153d01 100644
--- a/tests/tsqr.c
+++ b/tests/tsqr.c
@@ -68,7 +68,7 @@ check_random (mpfr_prec_t p)
{
mpfr_urandomb (x, RANDS);
if (MPFR_IS_PURE_FP(x))
- for (r = 0 ; r < GMP_RND_MAX ; r++)
+ for (r = 0 ; r < MPFR_RND_MAX ; r++)
{
inexact1 = mpfr_mul (y, x, x, (mp_rnd_t) r);
inexact2 = mpfr_sqr (z, x, (mp_rnd_t) r);
@@ -91,27 +91,27 @@ check_special (void)
mpfr_init (y);
mpfr_set_nan (x);
- mpfr_sqr (y, x, GMP_RNDN);
+ mpfr_sqr (y, x, MPFR_RNDN);
MPFR_ASSERTN (mpfr_nan_p (y));
mpfr_set_inf (x, 1);
- mpfr_sqr (y, x, GMP_RNDN);
+ mpfr_sqr (y, x, MPFR_RNDN);
MPFR_ASSERTN (mpfr_inf_p (y) && mpfr_sgn (y) > 0);
mpfr_set_inf (x, -1);
- mpfr_sqr (y, x, GMP_RNDN);
+ mpfr_sqr (y, x, MPFR_RNDN);
MPFR_ASSERTN (mpfr_inf_p (y) && mpfr_sgn (y) > 0);
- mpfr_set_ui (x, 0, GMP_RNDN);
- mpfr_sqr (y, x, GMP_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_sqr (y, x, MPFR_RNDN);
MPFR_ASSERTN (mpfr_zero_p (y));
emin = mpfr_get_emin ();
mpfr_set_emin (0);
- mpfr_set_ui (x, 1, GMP_RNDN);
- mpfr_div_2ui (x, x, 1, GMP_RNDN);
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_div_2ui (x, x, 1, MPFR_RNDN);
MPFR_ASSERTN (!mpfr_zero_p (x));
- mpfr_sqr (y, x, GMP_RNDN);
+ mpfr_sqr (y, x, MPFR_RNDN);
MPFR_ASSERTN (mpfr_zero_p (y));
mpfr_set_emin (emin);
diff --git a/tests/tsqrt.c b/tests/tsqrt.c
index 20b87a5df..fccfac057 100644
--- a/tests/tsqrt.c
+++ b/tests/tsqrt.c
@@ -30,7 +30,7 @@ static int
test_sqrt (mpfr_ptr a, mpfr_srcptr b, mp_rnd_t rnd_mode)
{
int res;
- int ok = rnd_mode == GMP_RNDN && mpfr_number_p (b);
+ int ok = rnd_mode == MPFR_RNDN && mpfr_number_p (b);
if (ok)
{
mpfr_print_raw (b);
@@ -61,7 +61,7 @@ check3 (const char *as, mp_rnd_t rnd_mode, const char *qs)
printf ("mpfr_sqrt failed for a=%s, rnd_mode=%s\n",
as, mpfr_print_rnd_mode (rnd_mode));
printf ("expected sqrt is %s, got ",qs);
- mpfr_out_str (stdout, 10, 0, q, GMP_RNDN);
+ mpfr_out_str (stdout, 10, 0, q, MPFR_RNDN);
putchar ('\n');
exit (1);
}
@@ -76,12 +76,12 @@ check4 (const char *as, mp_rnd_t rnd_mode, const char *Qs)
mpfr_init2 (q, 53);
mpfr_set_str1 (q, as);
test_sqrt (q, q, rnd_mode);
- if (mpfr_cmp_str (q, Qs, 16, GMP_RNDN))
+ if (mpfr_cmp_str (q, Qs, 16, MPFR_RNDN))
{
printf ("mpfr_sqrt failed for a=%s, rnd_mode=%s\n",
as, mpfr_print_rnd_mode(rnd_mode));
printf ("expected ");
- mpfr_out_str (stdout, 16, 0, q, GMP_RNDN);
+ mpfr_out_str (stdout, 16, 0, q, MPFR_RNDN);
printf ("\ngot %s\n", Qs);
mpfr_clear (q);
exit (1);
@@ -102,7 +102,7 @@ check24 (const char *as, mp_rnd_t rnd_mode, const char *qs)
printf ("mpfr_sqrt failed for a=%s, prec=24, rnd_mode=%s\n",
as, mpfr_print_rnd_mode(rnd_mode));
printf ("expected sqrt is %s, got ",qs);
- mpfr_out_str (stdout, 10, 0, q, GMP_RNDN);
+ mpfr_out_str (stdout, 10, 0, q, MPFR_RNDN);
printf ("\n");
exit (1);
}
@@ -116,13 +116,13 @@ check_diverse (const char *as, mp_prec_t p, const char *qs)
mpfr_init2 (q, p);
mpfr_set_str1 (q, as);
- test_sqrt (q, q, GMP_RNDN);
+ test_sqrt (q, q, MPFR_RNDN);
if (mpfr_cmp_str1 (q, qs))
{
printf ("mpfr_sqrt failed for a=%s, prec=%lu, rnd_mode=%s\n",
- as, p, mpfr_print_rnd_mode (GMP_RNDN));
+ as, p, mpfr_print_rnd_mode (MPFR_RNDN));
printf ("expected sqrt is %s, got ", qs);
- mpfr_out_str (stdout, 10, 0, q, GMP_RNDN);
+ mpfr_out_str (stdout, 10, 0, q, MPFR_RNDN);
printf ("\n");
exit (1);
}
@@ -134,52 +134,52 @@ check_diverse (const char *as, mp_prec_t p, const char *qs)
static void
check_float (void)
{
- check24("70368760954880.0", GMP_RNDN, "8.388609e6");
- check24("281474943156224.0", GMP_RNDN, "1.6777215e7");
- check24("70368777732096.0", GMP_RNDN, "8.388610e6");
- check24("281474909601792.0", GMP_RNDN, "1.6777214e7");
- check24("100216216748032.0", GMP_RNDN, "1.0010805e7");
- check24("120137273311232.0", GMP_RNDN, "1.0960715e7");
- check24("229674600890368.0", GMP_RNDN, "1.5155019e7");
- check24("70368794509312.0", GMP_RNDN, "8.388611e6");
- check24("281474876047360.0", GMP_RNDN, "1.6777213e7");
- check24("91214552498176.0", GMP_RNDN, "9.550631e6");
-
- check24("70368760954880.0", GMP_RNDZ, "8.388608e6");
- check24("281474943156224.0", GMP_RNDZ, "1.6777214e7");
- check24("70368777732096.0", GMP_RNDZ, "8.388609e6");
- check24("281474909601792.0", GMP_RNDZ, "1.6777213e7");
- check24("100216216748032.0", GMP_RNDZ, "1.0010805e7");
- check24("120137273311232.0", GMP_RNDZ, "1.0960715e7");
- check24("229674600890368.0", GMP_RNDZ, "1.5155019e7");
- check24("70368794509312.0", GMP_RNDZ, "8.38861e6");
- check24("281474876047360.0", GMP_RNDZ, "1.6777212e7");
- check24("91214552498176.0", GMP_RNDZ, "9.550631e6");
-
- check24("70368760954880.0", GMP_RNDU, "8.388609e6");
- check24("281474943156224.0",GMP_RNDU, "1.6777215e7");
- check24("70368777732096.0", GMP_RNDU, "8.388610e6");
- check24("281474909601792.0", GMP_RNDU, "1.6777214e7");
- check24("100216216748032.0", GMP_RNDU, "1.0010806e7");
- check24("120137273311232.0", GMP_RNDU, "1.0960716e7");
- check24("229674600890368.0", GMP_RNDU, "1.515502e7");
- check24("70368794509312.0", GMP_RNDU, "8.388611e6");
- check24("281474876047360.0", GMP_RNDU, "1.6777213e7");
- check24("91214552498176.0", GMP_RNDU, "9.550632e6");
-
- check24("70368760954880.0", GMP_RNDD, "8.388608e6");
- check24("281474943156224.0", GMP_RNDD, "1.6777214e7");
- check24("70368777732096.0", GMP_RNDD, "8.388609e6");
- check24("281474909601792.0", GMP_RNDD, "1.6777213e7");
- check24("100216216748032.0", GMP_RNDD, "1.0010805e7");
- check24("120137273311232.0", GMP_RNDD, "1.0960715e7");
- check24("229674600890368.0", GMP_RNDD, "1.5155019e7");
- check24("70368794509312.0", GMP_RNDD, "8.38861e6");
- check24("281474876047360.0", GMP_RNDD, "1.6777212e7");
- check24("91214552498176.0", GMP_RNDD, "9.550631e6");
+ check24("70368760954880.0", MPFR_RNDN, "8.388609e6");
+ check24("281474943156224.0", MPFR_RNDN, "1.6777215e7");
+ check24("70368777732096.0", MPFR_RNDN, "8.388610e6");
+ check24("281474909601792.0", MPFR_RNDN, "1.6777214e7");
+ check24("100216216748032.0", MPFR_RNDN, "1.0010805e7");
+ check24("120137273311232.0", MPFR_RNDN, "1.0960715e7");
+ check24("229674600890368.0", MPFR_RNDN, "1.5155019e7");
+ check24("70368794509312.0", MPFR_RNDN, "8.388611e6");
+ check24("281474876047360.0", MPFR_RNDN, "1.6777213e7");
+ check24("91214552498176.0", MPFR_RNDN, "9.550631e6");
+
+ check24("70368760954880.0", MPFR_RNDZ, "8.388608e6");
+ check24("281474943156224.0", MPFR_RNDZ, "1.6777214e7");
+ check24("70368777732096.0", MPFR_RNDZ, "8.388609e6");
+ check24("281474909601792.0", MPFR_RNDZ, "1.6777213e7");
+ check24("100216216748032.0", MPFR_RNDZ, "1.0010805e7");
+ check24("120137273311232.0", MPFR_RNDZ, "1.0960715e7");
+ check24("229674600890368.0", MPFR_RNDZ, "1.5155019e7");
+ check24("70368794509312.0", MPFR_RNDZ, "8.38861e6");
+ check24("281474876047360.0", MPFR_RNDZ, "1.6777212e7");
+ check24("91214552498176.0", MPFR_RNDZ, "9.550631e6");
+
+ check24("70368760954880.0", MPFR_RNDU, "8.388609e6");
+ check24("281474943156224.0",MPFR_RNDU, "1.6777215e7");
+ check24("70368777732096.0", MPFR_RNDU, "8.388610e6");
+ check24("281474909601792.0", MPFR_RNDU, "1.6777214e7");
+ check24("100216216748032.0", MPFR_RNDU, "1.0010806e7");
+ check24("120137273311232.0", MPFR_RNDU, "1.0960716e7");
+ check24("229674600890368.0", MPFR_RNDU, "1.515502e7");
+ check24("70368794509312.0", MPFR_RNDU, "8.388611e6");
+ check24("281474876047360.0", MPFR_RNDU, "1.6777213e7");
+ check24("91214552498176.0", MPFR_RNDU, "9.550632e6");
+
+ check24("70368760954880.0", MPFR_RNDD, "8.388608e6");
+ check24("281474943156224.0", MPFR_RNDD, "1.6777214e7");
+ check24("70368777732096.0", MPFR_RNDD, "8.388609e6");
+ check24("281474909601792.0", MPFR_RNDD, "1.6777213e7");
+ check24("100216216748032.0", MPFR_RNDD, "1.0010805e7");
+ check24("120137273311232.0", MPFR_RNDD, "1.0960715e7");
+ check24("229674600890368.0", MPFR_RNDD, "1.5155019e7");
+ check24("70368794509312.0", MPFR_RNDD, "8.38861e6");
+ check24("281474876047360.0", MPFR_RNDD, "1.6777212e7");
+ check24("91214552498176.0", MPFR_RNDD, "9.550631e6");
/* check that rounding away is just rounding towards plus infinity */
- check24("91214552498176.0", GMP_RNDA, "9.550632e6");
+ check24("91214552498176.0", MPFR_RNDA, "9.550632e6");
}
static void
@@ -196,7 +196,7 @@ special (void)
mpfr_set_prec (x, 64);
mpfr_set_str_binary (x, "1010000010100011011001010101010010001100001101011101110001011001E-1");
mpfr_set_prec (y, 32);
- test_sqrt (y, x, GMP_RNDN);
+ test_sqrt (y, x, MPFR_RNDN);
if (mpfr_cmp_ui (y, 2405743844UL))
{
printf ("Error for n^2+n+1/2 with n=2405743843\n");
@@ -206,7 +206,7 @@ special (void)
mpfr_set_prec (x, 65);
mpfr_set_str_binary (x, "10100000101000110110010101010100100011000011010111011100010110001E-2");
mpfr_set_prec (y, 32);
- test_sqrt (y, x, GMP_RNDN);
+ test_sqrt (y, x, MPFR_RNDN);
if (mpfr_cmp_ui (y, 2405743844UL))
{
printf ("Error for n^2+n+1/4 with n=2405743843\n");
@@ -217,7 +217,7 @@ special (void)
mpfr_set_prec (x, 66);
mpfr_set_str_binary (x, "101000001010001101100101010101001000110000110101110111000101100011E-3");
mpfr_set_prec (y, 32);
- test_sqrt (y, x, GMP_RNDN);
+ test_sqrt (y, x, MPFR_RNDN);
if (mpfr_cmp_ui (y, 2405743844UL))
{
printf ("Error for n^2+n+1/4+1/8 with n=2405743843\n");
@@ -228,7 +228,7 @@ special (void)
mpfr_set_prec (x, 66);
mpfr_set_str_binary (x, "101000001010001101100101010101001000110000110101110111000101100001E-3");
mpfr_set_prec (y, 32);
- test_sqrt (y, x, GMP_RNDN);
+ test_sqrt (y, x, MPFR_RNDN);
if (mpfr_cmp_ui (y, 2405743843UL))
{
printf ("Error for n^2+n+1/8 with n=2405743843\n");
@@ -238,7 +238,7 @@ special (void)
mpfr_set_prec (x, 27);
mpfr_set_str_binary (x, "0.110100111010101000010001011");
- if ((inexact = test_sqrt (x, x, GMP_RNDZ)) >= 0)
+ if ((inexact = test_sqrt (x, x, MPFR_RNDZ)) >= 0)
{
printf ("Wrong inexact flag: expected -1, got %d\n", inexact);
exit (1);
@@ -248,9 +248,9 @@ special (void)
for (p=2; p<1000; p++)
{
mpfr_set_prec (z, p);
- mpfr_set_ui (z, 1, GMP_RNDN);
+ mpfr_set_ui (z, 1, MPFR_RNDN);
mpfr_nexttoinf (z);
- test_sqrt (x, z, GMP_RNDU);
+ test_sqrt (x, z, MPFR_RNDU);
if (mpfr_cmp_ui_2exp(x, 3, -1))
{
printf ("Error: sqrt(1+ulp(1), up) should give 1.5 (prec=%u)\n",
@@ -263,7 +263,7 @@ special (void)
/* check inexact flag */
mpfr_set_prec (x, 5);
mpfr_set_str_binary (x, "1.1001E-2");
- if ((inexact = test_sqrt (x, x, GMP_RNDN)))
+ if ((inexact = test_sqrt (x, x, MPFR_RNDN)))
{
printf ("Wrong inexact flag: expected 0, got %d\n", inexact);
exit (1);
@@ -273,9 +273,9 @@ special (void)
mpfr_set_prec (z, 2);
/* checks the sign is correctly set */
- mpfr_set_si (x, 1, GMP_RNDN);
- mpfr_set_si (z, -1, GMP_RNDN);
- test_sqrt (z, x, GMP_RNDN);
+ mpfr_set_si (x, 1, MPFR_RNDN);
+ mpfr_set_si (z, -1, MPFR_RNDN);
+ test_sqrt (z, x, MPFR_RNDN);
if (mpfr_cmp_ui (z, 0) < 0)
{
printf ("Error: square root of 1 gives ");
@@ -288,14 +288,14 @@ special (void)
mpfr_set_prec (z, 160);
mpfr_set_str_binary (z, "0.1011010100000100100100100110011001011100100100000011000111011001011101101101110000110100001000100001100001011000E1");
mpfr_set_prec (x, 160);
- test_sqrt(x, z, GMP_RNDN);
- test_sqrt(z, x, GMP_RNDN);
+ test_sqrt(x, z, MPFR_RNDN);
+ test_sqrt(z, x, MPFR_RNDN);
mpfr_set_prec (x, 53);
- mpfr_set_str (x, "8093416094703476.0", 10, GMP_RNDN);
- mpfr_div_2exp (x, x, 1075, GMP_RNDN);
- test_sqrt (x, x, GMP_RNDN);
- mpfr_set_str (z, "1e55596835b5ef@-141", 16, GMP_RNDN);
+ mpfr_set_str (x, "8093416094703476.0", 10, MPFR_RNDN);
+ mpfr_div_2exp (x, x, 1075, MPFR_RNDN);
+ test_sqrt (x, x, MPFR_RNDN);
+ mpfr_set_str (z, "1e55596835b5ef@-141", 16, MPFR_RNDN);
if (mpfr_cmp (x, z))
{
printf ("Error: square root of 8093416094703476*2^(-1075)\n");
@@ -307,7 +307,7 @@ special (void)
mpfr_set_prec (x, 33);
mpfr_set_str_binary (x, "0.111011011011110001100111111001000e-10");
mpfr_set_prec (z, 157);
- inexact = test_sqrt (z, x, GMP_RNDN);
+ inexact = test_sqrt (z, x, MPFR_RNDN);
mpfr_set_prec (x, 157);
mpfr_set_str_binary (x, "0.11110110101100101111001011100011100011100001101010111011010000100111011000111110100001001011110011111100101110010110010110011001011011010110010000011001101E-5");
if (mpfr_cmp (x, z))
@@ -326,48 +326,48 @@ special (void)
for (p = 2; p < 1000; p++)
{
mpfr_set_prec (x, p);
- mpfr_set_ui (x, 1, GMP_RNDN);
+ mpfr_set_ui (x, 1, MPFR_RNDN);
mpfr_nextabove (x);
/* 1.0 < x <= 1.5 thus 1 < sqrt(x) <= 1.23 */
- inexact = test_sqrt (z, x, GMP_RNDN);
+ inexact = test_sqrt (z, x, MPFR_RNDN);
MPFR_ASSERTN(inexact < 0 && mpfr_cmp_ui (z, 1) == 0);
- inexact = test_sqrt (z, x, GMP_RNDZ);
+ inexact = test_sqrt (z, x, MPFR_RNDZ);
MPFR_ASSERTN(inexact < 0 && mpfr_cmp_ui (z, 1) == 0);
- inexact = test_sqrt (z, x, GMP_RNDU);
+ inexact = test_sqrt (z, x, MPFR_RNDU);
MPFR_ASSERTN(inexact > 0 && mpfr_cmp_ui_2exp (z, 3, -1) == 0);
- inexact = test_sqrt (z, x, GMP_RNDD);
+ inexact = test_sqrt (z, x, MPFR_RNDD);
MPFR_ASSERTN(inexact < 0 && mpfr_cmp_ui (z, 1) == 0);
- inexact = test_sqrt (z, x, GMP_RNDA);
+ inexact = test_sqrt (z, x, MPFR_RNDA);
MPFR_ASSERTN(inexact > 0 && mpfr_cmp_ui_2exp (z, 3, -1) == 0);
}
/* corner case rw = 0 in rounding to nearest */
mpfr_set_prec (z, BITS_PER_MP_LIMB - 1);
mpfr_set_prec (y, BITS_PER_MP_LIMB - 1);
- mpfr_set_ui (y, 1, GMP_RNDN);
- mpfr_mul_2exp (y, y, BITS_PER_MP_LIMB - 1, GMP_RNDN);
+ mpfr_set_ui (y, 1, MPFR_RNDN);
+ mpfr_mul_2exp (y, y, BITS_PER_MP_LIMB - 1, MPFR_RNDN);
mpfr_nextabove (y);
for (p = 2 * BITS_PER_MP_LIMB - 1; p <= 1000; p++)
{
mpfr_set_prec (x, p);
- mpfr_set_ui (x, 1, GMP_RNDN);
+ mpfr_set_ui (x, 1, MPFR_RNDN);
mpfr_set_exp (x, BITS_PER_MP_LIMB);
- mpfr_add_ui (x, x, 1, GMP_RNDN);
+ mpfr_add_ui (x, x, 1, MPFR_RNDN);
/* now x = 2^(BITS_PER_MP_LIMB - 1) + 1 (BITS_PER_MP_LIMB bits) */
- MPFR_ASSERTN (mpfr_mul (x, x, x, GMP_RNDN) == 0); /* exact */
- inexact = test_sqrt (z, x, GMP_RNDN);
+ MPFR_ASSERTN (mpfr_mul (x, x, x, MPFR_RNDN) == 0); /* exact */
+ inexact = test_sqrt (z, x, MPFR_RNDN);
/* even rule: z should be 2^(BITS_PER_MP_LIMB - 1) */
MPFR_ASSERTN (inexact < 0);
MPFR_ASSERTN (mpfr_cmp_ui_2exp (z, 1, BITS_PER_MP_LIMB - 1) == 0);
mpfr_nextbelow (x);
/* now x is just below [2^(BITS_PER_MP_LIMB - 1) + 1]^2 */
- inexact = test_sqrt (z, x, GMP_RNDN);
+ inexact = test_sqrt (z, x, MPFR_RNDN);
MPFR_ASSERTN(inexact < 0 &&
mpfr_cmp_ui_2exp (z, 1, BITS_PER_MP_LIMB - 1) == 0);
mpfr_nextabove (x);
mpfr_nextabove (x);
/* now x is just above [2^(BITS_PER_MP_LIMB - 1) + 1]^2 */
- inexact = test_sqrt (z, x, GMP_RNDN);
+ inexact = test_sqrt (z, x, MPFR_RNDN);
if (mpfr_cmp (z, y))
{
printf ("Error for sqrt(x) in rounding to nearest\n");
@@ -384,9 +384,9 @@ special (void)
}
mpfr_set_prec (x, 1000);
- mpfr_set_ui (x, 9, GMP_RNDN);
+ mpfr_set_ui (x, 9, MPFR_RNDN);
mpfr_set_prec (y, 10);
- inexact = test_sqrt (y, x, GMP_RNDN);
+ inexact = test_sqrt (y, x, MPFR_RNDN);
if (mpfr_cmp_ui (y, 3) || inexact != 0)
{
printf ("Error in sqrt(9:1000) for prec=10\n");
@@ -394,7 +394,7 @@ special (void)
}
mpfr_set_prec (y, BITS_PER_MP_LIMB);
mpfr_nextabove (x);
- inexact = test_sqrt (y, x, GMP_RNDN);
+ inexact = test_sqrt (y, x, MPFR_RNDN);
if (mpfr_cmp_ui (y, 3) || inexact >= 0)
{
printf ("Error in sqrt(9:1000) for prec=%d\n", (int) BITS_PER_MP_LIMB);
@@ -402,10 +402,10 @@ special (void)
}
mpfr_set_prec (x, 2 * BITS_PER_MP_LIMB);
mpfr_set_prec (y, BITS_PER_MP_LIMB);
- mpfr_set_ui (y, 1, GMP_RNDN);
+ mpfr_set_ui (y, 1, MPFR_RNDN);
mpfr_nextabove (y);
- mpfr_set (x, y, GMP_RNDN);
- inexact = test_sqrt (y, x, GMP_RNDN);
+ mpfr_set (x, y, MPFR_RNDN);
+ inexact = test_sqrt (y, x, MPFR_RNDN);
if (mpfr_cmp_ui (y, 1) || inexact >= 0)
{
printf ("Error in sqrt(1) for prec=%d\n", (int) BITS_PER_MP_LIMB);
@@ -466,32 +466,32 @@ check_nan (void)
/* sqrt(NaN) == NaN */
MPFR_CLEAR_FLAGS (x);
MPFR_SET_NAN (x);
- MPFR_ASSERTN (test_sqrt (got, x, GMP_RNDZ) == 0); /* exact */
+ MPFR_ASSERTN (test_sqrt (got, x, MPFR_RNDZ) == 0); /* exact */
MPFR_ASSERTN (mpfr_nan_p (got));
/* sqrt(-1) == NaN */
- mpfr_set_si (x, -1L, GMP_RNDZ);
- MPFR_ASSERTN (test_sqrt (got, x, GMP_RNDZ) == 0); /* exact */
+ mpfr_set_si (x, -1L, MPFR_RNDZ);
+ MPFR_ASSERTN (test_sqrt (got, x, MPFR_RNDZ) == 0); /* exact */
MPFR_ASSERTN (mpfr_nan_p (got));
/* sqrt(+inf) == +inf */
MPFR_CLEAR_FLAGS (x);
MPFR_SET_INF (x);
MPFR_SET_POS (x);
- MPFR_ASSERTN (test_sqrt (got, x, GMP_RNDZ) == 0); /* exact */
+ MPFR_ASSERTN (test_sqrt (got, x, MPFR_RNDZ) == 0); /* exact */
MPFR_ASSERTN (mpfr_inf_p (got));
/* sqrt(-inf) == NaN */
MPFR_CLEAR_FLAGS (x);
MPFR_SET_INF (x);
MPFR_SET_NEG (x);
- MPFR_ASSERTN (test_sqrt (got, x, GMP_RNDZ) == 0); /* exact */
+ MPFR_ASSERTN (test_sqrt (got, x, MPFR_RNDZ) == 0); /* exact */
MPFR_ASSERTN (mpfr_nan_p (got));
/* sqrt(-0) == 0 */
- mpfr_set_si (x, 0L, GMP_RNDZ);
+ mpfr_set_si (x, 0L, MPFR_RNDZ);
MPFR_SET_NEG (x);
- MPFR_ASSERTN (test_sqrt (got, x, GMP_RNDZ) == 0); /* exact */
+ MPFR_ASSERTN (test_sqrt (got, x, MPFR_RNDZ) == 0); /* exact */
MPFR_ASSERTN (mpfr_number_p (got));
MPFR_ASSERTN (mpfr_cmp_ui (got, 0L) == 0);
@@ -572,10 +572,10 @@ main (void)
for (p = MPFR_PREC_MIN; p <= 128; p++)
{
- test_property1 (p, GMP_RNDN);
- test_property1 (p, GMP_RNDU);
- test_property1 (p, GMP_RNDA);
- test_property2 (p, GMP_RNDN);
+ test_property1 (p, MPFR_RNDN);
+ test_property1 (p, MPFR_RNDU);
+ test_property1 (p, MPFR_RNDA);
+ test_property2 (p, MPFR_RNDN);
}
check_diverse ("635030154261163106768013773815762607450069292760790610550915652722277604820131530404842415587328", 160, "796887792767063979679855997149887366668464780637");
@@ -587,103 +587,103 @@ main (void)
check_inexact (p);
check_float();
- check3 ("-0.0", GMP_RNDN, "0.0");
- check4 ("6.37983013646045901440e+32", GMP_RNDN, "5.9bc5036d09e0c@13");
- check4 ("1.0", GMP_RNDN, "1");
- check4 ("1.0", GMP_RNDZ, "1");
- check4 ("3.725290298461914062500000e-9", GMP_RNDN, "4@-4");
- check4 ("3.725290298461914062500000e-9", GMP_RNDZ, "4@-4");
- check4 ("1190456976439861.0", GMP_RNDZ, "2.0e7957873529a@6");
- check4 ("1219027943874417664.0", GMP_RNDZ, "4.1cf2af0e6a534@7");
+ check3 ("-0.0", MPFR_RNDN, "0.0");
+ check4 ("6.37983013646045901440e+32", MPFR_RNDN, "5.9bc5036d09e0c@13");
+ check4 ("1.0", MPFR_RNDN, "1");
+ check4 ("1.0", MPFR_RNDZ, "1");
+ check4 ("3.725290298461914062500000e-9", MPFR_RNDN, "4@-4");
+ check4 ("3.725290298461914062500000e-9", MPFR_RNDZ, "4@-4");
+ check4 ("1190456976439861.0", MPFR_RNDZ, "2.0e7957873529a@6");
+ check4 ("1219027943874417664.0", MPFR_RNDZ, "4.1cf2af0e6a534@7");
/* the following examples are bugs in Cygnus compiler/system, found by
Fabrice Rouillier while porting mpfr to Windows */
- check4 ("9.89438396044940256501e-134", GMP_RNDU, "8.7af7bf0ebbee@-56");
- check4 ("7.86528588050363751914e+31", GMP_RNDZ, "1.f81fc40f32062@13");
- check4 ("0.99999999999999988897", GMP_RNDN, "f.ffffffffffff8@-1");
- check4 ("1.00000000000000022204", GMP_RNDN, "1");
+ check4 ("9.89438396044940256501e-134", MPFR_RNDU, "8.7af7bf0ebbee@-56");
+ check4 ("7.86528588050363751914e+31", MPFR_RNDZ, "1.f81fc40f32062@13");
+ check4 ("0.99999999999999988897", MPFR_RNDN, "f.ffffffffffff8@-1");
+ check4 ("1.00000000000000022204", MPFR_RNDN, "1");
/* the following examples come from the paper "Number-theoretic Test
Generation for Directed Rounding" from Michael Parks, Table 4 */
- check4 ("78652858805036375191418371571712.0", GMP_RNDN,
+ check4 ("78652858805036375191418371571712.0", MPFR_RNDN,
"1.f81fc40f32063@13");
- check4 ("38510074998589467860312736661504.0", GMP_RNDN,
+ check4 ("38510074998589467860312736661504.0", MPFR_RNDN,
"1.60c012a92fc65@13");
- check4 ("35318779685413012908190921129984.0", GMP_RNDN,
+ check4 ("35318779685413012908190921129984.0", MPFR_RNDN,
"1.51d17526c7161@13");
- check4 ("26729022595358440976973142425600.0", GMP_RNDN,
+ check4 ("26729022595358440976973142425600.0", MPFR_RNDN,
"1.25e19302f7e51@13");
- check4 ("22696567866564242819241453027328.0", GMP_RNDN,
+ check4 ("22696567866564242819241453027328.0", MPFR_RNDN,
"1.0ecea7dd2ec3d@13");
- check4 ("22696888073761729132924856434688.0", GMP_RNDN,
+ check4 ("22696888073761729132924856434688.0", MPFR_RNDN,
"1.0ecf250e8e921@13");
- check4 ("36055652513981905145251657416704.0", GMP_RNDN,
+ check4 ("36055652513981905145251657416704.0", MPFR_RNDN,
"1.5552f3eedcf33@13");
- check4 ("30189856268896404997497182748672.0", GMP_RNDN,
+ check4 ("30189856268896404997497182748672.0", MPFR_RNDN,
"1.3853ee10c9c99@13");
- check4 ("36075288240584711210898775080960.0", GMP_RNDN,
+ check4 ("36075288240584711210898775080960.0", MPFR_RNDN,
"1.556abe212b56f@13");
- check4 ("72154663483843080704304789585920.0", GMP_RNDN,
+ check4 ("72154663483843080704304789585920.0", MPFR_RNDN,
"1.e2d9a51977e6e@13");
- check4 ("78652858805036375191418371571712.0", GMP_RNDZ,
+ check4 ("78652858805036375191418371571712.0", MPFR_RNDZ,
"1.f81fc40f32062@13");
- check4 ("38510074998589467860312736661504.0", GMP_RNDZ,
+ check4 ("38510074998589467860312736661504.0", MPFR_RNDZ,
"1.60c012a92fc64@13");
- check4 ("35318779685413012908190921129984.0", GMP_RNDZ, "1.51d17526c716@13");
- check4 ("26729022595358440976973142425600.0", GMP_RNDZ, "1.25e19302f7e5@13");
- check4 ("22696567866564242819241453027328.0", GMP_RNDZ,
+ check4 ("35318779685413012908190921129984.0", MPFR_RNDZ, "1.51d17526c716@13");
+ check4 ("26729022595358440976973142425600.0", MPFR_RNDZ, "1.25e19302f7e5@13");
+ check4 ("22696567866564242819241453027328.0", MPFR_RNDZ,
"1.0ecea7dd2ec3c@13");
- check4 ("22696888073761729132924856434688.0", GMP_RNDZ, "1.0ecf250e8e92@13");
- check4 ("36055652513981905145251657416704.0", GMP_RNDZ,
+ check4 ("22696888073761729132924856434688.0", MPFR_RNDZ, "1.0ecf250e8e92@13");
+ check4 ("36055652513981905145251657416704.0", MPFR_RNDZ,
"1.5552f3eedcf32@13");
- check4 ("30189856268896404997497182748672.0", GMP_RNDZ,
+ check4 ("30189856268896404997497182748672.0", MPFR_RNDZ,
"1.3853ee10c9c98@13");
- check4 ("36075288240584711210898775080960.0", GMP_RNDZ,
+ check4 ("36075288240584711210898775080960.0", MPFR_RNDZ,
"1.556abe212b56e@13");
- check4 ("72154663483843080704304789585920.0", GMP_RNDZ,
+ check4 ("72154663483843080704304789585920.0", MPFR_RNDZ,
"1.e2d9a51977e6d@13");
- check4 ("78652858805036375191418371571712.0", GMP_RNDU,
+ check4 ("78652858805036375191418371571712.0", MPFR_RNDU,
"1.f81fc40f32063@13");
- check4 ("38510074998589467860312736661504.0", GMP_RNDU,
+ check4 ("38510074998589467860312736661504.0", MPFR_RNDU,
"1.60c012a92fc65@13");
- check4 ("35318779685413012908190921129984.0", GMP_RNDU,
+ check4 ("35318779685413012908190921129984.0", MPFR_RNDU,
"1.51d17526c7161@13");
- check4 ("26729022595358440976973142425600.0", GMP_RNDU,
+ check4 ("26729022595358440976973142425600.0", MPFR_RNDU,
"1.25e19302f7e51@13");
- check4 ("22696567866564242819241453027328.0", GMP_RNDU,
+ check4 ("22696567866564242819241453027328.0", MPFR_RNDU,
"1.0ecea7dd2ec3d@13");
- check4 ("22696888073761729132924856434688.0", GMP_RNDU,
+ check4 ("22696888073761729132924856434688.0", MPFR_RNDU,
"1.0ecf250e8e921@13");
- check4 ("36055652513981905145251657416704.0", GMP_RNDU,
+ check4 ("36055652513981905145251657416704.0", MPFR_RNDU,
"1.5552f3eedcf33@13");
- check4 ("30189856268896404997497182748672.0", GMP_RNDU,
+ check4 ("30189856268896404997497182748672.0", MPFR_RNDU,
"1.3853ee10c9c99@13");
- check4 ("36075288240584711210898775080960.0", GMP_RNDU,
+ check4 ("36075288240584711210898775080960.0", MPFR_RNDU,
"1.556abe212b56f@13");
- check4 ("72154663483843080704304789585920.0", GMP_RNDU,
+ check4 ("72154663483843080704304789585920.0", MPFR_RNDU,
"1.e2d9a51977e6e@13");
- check4 ("78652858805036375191418371571712.0", GMP_RNDD,
+ check4 ("78652858805036375191418371571712.0", MPFR_RNDD,
"1.f81fc40f32062@13");
- check4 ("38510074998589467860312736661504.0", GMP_RNDD,
+ check4 ("38510074998589467860312736661504.0", MPFR_RNDD,
"1.60c012a92fc64@13");
- check4 ("35318779685413012908190921129984.0", GMP_RNDD, "1.51d17526c716@13");
- check4 ("26729022595358440976973142425600.0", GMP_RNDD, "1.25e19302f7e5@13");
- check4 ("22696567866564242819241453027328.0", GMP_RNDD,
+ check4 ("35318779685413012908190921129984.0", MPFR_RNDD, "1.51d17526c716@13");
+ check4 ("26729022595358440976973142425600.0", MPFR_RNDD, "1.25e19302f7e5@13");
+ check4 ("22696567866564242819241453027328.0", MPFR_RNDD,
"1.0ecea7dd2ec3c@13");
- check4 ("22696888073761729132924856434688.0", GMP_RNDD, "1.0ecf250e8e92@13");
- check4 ("36055652513981905145251657416704.0", GMP_RNDD,
+ check4 ("22696888073761729132924856434688.0", MPFR_RNDD, "1.0ecf250e8e92@13");
+ check4 ("36055652513981905145251657416704.0", MPFR_RNDD,
"1.5552f3eedcf32@13");
- check4 ("30189856268896404997497182748672.0", GMP_RNDD,
+ check4 ("30189856268896404997497182748672.0", MPFR_RNDD,
"1.3853ee10c9c98@13");
- check4 ("36075288240584711210898775080960.0", GMP_RNDD,
+ check4 ("36075288240584711210898775080960.0", MPFR_RNDD,
"1.556abe212b56e@13");
- check4 ("72154663483843080704304789585920.0", GMP_RNDD,
+ check4 ("72154663483843080704304789585920.0", MPFR_RNDD,
"1.e2d9a51977e6d@13");
/* check that rounding away is just rounding towards plus infinity */
- check4 ("72154663483843080704304789585920.0", GMP_RNDA,
+ check4 ("72154663483843080704304789585920.0", MPFR_RNDA,
"1.e2d9a51977e6e@13");
test_generic (2, 300, 15);
diff --git a/tests/tsqrt_ui.c b/tests/tsqrt_ui.c
index 5288fb908..6eac24594 100644
--- a/tests/tsqrt_ui.c
+++ b/tests/tsqrt_ui.c
@@ -37,7 +37,7 @@ check (unsigned long a, mp_rnd_t rnd_mode, const char *qs)
printf ("mpfr_sqrt_ui failed for a=%lu, rnd_mode=%s\n",
a, mpfr_print_rnd_mode (rnd_mode));
printf ("sqrt gives %s, mpfr_sqrt_ui gives ", qs);
- mpfr_out_str(stdout, 10, 0, q, GMP_RNDN);
+ mpfr_out_str(stdout, 10, 0, q, MPFR_RNDN);
exit (1);
}
mpfr_clear (q);
@@ -48,8 +48,8 @@ main (void)
{
tests_start_mpfr ();
- check (0, GMP_RNDN, "0.0");
- check (2116118, GMP_RNDU, "1.45468828276026215e3");
+ check (0, MPFR_RNDN, "0.0");
+ check (2116118, MPFR_RNDU, "1.45468828276026215e3");
tests_end_mpfr ();
return 0;
diff --git a/tests/tstckintc.c b/tests/tstckintc.c
index f4775db0a..4b26351b1 100644
--- a/tests/tstckintc.c
+++ b/tests/tstckintc.c
@@ -85,9 +85,9 @@ test1 (void)
org = stack;
x = new_mpfr (p);
y = new_mpfr (p);
- mpfr_set_ui (x, 42, GMP_RNDN);
- mpfr_set_ui (y, 17, GMP_RNDN);
- mpfr_add (y, x, y, GMP_RNDN);
+ mpfr_set_ui (x, 42, MPFR_RNDN);
+ mpfr_set_ui (y, 17, MPFR_RNDN);
+ mpfr_add (y, x, y, MPFR_RNDN);
y = return_mpfr (y, org);
if (y != x || mpfr_cmp_ui (y, 59) != 0)
{
@@ -119,7 +119,7 @@ dummy_set_si (long si)
mpfr_t x;
long * r = dummy_new ();
(mpfr_custom_init_set) (x, 0, 0, p, &r[2]);
- mpfr_set_si (x, si, GMP_RNDN);
+ mpfr_set_si (x, si, MPFR_RNDN);
r[0] = mpfr_custom_get_kind (x);
r[1] = mpfr_custom_get_exp (x);
return r;
@@ -133,7 +133,7 @@ dummy_add (long *a, long *b)
mpfr_custom_init_set (x, 0, 0, p, &r[2]);
(mpfr_custom_init_set) (y, a[0], a[1], p, &a[2]);
mpfr_custom_init_set (z, b[0], b[1], p, &b[2]);
- mpfr_add (x, y, z, GMP_RNDN);
+ mpfr_add (x, y, z, MPFR_RNDN);
r[0] = (mpfr_custom_get_kind) (x);
r[1] = (mpfr_custom_get_exp) (x);
return r;
diff --git a/tests/tstrtofr.c b/tests/tstrtofr.c
index bc200b7b2..047d9f9a7 100644
--- a/tests/tstrtofr.c
+++ b/tests/tstrtofr.c
@@ -38,8 +38,8 @@ check_special (void)
mpfr_init (y);
/* Check dummy case */
- res = mpfr_strtofr (x, "1234567.89E1", NULL, 10, GMP_RNDN);
- mpfr_set_str (y, "1234567.89E1", 10, GMP_RNDN);
+ res = mpfr_strtofr (x, "1234567.89E1", NULL, 10, MPFR_RNDN);
+ mpfr_set_str (y, "1234567.89E1", 10, MPFR_RNDN);
if (mpfr_cmp (x, y))
{
printf ("Results differ between strtofr and set_str.\n"
@@ -51,57 +51,57 @@ check_special (void)
}
/* Check NAN */
- mpfr_set_ui (x, 0, GMP_RNDN); /* make sure that x is modified */
- res = mpfr_strtofr (x, "NaN", &s, 10, GMP_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN); /* make sure that x is modified */
+ res = mpfr_strtofr (x, "NaN", &s, 10, MPFR_RNDN);
if (res != 0 || !mpfr_nan_p (x) || *s != 0)
{
printf ("Error for setting NAN (1)\n");
exit (1);
}
- mpfr_set_ui (x, 0, GMP_RNDN); /* make sure that x is modified */
- res = mpfr_strtofr (x, "+NaN", &s, 10, GMP_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN); /* make sure that x is modified */
+ res = mpfr_strtofr (x, "+NaN", &s, 10, MPFR_RNDN);
if (res != 0 || !mpfr_nan_p (x) || *s != 0)
{
printf ("Error for setting +NAN (1)\n");
exit (1);
}
- mpfr_set_ui (x, 0, GMP_RNDN); /* make sure that x is modified */
- res = mpfr_strtofr (x, " -NaN", &s, 10, GMP_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN); /* make sure that x is modified */
+ res = mpfr_strtofr (x, " -NaN", &s, 10, MPFR_RNDN);
if (res != 0 || !mpfr_nan_p (x) || *s != 0)
{
printf ("Error for setting -NAN (1)\n");
exit (1);
}
- mpfr_set_ui (x, 0, GMP_RNDN); /* make sure that x is modified */
- res = mpfr_strtofr (x, "@nAn@xx", &s, 16, GMP_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN); /* make sure that x is modified */
+ res = mpfr_strtofr (x, "@nAn@xx", &s, 16, MPFR_RNDN);
if (res != 0 || !mpfr_nan_p (x) || strcmp(s, "xx") )
{
printf ("Error for setting NAN (2)\n");
exit (1);
}
- mpfr_set_ui (x, 0, GMP_RNDN); /* make sure that x is modified */
- res = mpfr_strtofr (x, "NAN(abcdEDF__1256)Hello", &s, 10, GMP_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN); /* make sure that x is modified */
+ res = mpfr_strtofr (x, "NAN(abcdEDF__1256)Hello", &s, 10, MPFR_RNDN);
if (res != 0 || !mpfr_nan_p (x) || strcmp(s, "Hello") )
{
printf ("Error for setting NAN (3)\n");
exit (1);
}
- mpfr_set_ui (x, 0, GMP_RNDN); /* make sure that x is modified */
- res = mpfr_strtofr (x, "NAN(abcdEDF)__1256)Hello", &s, 10, GMP_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN); /* make sure that x is modified */
+ res = mpfr_strtofr (x, "NAN(abcdEDF)__1256)Hello", &s, 10, MPFR_RNDN);
if (res != 0 || !mpfr_nan_p (x) || strcmp(s, "__1256)Hello") )
{
printf ("Error for setting NAN (4)\n");
exit (1);
}
- mpfr_set_ui (x, 0, GMP_RNDN); /* make sure that x is modified */
- res = mpfr_strtofr (x, "NAN(abc%dEDF)__1256)Hello", &s, 10, GMP_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN); /* make sure that x is modified */
+ res = mpfr_strtofr (x, "NAN(abc%dEDF)__1256)Hello", &s, 10, MPFR_RNDN);
if (res != 0 || !mpfr_nan_p (x) || strcmp(s, "(abc%dEDF)__1256)Hello") )
{
printf ("Error for setting NAN (5)\n");
exit (1);
}
- mpfr_set_ui (x, 0, GMP_RNDN); /* make sure that x is modified */
- res = mpfr_strtofr (x, "NAN((abc))", &s, 10, GMP_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN); /* make sure that x is modified */
+ res = mpfr_strtofr (x, "NAN((abc))", &s, 10, MPFR_RNDN);
if (res != 0 || !mpfr_nan_p (x) || strcmp(s, "((abc))") )
{
printf ("Error for setting NAN (6)\n");
@@ -109,21 +109,21 @@ check_special (void)
}
/* Check INF */
- res = mpfr_strtofr (x, "INFINITY", &s, 8, GMP_RNDN);
+ res = mpfr_strtofr (x, "INFINITY", &s, 8, MPFR_RNDN);
if (res != 0 || !mpfr_inf_p (x) || *s != 0)
{
printf ("Error for setting INFINITY (1)\n s=%s\n x=", s);
mpfr_dump (x);
exit (1);
}
- res = mpfr_strtofr (x, "INFANITY", &s, 8, GMP_RNDN);
+ res = mpfr_strtofr (x, "INFANITY", &s, 8, MPFR_RNDN);
if (res != 0 || !mpfr_inf_p (x) || strcmp(s, "ANITY"))
{
printf ("Error for setting INFINITY (2)\n s=%s\n x=", s);
mpfr_dump (x);
exit (1);
}
- res = mpfr_strtofr (x, "@INF@*2", &s, 11, GMP_RNDN);
+ res = mpfr_strtofr (x, "@INF@*2", &s, 11, MPFR_RNDN);
if (res != 0 || !mpfr_inf_p (x) || strcmp(s, "*2"))
{
printf ("Error for setting INFINITY (3)\n s=%s\n x=", s);
@@ -132,7 +132,7 @@ check_special (void)
}
/* Check Zero */
- res = mpfr_strtofr (x, " 00000", &s, 11, GMP_RNDN);
+ res = mpfr_strtofr (x, " 00000", &s, 11, MPFR_RNDN);
if (res != 0 || !mpfr_zero_p (x) || s[0] != 0)
{
printf ("Error for setting ZERO (1)\n s=%s\n x=", s);
@@ -141,95 +141,95 @@ check_special (void)
}
/* Check base 62 */
- res = mpfr_strtofr (x, "A", NULL, 62, GMP_RNDN);
+ res = mpfr_strtofr (x, "A", NULL, 62, MPFR_RNDN);
if (res != 0 || mpfr_cmp_ui (x, 10))
{
printf ("Error for setting 'A' in base 62\n x=");
- mpfr_out_str (stdout, 10, 0, x, GMP_RNDN);
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN);
putchar ('\n');
exit (1);
}
- res = mpfr_strtofr (x, "a", NULL, 62, GMP_RNDN);
+ res = mpfr_strtofr (x, "a", NULL, 62, MPFR_RNDN);
if (res != 0 || mpfr_cmp_ui (x, 36))
{
printf ("Error for setting 'a' in base 62\n x=");
- mpfr_out_str (stdout, 10, 0, x, GMP_RNDN);
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN);
putchar ('\n');
exit (1);
}
- res = mpfr_strtofr (x, "Z", NULL, 62, GMP_RNDN);
+ res = mpfr_strtofr (x, "Z", NULL, 62, MPFR_RNDN);
if (res != 0 || mpfr_cmp_ui (x, 35))
{
printf ("Error for setting 'Z' in base 62\n x=");
- mpfr_out_str (stdout, 10, 0, x, GMP_RNDN);
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN);
putchar ('\n');
exit (1);
}
- res = mpfr_strtofr (x, "z", NULL, 62, GMP_RNDN);
+ res = mpfr_strtofr (x, "z", NULL, 62, MPFR_RNDN);
if (res != 0 || mpfr_cmp_ui (x, 61))
{
printf ("Error for setting 'z' in base 62\n x=");
- mpfr_out_str (stdout, 10, 0, x, GMP_RNDN);
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN);
putchar ('\n');
exit (1);
}
- res = mpfr_strtofr (x, "ZA", NULL, 62, GMP_RNDN);
+ res = mpfr_strtofr (x, "ZA", NULL, 62, MPFR_RNDN);
if (res != 0 || mpfr_cmp_ui (x, 2180))
{
printf ("Error for setting 'ZA' in base 62\n x=");
- mpfr_out_str (stdout, 10, 0, x, GMP_RNDN);
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN);
putchar ('\n');
exit (1);
}
- res = mpfr_strtofr (x, "za", NULL, 62, GMP_RNDN);
+ res = mpfr_strtofr (x, "za", NULL, 62, MPFR_RNDN);
if (res != 0 || mpfr_cmp_ui (x, 3818))
{
printf ("Error for setting 'za' in base 62\n x=");
- mpfr_out_str (stdout, 10, 0, x, GMP_RNDN);
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN);
putchar ('\n');
exit (1);
}
- res = mpfr_strtofr (x, "aZ", NULL, 62, GMP_RNDN);
+ res = mpfr_strtofr (x, "aZ", NULL, 62, MPFR_RNDN);
if (res != 0 || mpfr_cmp_ui (x, 2267))
{
printf ("Error for setting 'aZ' in base 62\n x=");
- mpfr_out_str (stdout, 10, 0, x, GMP_RNDN);
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN);
putchar ('\n');
exit (1);
}
- res = mpfr_strtofr (x, "Az", NULL, 62, GMP_RNDN);
+ res = mpfr_strtofr (x, "Az", NULL, 62, MPFR_RNDN);
if (res != 0 || mpfr_cmp_ui (x, 681))
{
printf ("Error for setting 'Az' in base 62\n x=");
- mpfr_out_str (stdout, 10, 0, x, GMP_RNDN);
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN);
putchar ('\n');
exit (1);
}
/* Check base 60 */
- res = mpfr_strtofr (x, "Aa", NULL, 60, GMP_RNDN);
+ res = mpfr_strtofr (x, "Aa", NULL, 60, MPFR_RNDN);
if (res != 0 || mpfr_cmp_ui (x, 636))
{
printf ("Error for setting 'Aa' in base 60\n x=");
- mpfr_out_str (stdout, 10, 0, x, GMP_RNDN);
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN);
putchar ('\n');
exit (1);
}
- res = mpfr_strtofr (x, "Zz", &s, 60, GMP_RNDN);
+ res = mpfr_strtofr (x, "Zz", &s, 60, MPFR_RNDN);
if (res != 0 || mpfr_cmp_ui (x, 35) || strcmp(s, "z") )
{
printf ("Error for setting 'Zz' in base 60\n x=");
- mpfr_out_str (stdout, 10, 0, x, GMP_RNDN);
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN);
putchar ('\n');
exit (1);
}
/* Check base 61 */
- res = mpfr_strtofr (x, "z", &s, 61, GMP_RNDN);
+ res = mpfr_strtofr (x, "z", &s, 61, MPFR_RNDN);
if (res != 0 || mpfr_cmp_ui (x, 0) || strcmp(s, "z") )
{
printf ("Error for setting 'z' in base 61\n x=");
- mpfr_out_str (stdout, 10, 0, x, GMP_RNDN);
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN);
putchar ('\n');
exit (1);
}
@@ -269,11 +269,11 @@ main (void)
e = randomab (-1<<15, 1<<15);
mpfr_set_prec (x, p);
mpfr_urandomb (x, RANDS);
- mpfr_mul_2si (x, x, e, GMP_RNDN);
+ mpfr_mul_2si (x, x, e, MPFR_RNDN);
printf("{%lu, %d,\n\"", p, base);
- mpfr_out_str (stdout, base, p, x, GMP_RNDN);
+ mpfr_out_str (stdout, base, p, x, MPFR_RNDN);
printf ("\",\n\"");
- mpfr_out_str (stdout, 2, 0, x, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN);
printf ("\"}%c\n", i == MAX_NUM-1 ? ' ' : ',' );
}
printf("};\n");
@@ -606,7 +606,7 @@ check_reftable (void)
mpfr_set_prec (x, p);
mpfr_set_prec (y, p);
mpfr_set_str_binary (x, RefTable[i].binstr);
- mpfr_strtofr (y, RefTable[i].str, &s, base, GMP_RNDN);
+ mpfr_strtofr (y, RefTable[i].str, &s, base, MPFR_RNDN);
if (s == NULL || *s != 0)
{
printf ("strtofr didn't parse entire input for i=%d:\n"
@@ -621,10 +621,10 @@ check_reftable (void)
printf (" strtofr gives: ");
mpfr_dump (y);
printf (" setstr gives: ");
- mpfr_set_str (x, RefTable[i].str, base, GMP_RNDN);
+ mpfr_set_str (x, RefTable[i].str, base, MPFR_RNDN);
mpfr_dump (x);
mpfr_set_prec (x, 2*p);
- mpfr_set_str (x, RefTable[i].str, base, GMP_RNDN);
+ mpfr_set_str (x, RefTable[i].str, base, MPFR_RNDN);
printf (" setstr ++ gives: ");
mpfr_dump (x);
exit (1);
@@ -644,8 +644,8 @@ check_parse (void)
mpfr_init (x);
/* Invalid data */
- mpfr_set_si (x, -1, GMP_RNDN);
- res = mpfr_strtofr (x, " invalid", NULL, 10, GMP_RNDN);
+ mpfr_set_si (x, -1, MPFR_RNDN);
+ res = mpfr_strtofr (x, " invalid", NULL, 10, MPFR_RNDN);
if (MPFR_NOTZERO (x) || MPFR_IS_NEG (x))
{
printf ("Failed parsing ' invalid' (1)\n X=");
@@ -653,8 +653,8 @@ check_parse (void)
exit (1);
}
MPFR_ASSERTN (res == 0);
- mpfr_set_si (x, -1, GMP_RNDN);
- res = mpfr_strtofr (x, " invalid", &s, 0, GMP_RNDN);
+ mpfr_set_si (x, -1, MPFR_RNDN);
+ res = mpfr_strtofr (x, " invalid", &s, 0, MPFR_RNDN);
if (MPFR_NOTZERO (x) || MPFR_IS_NEG (x) || strcmp (s, " invalid"))
{
printf ("Failed parsing ' invalid' (2)\n S=%s\n X=", s);
@@ -663,7 +663,7 @@ check_parse (void)
}
MPFR_ASSERTN (res == 0);
/* Check if it stops correctly */
- mpfr_strtofr (x, "15*x", &s, 10, GMP_RNDN);
+ mpfr_strtofr (x, "15*x", &s, 10, MPFR_RNDN);
if (mpfr_cmp_ui (x, 15) || strcmp (s, "*x"))
{
printf ("Failed parsing '15*x'\n S=%s\n X=", s);
@@ -671,7 +671,7 @@ check_parse (void)
exit (1);
}
/* Check for leading spaces */
- mpfr_strtofr (x, " 1.5E-10 *x^2", &s, 10, GMP_RNDN);
+ mpfr_strtofr (x, " 1.5E-10 *x^2", &s, 10, MPFR_RNDN);
if (mpfr_cmp_str1 (x, "1.5E-10") || strcmp (s, " *x^2"))
{
printf ("Failed parsing '1.5E-10*x^2'\n S=%s\n X=", s);
@@ -679,196 +679,196 @@ check_parse (void)
exit (1);
}
/* Check for leading sign */
- mpfr_strtofr (x, " +17.5E-42E ", &s, 10, GMP_RNDN);
+ mpfr_strtofr (x, " +17.5E-42E ", &s, 10, MPFR_RNDN);
if (mpfr_cmp_str1 (x, "17.5E-42") || strcmp (s, "E "))
{
printf ("Failed parsing '+17.5E-42E '\n S=%s\n X=", s);
- mpfr_out_str (stdout, 10, 0, x, GMP_RNDN); putchar ('\n');
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN); putchar ('\n');
exit (1);
}
- mpfr_strtofr (x, "-17.5E+42E\n", &s, 10, GMP_RNDN);
+ mpfr_strtofr (x, "-17.5E+42E\n", &s, 10, MPFR_RNDN);
if (mpfr_cmp_str1 (x, "-17.5E42") || strcmp (s, "E\n"))
{
printf ("Failed parsing '-17.5E+42\\n'\n S=%s\n X=", s);
- mpfr_out_str (stdout, 10, 0, x, GMP_RNDN); putchar ('\n');
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN); putchar ('\n');
exit (1);
}
/* P form */
- mpfr_strtofr (x, "0x42P17", &s, 16, GMP_RNDN);
- if (mpfr_cmp_str (x, "8650752", 10, GMP_RNDN) || *s != 0)
+ mpfr_strtofr (x, "0x42P17", &s, 16, MPFR_RNDN);
+ if (mpfr_cmp_str (x, "8650752", 10, MPFR_RNDN) || *s != 0)
{
printf ("Failed parsing '0x42P17' (base = 16)\n S='%s'\n X=", s);
- mpfr_out_str (stdout, 10, 0, x, GMP_RNDN); putchar ('\n');
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN); putchar ('\n');
exit (1);
}
- mpfr_strtofr (x, "-0X42p17", &s, 16, GMP_RNDN);
- if (mpfr_cmp_str (x, "-8650752", 10, GMP_RNDN) || *s != 0)
+ mpfr_strtofr (x, "-0X42p17", &s, 16, MPFR_RNDN);
+ if (mpfr_cmp_str (x, "-8650752", 10, MPFR_RNDN) || *s != 0)
{
printf ("Failed parsing '-0x42p17' (base = 16)\n S='%s'\n X=", s);
- mpfr_out_str (stdout, 10, 0, x, GMP_RNDN); putchar ('\n');
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN); putchar ('\n');
exit (1);
}
- mpfr_strtofr (x, "42p17", &s, 16, GMP_RNDN);
- if (mpfr_cmp_str (x, "8650752", 10, GMP_RNDN) || *s != 0)
+ mpfr_strtofr (x, "42p17", &s, 16, MPFR_RNDN);
+ if (mpfr_cmp_str (x, "8650752", 10, MPFR_RNDN) || *s != 0)
{
printf ("Failed parsing '42p17' (base = 16)\n S='%s'\n X=", s);
- mpfr_out_str (stdout, 10, 0, x, GMP_RNDN); putchar ('\n');
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN); putchar ('\n');
exit (1);
}
- mpfr_strtofr (x, "-42P17", &s, 16, GMP_RNDN);
- if (mpfr_cmp_str (x, "-8650752", 10, GMP_RNDN) || *s != 0)
+ mpfr_strtofr (x, "-42P17", &s, 16, MPFR_RNDN);
+ if (mpfr_cmp_str (x, "-8650752", 10, MPFR_RNDN) || *s != 0)
{
printf ("Failed parsing '-42P17' (base = 16)\n S='%s'\n X=", s);
- mpfr_out_str (stdout, 10, 0, x, GMP_RNDN); putchar ('\n');
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN); putchar ('\n');
exit (1);
}
- mpfr_strtofr (x, "0b1001P17", &s, 2, GMP_RNDN);
- if (mpfr_cmp_str (x, "1179648", 10, GMP_RNDN) || *s != 0)
+ mpfr_strtofr (x, "0b1001P17", &s, 2, MPFR_RNDN);
+ if (mpfr_cmp_str (x, "1179648", 10, MPFR_RNDN) || *s != 0)
{
printf ("Failed parsing '0b1001P17' (base = 2)\n S='%s'\n X=", s);
- mpfr_out_str (stdout, 10, 0, x, GMP_RNDN); putchar ('\n');
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN); putchar ('\n');
exit (1);
}
- mpfr_strtofr (x, "-0B1001p17", &s, 2, GMP_RNDN);
- if (mpfr_cmp_str (x, "-1179648", 10, GMP_RNDN) || *s != 0)
+ mpfr_strtofr (x, "-0B1001p17", &s, 2, MPFR_RNDN);
+ if (mpfr_cmp_str (x, "-1179648", 10, MPFR_RNDN) || *s != 0)
{
printf ("Failed parsing '-0B1001p17' (base = 2)\n S='%s'\n X=", s);
- mpfr_out_str (stdout, 10, 0, x, GMP_RNDN); putchar ('\n');
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN); putchar ('\n');
exit (1);
}
- mpfr_strtofr (x, "1001p17", &s, 2, GMP_RNDN);
- if (mpfr_cmp_str (x, "1179648", 10, GMP_RNDN) || *s != 0)
+ mpfr_strtofr (x, "1001p17", &s, 2, MPFR_RNDN);
+ if (mpfr_cmp_str (x, "1179648", 10, MPFR_RNDN) || *s != 0)
{
printf ("Failed parsing '1001p17' (base = 2)\n S='%s'\n X=", s);
- mpfr_out_str (stdout, 10, 0, x, GMP_RNDN); putchar ('\n');
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN); putchar ('\n');
exit (1);
}
- mpfr_strtofr (x, "-1001P17", &s, 2, GMP_RNDN);
- if (mpfr_cmp_str (x, "-1179648", 10, GMP_RNDN) || *s != 0)
+ mpfr_strtofr (x, "-1001P17", &s, 2, MPFR_RNDN);
+ if (mpfr_cmp_str (x, "-1179648", 10, MPFR_RNDN) || *s != 0)
{
printf ("Failed parsing '-1001P17' (base = 2)\n S='%s'\n X=", s);
- mpfr_out_str (stdout, 10, 0, x, GMP_RNDN); putchar ('\n');
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN); putchar ('\n');
exit (1);
}
/* Check for auto-detection of the base */
- mpfr_strtofr (x, "+0x42P17", &s, 0, GMP_RNDN);
- if (mpfr_cmp_str (x, "42P17", 16, GMP_RNDN) || *s != 0)
+ mpfr_strtofr (x, "+0x42P17", &s, 0, MPFR_RNDN);
+ if (mpfr_cmp_str (x, "42P17", 16, MPFR_RNDN) || *s != 0)
{
printf ("Failed parsing '+0x42P17'\n S=%s\n X=", s);
- mpfr_out_str (stdout, 16, 0, x, GMP_RNDN); putchar ('\n');
+ mpfr_out_str (stdout, 16, 0, x, MPFR_RNDN); putchar ('\n');
exit (1);
}
- mpfr_strtofr (x, "-42E17", &s, 0, GMP_RNDN);
- if (mpfr_cmp_str (x, "-42E17", 10, GMP_RNDN) || *s != 0)
+ mpfr_strtofr (x, "-42E17", &s, 0, MPFR_RNDN);
+ if (mpfr_cmp_str (x, "-42E17", 10, MPFR_RNDN) || *s != 0)
{
printf ("Failed parsing '-42E17'\n S=%s\n X=", s);
- mpfr_out_str (stdout, 10, 0, x, GMP_RNDN); putchar ('\n');
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN); putchar ('\n');
exit (1);
}
- mpfr_strtofr (x, "-42P17", &s, 0, GMP_RNDN);
- if (mpfr_cmp_str (x, "-42", 10, GMP_RNDN) || strcmp (s, "P17"))
+ mpfr_strtofr (x, "-42P17", &s, 0, MPFR_RNDN);
+ if (mpfr_cmp_str (x, "-42", 10, MPFR_RNDN) || strcmp (s, "P17"))
{
printf ("Failed parsing '-42P17' (base = 0)\n S='%s'\n X=", s);
- mpfr_out_str (stdout, 10, 0, x, GMP_RNDN); putchar ('\n');
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN); putchar ('\n');
exit (1);
}
- mpfr_strtofr (x, " 0b0101.011@42", &s, 0, GMP_RNDN);
- if (mpfr_cmp_str (x, "0101.011@42", 2, GMP_RNDN) || *s != 0)
+ mpfr_strtofr (x, " 0b0101.011@42", &s, 0, MPFR_RNDN);
+ if (mpfr_cmp_str (x, "0101.011@42", 2, MPFR_RNDN) || *s != 0)
{
printf ("Failed parsing '0101.011@42'\n S=%s\n X=", s);
- mpfr_out_str (stdout, 2, 0, x, GMP_RNDN); putchar ('\n');
+ mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN); putchar ('\n');
exit (1);
}
- mpfr_strtofr (x, " 0b0101.011P42", &s, 0, GMP_RNDN);
- if (mpfr_cmp_str (x, "0101.011@42", 2, GMP_RNDN) || *s != 0)
+ mpfr_strtofr (x, " 0b0101.011P42", &s, 0, MPFR_RNDN);
+ if (mpfr_cmp_str (x, "0101.011@42", 2, MPFR_RNDN) || *s != 0)
{
printf ("Failed parsing '0101.011@42'\n S=%s\n X=", s);
- mpfr_out_str (stdout, 2, 0, x, GMP_RNDN); putchar ('\n');
+ mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN); putchar ('\n');
exit (1);
}
- mpfr_strtofr (x, "+0x42@17", &s, 0, GMP_RNDN);
- if (mpfr_cmp_str (x, "4.2@18", 16, GMP_RNDN) || *s != 0)
+ mpfr_strtofr (x, "+0x42@17", &s, 0, MPFR_RNDN);
+ if (mpfr_cmp_str (x, "4.2@18", 16, MPFR_RNDN) || *s != 0)
{
printf ("Failed parsing '+0x42P17'\n S=%s\n X=", s);
- mpfr_out_str (stdout, 16, 0, x, GMP_RNDN); putchar ('\n');
+ mpfr_out_str (stdout, 16, 0, x, MPFR_RNDN); putchar ('\n');
exit (1);
}
/* Check for space inside the mantissa */
- mpfr_strtofr (x, "+0x4 2@17", &s, 0, GMP_RNDN);
+ mpfr_strtofr (x, "+0x4 2@17", &s, 0, MPFR_RNDN);
if (mpfr_cmp_ui (x, 4) || strcmp(s," 2@17"))
{
printf ("Failed parsing '+0x4 2@17'\n S=%s\n X=", s);
- mpfr_out_str (stdout, 16, 0, x, GMP_RNDN); putchar ('\n');
+ mpfr_out_str (stdout, 16, 0, x, MPFR_RNDN); putchar ('\n');
exit (1);
}
- mpfr_strtofr (x, "+0x42 P17", &s, 0, GMP_RNDN);
+ mpfr_strtofr (x, "+0x42 P17", &s, 0, MPFR_RNDN);
if (mpfr_cmp_ui (x, 0x42) || strcmp(s," P17"))
{
printf ("Failed parsing '+0x42 P17'\n S=%s\n X=", s);
- mpfr_out_str (stdout, 16, 0, x, GMP_RNDN); putchar ('\n');
+ mpfr_out_str (stdout, 16, 0, x, MPFR_RNDN); putchar ('\n');
exit (1);
}
/* Space between mantissa and exponent */
- mpfr_strtofr (x, " -0b0101P 17", &s, 0, GMP_RNDN);
+ mpfr_strtofr (x, " -0b0101P 17", &s, 0, MPFR_RNDN);
if (mpfr_cmp_si (x, -5) || strcmp(s,"P 17"))
{
printf ("Failed parsing '-0b0101P 17'\n S=%s\n X=", s);
- mpfr_out_str (stdout, 2, 0, x, GMP_RNDN); putchar ('\n');
+ mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN); putchar ('\n');
exit (1);
}
/* Check for Invalid exponent. */
- mpfr_strtofr (x, " -0b0101PF17", &s, 0, GMP_RNDN);
+ mpfr_strtofr (x, " -0b0101PF17", &s, 0, MPFR_RNDN);
if (mpfr_cmp_si (x, -5) || strcmp(s,"PF17"))
{
printf ("Failed parsing '-0b0101PF17'\n S=%s\n X=", s);
- mpfr_out_str (stdout, 2, 0, x, GMP_RNDN); putchar ('\n');
+ mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN); putchar ('\n');
exit (1);
}
/* At least one digit in the mantissa. */
- mpfr_strtofr (x, " .E10", &s, 0, GMP_RNDN);
+ mpfr_strtofr (x, " .E10", &s, 0, MPFR_RNDN);
if (strcmp(s," .E10"))
{
printf ("Failed parsing ' .E10'\n S=%s\n X=", s);
- mpfr_out_str (stdout, 10, 0, x, GMP_RNDN); putchar ('\n');
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN); putchar ('\n');
exit (1);
}
/* Check 2 '.': 2.3.4 */
- mpfr_strtofr (x, "-1.2.3E4", &s, 0, GMP_RNDN);
+ mpfr_strtofr (x, "-1.2.3E4", &s, 0, MPFR_RNDN);
if (mpfr_cmp_str1 (x, "-1.2") || strcmp(s,".3E4"))
{
printf ("Failed parsing '-1.2.3E4'\n S=%s\n X=", s);
- mpfr_out_str (stdout, 10, 0, x, GMP_RNDN); putchar ('\n');
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN); putchar ('\n');
exit (1);
}
/* Check for 0x and 0b */
- mpfr_strtofr (x, " 0xG", &s, 0, GMP_RNDN);
+ mpfr_strtofr (x, " 0xG", &s, 0, MPFR_RNDN);
if (mpfr_cmp_ui (x, 0) || strcmp(s,"xG"))
{
printf ("Failed parsing ' 0xG'\n S=%s\n X=", s);
- mpfr_out_str (stdout, 16, 0, x, GMP_RNDN); putchar ('\n');
+ mpfr_out_str (stdout, 16, 0, x, MPFR_RNDN); putchar ('\n');
exit (1);
}
- mpfr_strtofr (x, " 0b2", &s, 0, GMP_RNDN);
+ mpfr_strtofr (x, " 0b2", &s, 0, MPFR_RNDN);
if (mpfr_cmp_ui (x, 0) || strcmp(s,"b2"))
{
printf ("Failed parsing ' 0b2'\n S=%s\n X=", s);
- mpfr_out_str (stdout, 2, 0, x, GMP_RNDN); putchar ('\n');
+ mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN); putchar ('\n');
exit (1);
}
- mpfr_strtofr (x, "-0x.23@2Z33", &s, 0, GMP_RNDN);
+ mpfr_strtofr (x, "-0x.23@2Z33", &s, 0, MPFR_RNDN);
if (mpfr_cmp_si (x, -0x23) || strcmp(s,"Z33"))
{
printf ("Failed parsing '-0x.23@2Z33'\n S=%s\n X=", s);
- mpfr_out_str (stdout, 16, 0, x, GMP_RNDN); putchar ('\n');
+ mpfr_out_str (stdout, 16, 0, x, MPFR_RNDN); putchar ('\n');
exit (1);
}
- mpfr_strtofr (x, " 0x", &s, 0, GMP_RNDN);
+ mpfr_strtofr (x, " 0x", &s, 0, MPFR_RNDN);
if (mpfr_cmp_ui (x, 0) || strcmp(s,"x"))
{
printf ("Failed parsing ' 0x'\n S=%s\n X=", s);
- mpfr_out_str (stdout, 16, 0, x, GMP_RNDN); putchar ('\n');
+ mpfr_out_str (stdout, 16, 0, x, MPFR_RNDN); putchar ('\n');
exit (1);
}
@@ -884,14 +884,14 @@ check_overflow (void)
mpfr_init (x);
/* Huge overflow */
- mpfr_strtofr (x, "123456789E2147483646", &s, 0, GMP_RNDN);
+ mpfr_strtofr (x, "123456789E2147483646", &s, 0, MPFR_RNDN);
if (s[0] != 0 || !MPFR_IS_INF (x) || !MPFR_IS_POS (x) )
{
printf ("Check overflow failed (1) with:\n s=%s\n x=", s);
mpfr_dump (x);
exit (1);
}
- mpfr_strtofr (x, "123456789E9223372036854775807", &s, 0, GMP_RNDN);
+ mpfr_strtofr (x, "123456789E9223372036854775807", &s, 0, MPFR_RNDN);
if (s[0] != 0 || !MPFR_IS_INF (x) || !MPFR_IS_POS (x) )
{
printf ("Check overflow failed (2) with:\n s='%s'\n x=", s);
@@ -899,7 +899,7 @@ check_overflow (void)
exit (1);
}
mpfr_strtofr (x, "123456789E170141183460469231731687303715884105728",
- &s, 0, GMP_RNDN);
+ &s, 0, MPFR_RNDN);
if (s[0] != 0 || !MPFR_IS_INF (x) || !MPFR_IS_POS (x) )
{
printf ("Check overflow failed (3) with:\n s=%s\n x=", s);
@@ -908,28 +908,28 @@ check_overflow (void)
}
/* Limit overflow */
- mpfr_strtofr (x, "12E2147483646", &s, 0, GMP_RNDN);
+ mpfr_strtofr (x, "12E2147483646", &s, 0, MPFR_RNDN);
if (s[0] != 0 || !MPFR_IS_INF (x) || !MPFR_IS_POS (x) )
{
printf ("Check overflow failed (4) with:\n s=%s\n x=", s);
mpfr_dump (x);
exit (1);
}
- mpfr_strtofr (x, "12E2147483645", &s, 0, GMP_RNDN);
+ mpfr_strtofr (x, "12E2147483645", &s, 0, MPFR_RNDN);
if (s[0] != 0 || !MPFR_IS_INF (x) || !MPFR_IS_POS (x))
{
printf ("Check overflow failed (5) with:\n s=%s\n x=", s);
mpfr_dump (x);
exit (1);
}
- mpfr_strtofr (x, "0123456789ABCDEF@2147483640", &s, 16, GMP_RNDN);
+ mpfr_strtofr (x, "0123456789ABCDEF@2147483640", &s, 16, MPFR_RNDN);
if (s[0] != 0 || !MPFR_IS_INF (x) || !MPFR_IS_POS (x))
{
printf ("Check overflow failed (6) with:\n s=%s\n x=", s);
mpfr_dump (x);
exit (1);
}
- mpfr_strtofr (x, "0123456789ABCDEF@540000000", &s, 16, GMP_RNDN);
+ mpfr_strtofr (x, "0123456789ABCDEF@540000000", &s, 16, MPFR_RNDN);
if (s[0] != 0 || !MPFR_IS_INF (x) || !MPFR_IS_POS (x))
{
printf ("Check overflow failed (7) with:\n s=%s\n x=", s);
@@ -938,14 +938,14 @@ check_overflow (void)
}
/* Check underflow */
- mpfr_strtofr (x, "123456789E-2147483646", &s, 0, GMP_RNDN);
+ mpfr_strtofr (x, "123456789E-2147483646", &s, 0, MPFR_RNDN);
if (s[0] != 0 || !MPFR_IS_ZERO (x) || !MPFR_IS_POS (x) )
{
printf ("Check underflow failed (1) with:\n s=%s\n x=", s);
mpfr_dump (x);
exit (1);
}
- mpfr_strtofr (x, "123456789E-9223372036854775807", &s, 0, GMP_RNDN);
+ mpfr_strtofr (x, "123456789E-9223372036854775807", &s, 0, MPFR_RNDN);
if (s[0] != 0 || !MPFR_IS_ZERO (x) || !MPFR_IS_POS (x) )
{
printf ("Check underflow failed (2) with:\n s='%s'\n x=", s);
@@ -953,14 +953,14 @@ check_overflow (void)
exit (1);
}
mpfr_strtofr (x, "-123456789E-170141183460469231731687303715884105728",
- &s, 0, GMP_RNDN);
+ &s, 0, MPFR_RNDN);
if (s[0] != 0 || !MPFR_IS_ZERO (x) || !MPFR_IS_NEG (x) )
{
printf ("Check underflow failed (3) with:\n s=%s\n x=", s);
mpfr_dump (x);
exit (1);
}
- mpfr_strtofr (x, "0123456789ABCDEF@-540000000", &s, 16, GMP_RNDN);
+ mpfr_strtofr (x, "0123456789ABCDEF@-540000000", &s, 16, MPFR_RNDN);
if (s[0] != 0 || !MPFR_IS_ZERO (x) || !MPFR_IS_POS (x))
{
printf ("Check overflow failed (7) with:\n s=%s\n x=", s);
@@ -979,11 +979,11 @@ check_retval (void)
mpfr_init2 (x, 10);
- res = mpfr_strtofr (x, "01011000111", NULL, 2, GMP_RNDN);
+ res = mpfr_strtofr (x, "01011000111", NULL, 2, MPFR_RNDN);
MPFR_ASSERTN (res == 0);
- res = mpfr_strtofr (x, "11011000111", NULL, 2, GMP_RNDN);
+ res = mpfr_strtofr (x, "11011000111", NULL, 2, MPFR_RNDN);
MPFR_ASSERTN (res > 0);
- res = mpfr_strtofr (x, "110110001101", NULL, 2, GMP_RNDN);
+ res = mpfr_strtofr (x, "110110001101", NULL, 2, MPFR_RNDN);
MPFR_ASSERTN (res < 0);
mpfr_clear (x);
@@ -996,32 +996,32 @@ static struct bug20081025_test {
const char *str;
const char *binstr;
} Bug20081028Table[] = {
- {GMP_RNDN, -1, "1.00000000000000000006", "1"},
- {GMP_RNDZ, -1, "1.00000000000000000006", "1"},
- {GMP_RNDU, +1, "1.00000000000000000006",
+ {MPFR_RNDN, -1, "1.00000000000000000006", "1"},
+ {MPFR_RNDZ, -1, "1.00000000000000000006", "1"},
+ {MPFR_RNDU, +1, "1.00000000000000000006",
"10000000000000000000000000000001e-31"},
- {GMP_RNDD, -1, "1.00000000000000000006", "1"},
+ {MPFR_RNDD, -1, "1.00000000000000000006", "1"},
- {GMP_RNDN, +1, "-1.00000000000000000006", "-1"},
- {GMP_RNDZ, +1, "-1.00000000000000000006", "-1"},
- {GMP_RNDU, +1, "-1.00000000000000000006", "-1"},
- {GMP_RNDD, -1, "-1.00000000000000000006",
+ {MPFR_RNDN, +1, "-1.00000000000000000006", "-1"},
+ {MPFR_RNDZ, +1, "-1.00000000000000000006", "-1"},
+ {MPFR_RNDU, +1, "-1.00000000000000000006", "-1"},
+ {MPFR_RNDD, -1, "-1.00000000000000000006",
"-10000000000000000000000000000001e-31"},
- {GMP_RNDN, +1, "0.999999999999999999999999999999999999999999999", "1"},
- {GMP_RNDZ, -1, "0.999999999999999999999999999999999999999999999",
+ {MPFR_RNDN, +1, "0.999999999999999999999999999999999999999999999", "1"},
+ {MPFR_RNDZ, -1, "0.999999999999999999999999999999999999999999999",
"11111111111111111111111111111111e-32"},
- {GMP_RNDU, +1, "0.999999999999999999999999999999999999999999999", "1"},
- {GMP_RNDD, -1, "0.999999999999999999999999999999999999999999999",
+ {MPFR_RNDU, +1, "0.999999999999999999999999999999999999999999999", "1"},
+ {MPFR_RNDD, -1, "0.999999999999999999999999999999999999999999999",
"11111111111111111111111111111111e-32"},
- {GMP_RNDN, -1, "-0.999999999999999999999999999999999999999999999", "-1"},
- {GMP_RNDZ, +1, "-0.999999999999999999999999999999999999999999999",
+ {MPFR_RNDN, -1, "-0.999999999999999999999999999999999999999999999", "-1"},
+ {MPFR_RNDZ, +1, "-0.999999999999999999999999999999999999999999999",
"-11111111111111111111111111111111e-32"},
- {GMP_RNDU, +1, "-0.999999999999999999999999999999999999999999999",
+ {MPFR_RNDU, +1, "-0.999999999999999999999999999999999999999999999",
"-11111111111111111111111111111111e-32"},
- {GMP_RNDD, -1, "-0.999999999999999999999999999999999999999999999", "-1"}
+ {MPFR_RNDD, -1, "-0.999999999999999999999999999999999999999999999", "-1"}
};
static void
diff --git a/tests/tsub.c b/tests/tsub.c
index d2967a60c..e69feceb6 100644
--- a/tests/tsub.c
+++ b/tests/tsub.c
@@ -30,7 +30,7 @@ static int
test_sub (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mp_rnd_t rnd_mode)
{
int res;
- int ok = rnd_mode == GMP_RNDN && mpfr_number_p (b) && mpfr_number_p (c);
+ int ok = rnd_mode == MPFR_RNDN && mpfr_number_p (b) && mpfr_number_p (c);
if (ok)
{
mpfr_print_raw (b);
@@ -66,7 +66,7 @@ check_diverse (void)
mpfr_set_prec (z, 2);
mpfr_setmax (y, __gmpfr_emax);
mpfr_set_str_binary (z, "0.1E-10"); /* tiny */
- test_sub (x, y, z, GMP_RNDN); /* should round to 2^emax, i.e. overflow */
+ test_sub (x, y, z, MPFR_RNDN); /* should round to 2^emax, i.e. overflow */
if (!mpfr_inf_p (x) || mpfr_sgn (x) < 0)
{
printf ("Error in mpfr_sub(a,b,c,RNDN) for b=maxfloat, prec(a)<prec(b), c tiny\n");
@@ -77,9 +77,9 @@ check_diverse (void)
mpfr_set_prec (x, 2);
mpfr_set_prec (y, 2);
mpfr_set_prec (z, 2);
- mpfr_set_ui (y, 1, GMP_RNDN);
- mpfr_set_si (z, -2, GMP_RNDN);
- test_sub (x, y, z, GMP_RNDD);
+ mpfr_set_ui (y, 1, MPFR_RNDN);
+ mpfr_set_si (z, -2, MPFR_RNDN);
+ test_sub (x, y, z, MPFR_RNDD);
if (mpfr_cmp_ui (x, 3))
{
printf ("Error in mpfr_sub(1,-2,RNDD)\n");
@@ -91,7 +91,7 @@ check_diverse (void)
mpfr_set_prec (z, 288);
mpfr_set_str_binary (y, "0.111000110011000001000111101010111011110011101001101111111110000011100101000001001010110010101010011001010100000001110011110001010101101010001011101110100100001011110100110000101101100011010001001011011010101010000010001101001000110010010111111011110001111101001000101101001100101100101000E80");
mpfr_set_str_binary (z, "0.100001111111101001011010001100110010100111001110000110011101001011010100001000000100111011010110110010000000000010101101011000010000110001110010100001100101011100100100001011000100011110000001010101000100011101001000010111100000111000111011001000100100011000100000010010111000000100100111E-258");
- inexact = test_sub (x, y, z, GMP_RNDN);
+ inexact = test_sub (x, y, z, MPFR_RNDN);
if (inexact <= 0)
{
printf ("Wrong inexact flag for prec=288\n");
@@ -103,7 +103,7 @@ check_diverse (void)
mpfr_set_prec (z, 63);
mpfr_set_str_binary (x, "0.101101111011011100100100100111E31");
mpfr_set_str_binary (y, "0.111110010010100100110101101010001001100101110001000101110111111E-1");
- test_sub (z, x, y, GMP_RNDN);
+ test_sub (z, x, y, MPFR_RNDN);
mpfr_set_str_binary (y, "0.1011011110110111001001001001101100000110110101101100101001011E31");
if (mpfr_cmp (z, y))
{
@@ -116,7 +116,7 @@ check_diverse (void)
mpfr_set_prec (y, 63);
mpfr_set_prec (z, 63);
mpfr_set_str_binary (y, "0.1011011110110111001001001001101100000110110101101100101001011E31");
- mpfr_sub_ui (z, y, 1541116494, GMP_RNDN);
+ mpfr_sub_ui (z, y, 1541116494, MPFR_RNDN);
mpfr_set_str_binary (y, "-0.11111001001010010011010110101E-1");
if (mpfr_cmp (z, y))
{
@@ -129,7 +129,7 @@ check_diverse (void)
mpfr_set_prec (y, 63);
mpfr_set_prec (z, 63);
mpfr_set_str_binary (y, "0.1011011110110111001001001001101100000110110101101100101001011E31");
- mpfr_sub_ui (z, y, 1541116494, GMP_RNDN);
+ mpfr_sub_ui (z, y, 1541116494, MPFR_RNDN);
mpfr_set_str_binary (y, "-0.11111001001010010011010110101E-1");
if (mpfr_cmp (z, y))
{
@@ -143,7 +143,7 @@ check_diverse (void)
mpfr_set_prec (y, 32);
mpfr_set_str_binary (x, "0.10110111101001110100100101111000E0");
mpfr_set_str_binary (y, "0.10001100100101000100110111000100E0");
- if ((inexact = test_sub (x, x, y, GMP_RNDN)))
+ if ((inexact = test_sub (x, x, y, MPFR_RNDN)))
{
printf ("Wrong inexact flag (2): got %d instead of 0\n", inexact);
exit (1);
@@ -153,7 +153,7 @@ check_diverse (void)
mpfr_set_prec (y, 32);
mpfr_set_str_binary (x, "0.11111000110111011000100111011010E0");
mpfr_set_str_binary (y, "0.10011111101111000100001000000000E-3");
- if ((inexact = test_sub (x, x, y, GMP_RNDN)))
+ if ((inexact = test_sub (x, x, y, MPFR_RNDN)))
{
printf ("Wrong inexact flag (1): got %d instead of 0\n", inexact);
exit (1);
@@ -161,9 +161,9 @@ check_diverse (void)
mpfr_set_prec (x, 33);
mpfr_set_prec (y, 33);
- mpfr_set_ui (x, 1, GMP_RNDN);
+ mpfr_set_ui (x, 1, MPFR_RNDN);
mpfr_set_str_binary (y, "-0.1E-32");
- mpfr_add (x, x, y, GMP_RNDN);
+ mpfr_add (x, x, y, MPFR_RNDN);
mpfr_set_str_binary (y, "0.111111111111111111111111111111111E0");
if (mpfr_cmp (x, y))
{
@@ -175,9 +175,9 @@ check_diverse (void)
mpfr_set_prec (x, 32);
mpfr_set_prec (y, 33);
- mpfr_set_ui (x, 1, GMP_RNDN);
+ mpfr_set_ui (x, 1, MPFR_RNDN);
mpfr_set_str_binary (y, "-0.1E-32");
- mpfr_add (x, x, y, GMP_RNDN);
+ mpfr_add (x, x, y, MPFR_RNDN);
if (mpfr_cmp_ui (x, 1))
{
printf ("Error in mpfr_sub (1 - 1E-33) with prec=32\n");
@@ -190,13 +190,13 @@ check_diverse (void)
mpfr_set_prec (z, 64);
mpfr_set_str_binary (x, "1.1110111011110001110111011111111111101000011001011100101100101101");
mpfr_set_str_binary (y, "0.1110111011110001110111011111111111101000011001011100101100101100");
- test_sub (z, x, y, GMP_RNDZ);
+ test_sub (z, x, y, MPFR_RNDZ);
if (mpfr_cmp_ui (z, 1))
{
printf ("Error in mpfr_sub (1)\n");
exit (1);
}
- test_sub (z, x, y, GMP_RNDU);
+ test_sub (z, x, y, MPFR_RNDU);
mpfr_set_str_binary (x, "1.000000000000000000000000000000000000000000000000000000000000001");
if (mpfr_cmp (z, x))
{
@@ -204,13 +204,13 @@ check_diverse (void)
exit (1);
}
mpfr_set_str_binary (x, "1.1110111011110001110111011111111111101000011001011100101100101101");
- test_sub (z, x, y, GMP_RNDN);
+ test_sub (z, x, y, MPFR_RNDN);
if (mpfr_cmp_ui (z, 1))
{
printf ("Error in mpfr_sub (3)\n");
exit (1);
}
- inexact = test_sub (z, x, y, GMP_RNDA);
+ inexact = test_sub (z, x, y, MPFR_RNDA);
mpfr_set_str_binary (x, "1.000000000000000000000000000000000000000000000000000000000000001");
if (mpfr_cmp (z, x) || inexact <= 0)
{
@@ -219,7 +219,7 @@ check_diverse (void)
}
mpfr_set_prec (x, 66);
mpfr_set_str_binary (x, "1.11101110111100011101110111111111111010000110010111001011001010111");
- test_sub (z, x, y, GMP_RNDN);
+ test_sub (z, x, y, MPFR_RNDN);
if (mpfr_cmp_ui (z, 1))
{
printf ("Error in mpfr_sub (5)\n");
@@ -227,11 +227,11 @@ check_diverse (void)
}
/* check in-place operations */
- mpfr_set_ui (x, 1, GMP_RNDN);
- test_sub (x, x, x, GMP_RNDN);
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ test_sub (x, x, x, MPFR_RNDN);
if (mpfr_cmp_ui(x, 0))
{
- printf ("Error for mpfr_sub (x, x, x, GMP_RNDN) with x=1.0\n");
+ printf ("Error for mpfr_sub (x, x, x, MPFR_RNDN) with x=1.0\n");
exit (1);
}
@@ -240,12 +240,12 @@ check_diverse (void)
mpfr_set_prec (z, 53);
mpfr_set_str1 (x, "1.229318102e+09");
mpfr_set_str1 (y, "2.32221184180698677665e+05");
- test_sub (z, x, y, GMP_RNDN);
+ test_sub (z, x, y, MPFR_RNDN);
if (mpfr_cmp_str1 (z, "1229085880.815819263458251953125"))
{
printf ("Error in mpfr_sub (1.22e9 - 2.32e5)\n");
printf ("expected 1229085880.815819263458251953125, got ");
- mpfr_out_str(stdout, 10, 0, z, GMP_RNDN);
+ mpfr_out_str(stdout, 10, 0, z, MPFR_RNDN);
putchar('\n');
exit (1);
}
@@ -255,7 +255,7 @@ check_diverse (void)
mpfr_set_prec (z, 54);
mpfr_set_str_binary (x, "0.11111100100000000011000011100000101101010001000111E-401");
mpfr_set_str_binary (y, "0.10110000100100000101101100011111111011101000111000101E-464");
- test_sub (z, x, y, GMP_RNDN);
+ test_sub (z, x, y, MPFR_RNDN);
if (mpfr_cmp (z, x)) {
printf ("mpfr_sub(z, x, y) failed for prec(x)=112, prec(y)=98\n");
printf ("expected "); mpfr_print_binary (x); puts ("");
@@ -264,19 +264,19 @@ check_diverse (void)
}
mpfr_set_prec (x, 33);
- mpfr_set_ui (x, 1, GMP_RNDN);
- mpfr_div_2exp (x, x, 32, GMP_RNDN);
- mpfr_sub_ui (x, x, 1, GMP_RNDN);
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_div_2exp (x, x, 32, MPFR_RNDN);
+ mpfr_sub_ui (x, x, 1, MPFR_RNDN);
mpfr_set_prec (x, 5);
mpfr_set_prec (y, 5);
mpfr_set_str_binary (x, "1e-12");
- mpfr_set_ui (y, 1, GMP_RNDN);
- test_sub (x, y, x, GMP_RNDD);
+ mpfr_set_ui (y, 1, MPFR_RNDN);
+ test_sub (x, y, x, MPFR_RNDD);
mpfr_set_str_binary (y, "0.11111");
if (mpfr_cmp (x, y))
{
- printf ("Error in mpfr_sub (x, y, x, GMP_RNDD) for x=2^(-12), y=1\n");
+ printf ("Error in mpfr_sub (x, y, x, MPFR_RNDD) for x=2^(-12), y=1\n");
exit (1);
}
@@ -284,7 +284,7 @@ check_diverse (void)
mpfr_set_prec (y, 24);
mpfr_set_str_binary (x, "-0.100010000000000000000000E19");
mpfr_set_str_binary (y, "0.100000000000000000000100E15");
- mpfr_add (x, x, y, GMP_RNDD);
+ mpfr_add (x, x, y, MPFR_RNDD);
mpfr_set_str_binary (y, "-0.1E19");
if (mpfr_cmp (x, y))
{
@@ -295,14 +295,14 @@ check_diverse (void)
mpfr_set_prec (x, 2);
mpfr_set_prec (y, 10);
mpfr_set_prec (z, 10);
- mpfr_set_ui (y, 0, GMP_RNDN);
+ mpfr_set_ui (y, 0, MPFR_RNDN);
mpfr_set_str_binary (z, "0.10001");
- if (test_sub (x, y, z, GMP_RNDN) <= 0)
+ if (test_sub (x, y, z, MPFR_RNDN) <= 0)
{
printf ("Wrong inexact flag in x=mpfr_sub(0,z) for prec(z)>prec(x)\n");
exit (1);
}
- if (test_sub (x, z, y, GMP_RNDN) >= 0)
+ if (test_sub (x, z, y, MPFR_RNDN) >= 0)
{
printf ("Wrong inexact flag in x=mpfr_sub(z,0) for prec(z)>prec(x)\n");
exit (1);
@@ -325,13 +325,13 @@ bug_ddefour(void)
mpfr_init2(tot, 150);
mpfr_init2(tot1, 150);
- mpfr_set_ui( ex, 1, GMP_RNDN);
- mpfr_mul_2exp( ex, ex, 906, GMP_RNDN);
- mpfr_log( tot, ex, GMP_RNDN);
- mpfr_set( ex1, tot, GMP_RNDN); /* ex1 = high(tot) */
- test_sub( ex2, tot, ex1, GMP_RNDN); /* ex2 = high(tot - ex1) */
- test_sub( tot1, tot, ex1, GMP_RNDN); /* tot1 = tot - ex1 */
- mpfr_set( ex3, tot1, GMP_RNDN); /* ex3 = high(tot - ex1) */
+ mpfr_set_ui( ex, 1, MPFR_RNDN);
+ mpfr_mul_2exp( ex, ex, 906, MPFR_RNDN);
+ mpfr_log( tot, ex, MPFR_RNDN);
+ mpfr_set( ex1, tot, MPFR_RNDN); /* ex1 = high(tot) */
+ test_sub( ex2, tot, ex1, MPFR_RNDN); /* ex2 = high(tot - ex1) */
+ test_sub( tot1, tot, ex1, MPFR_RNDN); /* tot1 = tot - ex1 */
+ mpfr_set( ex3, tot1, MPFR_RNDN); /* ex3 = high(tot - ex1) */
if (mpfr_cmp(ex2, ex3))
{
@@ -366,7 +366,7 @@ check_two_sum (mp_prec_t p)
mpfr_urandomb (y, RANDS);
if (mpfr_cmpabs (x, y) < 0)
mpfr_swap (x, y);
- rnd = GMP_RNDN;
+ rnd = MPFR_RNDN;
inexact = test_sub (u, x, y, rnd);
test_sub (v, u, x, rnd);
mpfr_add (w, v, y, rnd);
@@ -408,12 +408,12 @@ check_inexact (void)
mpfr_init (u);
mpfr_set_prec (x, 2);
- mpfr_set_ui (x, 6, GMP_RNDN);
- mpfr_div_2exp (x, x, 4, GMP_RNDN); /* x = 6/16 */
+ mpfr_set_ui (x, 6, MPFR_RNDN);
+ mpfr_div_2exp (x, x, 4, MPFR_RNDN); /* x = 6/16 */
mpfr_set_prec (y, 2);
- mpfr_set_si (y, -1, GMP_RNDN);
- mpfr_div_2exp (y, y, 4, GMP_RNDN); /* y = -1/16 */
- inexact = test_sub (y, y, x, GMP_RNDN); /* y = round(-7/16) = -1/2 */
+ mpfr_set_si (y, -1, MPFR_RNDN);
+ mpfr_div_2exp (y, y, 4, MPFR_RNDN); /* y = -1/16 */
+ inexact = test_sub (y, y, x, MPFR_RNDN); /* y = round(-7/16) = -1/2 */
if (inexact >= 0)
{
printf ("Error: wrong inexact flag for -1/16 - (6/16)\n");
diff --git a/tests/tsub1sp.c b/tests/tsub1sp.c
index 0fe5c6600..2e0782e1f 100644
--- a/tests/tsub1sp.c
+++ b/tests/tsub1sp.c
@@ -81,7 +81,7 @@ check_random (mpfr_prec_t p)
mpfr_urandomb (y, RANDS);
mpfr_urandomb (z, RANDS);
if (MPFR_IS_PURE_FP(y) && MPFR_IS_PURE_FP(z))
- for(r = 0 ; r < GMP_RND_MAX ; r++)
+ for(r = 0 ; r < MPFR_RND_MAX ; r++)
{
inexact1 = mpfr_sub1(x2, y, z, (mp_rnd_t) r);
inexact2 = mpfr_sub1sp(x, y, z, (mp_rnd_t) r);
@@ -106,7 +106,7 @@ check_special (void)
mpfr_inits (x, y, z, x2, (mpfr_ptr) 0);
- for (r = 0 ; r < GMP_RND_MAX ; r++)
+ for (r = 0 ; r < MPFR_RND_MAX ; r++)
{
p = 53;
mpfr_set_prec(x, 53);
diff --git a/tests/tsub_d.c b/tests/tsub_d.c
index 9350b1c20..1366d2ca2 100644
--- a/tests/tsub_d.c
+++ b/tests/tsub_d.c
@@ -40,7 +40,7 @@ check_nans (void)
/* nan - 1.0 is nan */
mpfr_set_nan (x);
mpfr_clear_flags ();
- inexact = mpfr_sub_d (y, x, 1.0, GMP_RNDN);
+ inexact = mpfr_sub_d (y, x, 1.0, MPFR_RNDN);
MPFR_ASSERTN (inexact == 0);
MPFR_ASSERTN ((__gmpfr_flags ^ MPFR_FLAGS_NAN) == 0);
MPFR_ASSERTN (mpfr_nan_p (y));
@@ -48,7 +48,7 @@ check_nans (void)
/* +inf - 1.0 == +inf */
mpfr_set_inf (x, 1);
mpfr_clear_flags ();
- inexact = mpfr_sub_d (y, x, 1.0, GMP_RNDN);
+ inexact = mpfr_sub_d (y, x, 1.0, MPFR_RNDN);
MPFR_ASSERTN (inexact == 0);
MPFR_ASSERTN (__gmpfr_flags == 0);
MPFR_ASSERTN (mpfr_inf_p (y));
@@ -57,7 +57,7 @@ check_nans (void)
/* -inf - 1.0 == -inf */
mpfr_set_inf (x, -1);
mpfr_clear_flags ();
- inexact = mpfr_sub_d (y, x, 1.0, GMP_RNDN);
+ inexact = mpfr_sub_d (y, x, 1.0, MPFR_RNDN);
MPFR_ASSERTN (inexact == 0);
MPFR_ASSERTN (__gmpfr_flags == 0);
MPFR_ASSERTN (mpfr_inf_p (y));
@@ -85,24 +85,24 @@ main (void)
mpfr_init2 (y, IEEE_DBL_MANT_DIG);
mpfr_init2 (z, IEEE_DBL_MANT_DIG);
- mpfr_set_str (y, "4096", 10, GMP_RNDN);
+ mpfr_set_str (y, "4096", 10, MPFR_RNDN);
d = 0.125;
mpfr_clear_flags ();
- inexact = mpfr_sub_d (x, y, d, GMP_RNDN);
+ inexact = mpfr_sub_d (x, y, d, MPFR_RNDN);
if (inexact != 0)
{
printf ("Inexact flag error in mpfr_sub_d\n");
exit (1);
}
- mpfr_set_str (z, "4095.875", 10, GMP_RNDN);
+ mpfr_set_str (z, "4095.875", 10, MPFR_RNDN);
if (mpfr_cmp (z, x))
{
printf ("Error in mpfr_sub_d (");
- mpfr_out_str (stdout, 10, 7, y, GMP_RNDN);
+ mpfr_out_str (stdout, 10, 7, y, MPFR_RNDN);
printf (" + %.20g)\nexpected ", d);
- mpfr_out_str (stdout, 10, 0, z, GMP_RNDN);
+ mpfr_out_str (stdout, 10, 0, z, MPFR_RNDN);
printf ("\ngot ");
- mpfr_out_str (stdout, 10, 0, x, GMP_RNDN);
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN);
printf ("\n");
exit (1);
}
diff --git a/tests/tsub_ui.c b/tests/tsub_ui.c
index 680268f39..0bd2ee923 100644
--- a/tests/tsub_ui.c
+++ b/tests/tsub_ui.c
@@ -64,7 +64,7 @@ check_two_sum (mp_prec_t p)
}
while (x < 1);
mpfr_urandomb (y, RANDS);
- rnd = GMP_RNDN;
+ rnd = MPFR_RNDN;
inexact = mpfr_sub_ui (u, y, x, rnd);
mpfr_add_ui (v, u, x, rnd);
mpfr_sub (w, v, y, rnd);
@@ -96,18 +96,18 @@ check_nans (void)
/* nan - 1 == nan */
mpfr_set_nan (x);
- mpfr_sub_ui (y, x, 1L, GMP_RNDN);
+ mpfr_sub_ui (y, x, 1L, MPFR_RNDN);
MPFR_ASSERTN (mpfr_nan_p (y));
/* +inf - 1 == +inf */
mpfr_set_inf (x, 1);
- mpfr_sub_ui (y, x, 1L, GMP_RNDN);
+ mpfr_sub_ui (y, x, 1L, MPFR_RNDN);
MPFR_ASSERTN (mpfr_inf_p (y));
MPFR_ASSERTN (mpfr_sgn (y) > 0);
/* -inf - 1 == -inf */
mpfr_set_inf (x, -1);
- mpfr_sub_ui (y, x, 1L, GMP_RNDN);
+ mpfr_sub_ui (y, x, 1L, MPFR_RNDN);
MPFR_ASSERTN (mpfr_inf_p (y));
MPFR_ASSERTN (mpfr_sgn (y) < 0);
@@ -134,7 +134,7 @@ main (int argc, char *argv[])
for (k=0; k<200; k++)
check_two_sum (p);
- check3 ("0.9999999999", 1, GMP_RNDN,
+ check3 ("0.9999999999", 1, MPFR_RNDN,
"-10000000827403709990903735160827636718750e-50");
test_generic_ui (2, 1000, 100);
diff --git a/tests/tsubnormal.c b/tests/tsubnormal.c
index 42fb561ad..af3aac550 100644
--- a/tests/tsubnormal.c
+++ b/tests/tsubnormal.c
@@ -32,22 +32,22 @@ static const struct {
mp_rnd_t rnd;
const char *out;
} tab[] ={
- {"1E1", 0, GMP_RNDN, "1E1"},
- {"1E1", -1, GMP_RNDZ, "1E1"},
- {"1E1", -1, GMP_RNDD, "1E1"},
- {"1E1", 1, GMP_RNDU, "1E1"},
- {"0.10000E-10", 0, GMP_RNDN, "0.1E-10"},
- {"0.10001E-10", 0, GMP_RNDN, "0.1E-10"},
- {"0.11001E-10", 0, GMP_RNDN, "0.1E-9"},
- {"0.11001E-10", 0, GMP_RNDZ, "0.1E-10"},
- {"0.11001E-10", 0, GMP_RNDU, "0.1E-9"},
- {"0.11000E-10", 0, GMP_RNDN, "0.1E-9"},
- {"0.11000E-10", -1, GMP_RNDN, "0.1E-9"},
- {"0.11000E-10", 1, GMP_RNDN, "0.1E-10"},
- {"0.11111E-8", 0, GMP_RNDN, "0.10E-7"},
- {"0.10111E-8", 0, GMP_RNDN, "0.11E-8"},
- {"0.11110E-8", -1, GMP_RNDN, "0.10E-7"},
- {"0.10110E-8", 1, GMP_RNDN, "0.101E-8"}
+ {"1E1", 0, MPFR_RNDN, "1E1"},
+ {"1E1", -1, MPFR_RNDZ, "1E1"},
+ {"1E1", -1, MPFR_RNDD, "1E1"},
+ {"1E1", 1, MPFR_RNDU, "1E1"},
+ {"0.10000E-10", 0, MPFR_RNDN, "0.1E-10"},
+ {"0.10001E-10", 0, MPFR_RNDN, "0.1E-10"},
+ {"0.11001E-10", 0, MPFR_RNDN, "0.1E-9"},
+ {"0.11001E-10", 0, MPFR_RNDZ, "0.1E-10"},
+ {"0.11001E-10", 0, MPFR_RNDU, "0.1E-9"},
+ {"0.11000E-10", 0, MPFR_RNDN, "0.1E-9"},
+ {"0.11000E-10", -1, MPFR_RNDN, "0.1E-9"},
+ {"0.11000E-10", 1, MPFR_RNDN, "0.1E-10"},
+ {"0.11111E-8", 0, MPFR_RNDN, "0.10E-7"},
+ {"0.10111E-8", 0, MPFR_RNDN, "0.11E-8"},
+ {"0.11110E-8", -1, MPFR_RNDN, "0.10E-7"},
+ {"0.10110E-8", 1, MPFR_RNDN, "0.101E-8"}
};
static void
@@ -66,14 +66,14 @@ check1 (void)
mpfr_init (x);
for (i = 0; i < (sizeof (tab) / sizeof (tab[0])); i++)
- for (s = 0; s <= (tab[i].rnd == GMP_RNDN); s++)
+ for (s = 0; s <= (tab[i].rnd == MPFR_RNDN); s++)
for (k = 0; k <= 1; k++)
{
- mpfr_set_str (x, tab[i].in, 2, GMP_RNDN);
+ mpfr_set_str (x, tab[i].in, 2, MPFR_RNDN);
old_inex = tab[i].i;
if (s)
{
- mpfr_neg (x, x, GMP_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN);
old_inex = - old_inex;
}
if (k && old_inex)
@@ -81,15 +81,15 @@ check1 (void)
j = mpfr_subnormalize (x, old_inex, tab[i].rnd);
/* TODO: test j. */
if (s)
- mpfr_neg (x, x, GMP_RNDN);
- if (mpfr_cmp_str (x, tab[i].out, 2, GMP_RNDN) != 0)
+ mpfr_neg (x, x, MPFR_RNDN);
+ if (mpfr_cmp_str (x, tab[i].out, 2, MPFR_RNDN) != 0)
{
const char *sgn = s ? "-" : "";
printf ("Error for i = %d (old_inex = %d), k = %d, x = %s%s\n"
"Expected: %s%s\nGot: ", i, old_inex, k,
sgn, tab[i].in, sgn, tab[i].out);
if (s)
- mpfr_neg (x, x, GMP_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN);
mpfr_dump (x);
exit (1);
}
@@ -117,17 +117,17 @@ check2 (void)
mpfr_init2 (y, 32);
mpfr_init2 (z, 32);
- mpfr_set_ui (x, 0xC0000000U, GMP_RNDN);
- mpfr_neg (x, x, GMP_RNDN);
- mpfr_set_ui (y, 0xFFFFFFFEU, GMP_RNDN);
+ mpfr_set_ui (x, 0xC0000000U, MPFR_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN);
+ mpfr_set_ui (y, 0xFFFFFFFEU, MPFR_RNDN);
mpfr_set_exp (x, 0);
mpfr_set_exp (y, 0);
mpfr_set_emin (-29);
- tern = mpfr_mul (z, x, y, GMP_RNDN);
+ tern = mpfr_mul (z, x, y, MPFR_RNDN);
/* z = -0.BFFFFFFE, tern > 0 */
- tern = mpfr_subnormalize (z, tern, GMP_RNDN);
+ tern = mpfr_subnormalize (z, tern, MPFR_RNDN);
/* z should be -0.75 */
MPFR_ASSERTN (tern < 0 && mpfr_cmp_si_2exp (z, -3, -2) == 0);
@@ -154,18 +154,18 @@ check3 (void)
mpfr_init2 (y, 32);
mpfr_init2 (z, 32);
- mpfr_set_ui (x, 0xBFFFFFFFU, GMP_RNDN); /* 3221225471/2^32 */
- mpfr_set_ui (y, 0x80000001U, GMP_RNDN); /* 2147483649/2^32 */
+ mpfr_set_ui (x, 0xBFFFFFFFU, MPFR_RNDN); /* 3221225471/2^32 */
+ mpfr_set_ui (y, 0x80000001U, MPFR_RNDN); /* 2147483649/2^32 */
mpfr_set_exp (x, 0);
mpfr_set_exp (y, 0);
mpfr_set_emin (-1);
/* the exact product is 6917529028714823679/2^64, which is rounded to
3/8 = 0.375, which is smaller, thus tern < 0 */
- tern = mpfr_mul (z, x, y, GMP_RNDN);
+ tern = mpfr_mul (z, x, y, MPFR_RNDN);
MPFR_ASSERTN (tern < 0 && mpfr_cmp_ui_2exp (z, 3, -3) == 0);
- tern = mpfr_subnormalize (z, tern, GMP_RNDN);
+ tern = mpfr_subnormalize (z, tern, MPFR_RNDN);
/* since emin = -1, and EXP(z)=-1, z should be rounded to precision
EXP(z)-emin+1 = 1, i.e., z should be a multiple of the smallest possible
positive representable value with emin=-1, which is 1/4. The two
@@ -177,14 +177,14 @@ check3 (void)
first, thus we have to round down */
mpfr_set_str_binary (x, "0.11111111111010110101011011011011");
mpfr_set_str_binary (y, "0.01100000000001111100000000001110");
- tern = mpfr_mul (z, x, y, GMP_RNDN);
+ tern = mpfr_mul (z, x, y, MPFR_RNDN);
MPFR_ASSERTN (tern > 0 && mpfr_cmp_ui_2exp (z, 3, -3) == 0);
- tern = mpfr_subnormalize (z, tern, GMP_RNDN);
+ tern = mpfr_subnormalize (z, tern, MPFR_RNDN);
MPFR_ASSERTN (tern < 0 && mpfr_cmp_ui_2exp (z, 1, -2) == 0);
/* finally the case where z was exact, which we simulate here */
- mpfr_set_ui_2exp (z, 3, -3, GMP_RNDN);
- tern = mpfr_subnormalize (z, 0, GMP_RNDN);
+ mpfr_set_ui_2exp (z, 3, -3, MPFR_RNDN);
+ tern = mpfr_subnormalize (z, 0, MPFR_RNDN);
MPFR_ASSERTN (tern > 0 && mpfr_cmp_ui_2exp (z, 1, -1) == 0);
mpfr_clear (x);
diff --git a/tests/tsum.c b/tests/tsum.c
index c87366851..81afc0258 100644
--- a/tests/tsum.c
+++ b/tests/tsum.c
@@ -88,10 +88,10 @@ algo_exact (mpfr_t somme, mpfr_t *tab, unsigned long n, mp_prec_t f)
prec_max = get_prec_max(tab, n, f);
mpfr_set_prec (somme, prec_max);
- mpfr_set_ui (somme, 0, GMP_RNDN);
+ mpfr_set_ui (somme, 0, MPFR_RNDN);
for (i = 0; i < n; i++)
{
- if (mpfr_add(somme, somme, tab[i], GMP_RNDN))
+ if (mpfr_add(somme, somme, tab[i], MPFR_RNDN))
{
printf ("FIXME: algo_exact is buggy.\n");
exit (1);
@@ -157,7 +157,7 @@ test_sum (mp_prec_t f, unsigned long n)
for (i = 0; i < n; i++)
mpfr_urandomb (tab[i], RANDS);
algo_exact (real_non_rounded, tab, n, f);
- for (rnd_mode = 0; rnd_mode < GMP_RND_MAX; rnd_mode++)
+ for (rnd_mode = 0; rnd_mode < MPFR_RND_MAX; rnd_mode++)
{
sum_tab (sum, tab, n, (mp_rnd_t) rnd_mode);
mpfr_set (real_sum, real_non_rounded, (mp_rnd_t) rnd_mode);
@@ -177,7 +177,7 @@ test_sum (mp_prec_t f, unsigned long n)
mpfr_set_exp (tab[i], randlimb () %1000);
}
algo_exact (real_non_rounded, tab, n, f);
- for (rnd_mode = 0; rnd_mode < GMP_RND_MAX; rnd_mode++)
+ for (rnd_mode = 0; rnd_mode < MPFR_RND_MAX; rnd_mode++)
{
sum_tab (sum, tab, n, (mp_rnd_t) rnd_mode);
mpfr_set (real_sum, real_non_rounded, (mp_rnd_t) rnd_mode);
@@ -209,24 +209,24 @@ void check_special (void)
tabp[1] = tab[1];
tabp[2] = tab[2];
- i = mpfr_sum (r, tabp, 0, GMP_RNDN);
+ i = mpfr_sum (r, tabp, 0, MPFR_RNDN);
if (!MPFR_IS_ZERO (r) || !MPFR_IS_POS (r) || i != 0)
{
printf ("Special case n==0 failed!\n");
exit (1);
}
- mpfr_set_ui (tab[0], 42, GMP_RNDN);
- i = mpfr_sum (r, tabp, 1, GMP_RNDN);
+ mpfr_set_ui (tab[0], 42, MPFR_RNDN);
+ i = mpfr_sum (r, tabp, 1, MPFR_RNDN);
if (mpfr_cmp_ui (r, 42) || i != 0)
{
printf ("Special case n==1 failed!\n");
exit (1);
}
- mpfr_set_ui (tab[1], 17, GMP_RNDN);
+ mpfr_set_ui (tab[1], 17, MPFR_RNDN);
MPFR_SET_NAN (tab[2]);
- i = mpfr_sum (r, tabp, 3, GMP_RNDN);
+ i = mpfr_sum (r, tabp, 3, MPFR_RNDN);
if (!MPFR_IS_NAN (r) || i != 0)
{
printf ("Special case NAN failed!\n");
@@ -235,7 +235,7 @@ void check_special (void)
MPFR_SET_INF (tab[2]);
MPFR_SET_POS (tab[2]);
- i = mpfr_sum (r, tabp, 3, GMP_RNDN);
+ i = mpfr_sum (r, tabp, 3, MPFR_RNDN);
if (!MPFR_IS_INF (r) || !MPFR_IS_POS (r) || i != 0)
{
printf ("Special case +INF failed!\n");
@@ -244,7 +244,7 @@ void check_special (void)
MPFR_SET_INF (tab[2]);
MPFR_SET_NEG (tab[2]);
- i = mpfr_sum (r, tabp, 3, GMP_RNDN);
+ i = mpfr_sum (r, tabp, 3, MPFR_RNDN);
if (!MPFR_IS_INF (r) || !MPFR_IS_NEG (r) || i != 0)
{
printf ("Special case -INF failed!\n");
@@ -252,7 +252,7 @@ void check_special (void)
}
MPFR_SET_ZERO (tab[1]);
- i = mpfr_sum (r, tabp, 2, GMP_RNDN);
+ i = mpfr_sum (r, tabp, 2, MPFR_RNDN);
if (mpfr_cmp_ui (r, 42) || i != 0)
{
printf ("Special case 42+0 failed!\n");
@@ -260,7 +260,7 @@ void check_special (void)
}
MPFR_SET_NAN (tab[0]);
- i = mpfr_sum (r, tabp, 3, GMP_RNDN);
+ i = mpfr_sum (r, tabp, 3, MPFR_RNDN);
if (!MPFR_IS_NAN (r) || i != 0)
{
printf ("Special case NAN+0+-INF failed!\n");
@@ -268,9 +268,9 @@ void check_special (void)
}
mpfr_set_inf (tab[0], 1);
- mpfr_set_ui (tab[1], 59, GMP_RNDN);
+ mpfr_set_ui (tab[1], 59, MPFR_RNDN);
mpfr_set_inf (tab[2], -1);
- i = mpfr_sum (r, tabp, 3, GMP_RNDN);
+ i = mpfr_sum (r, tabp, 3, MPFR_RNDN);
if (!MPFR_IS_NAN (r) || i != 0)
{
printf ("Special case +INF + 59 +-INF failed!\n");
diff --git a/tests/tswap.c b/tests/tswap.c
index c1c5299b4..36f8a76a6 100644
--- a/tests/tswap.c
+++ b/tests/tswap.c
@@ -34,7 +34,7 @@ main (void)
mpfr_init2 (u, 24);
mpfr_init2 (v, 53);
- mpfr_set_ui (u, 16777215, GMP_RNDN); /* 2^24 - 1 */
+ mpfr_set_ui (u, 16777215, MPFR_RNDN); /* 2^24 - 1 */
mpfr_set_str1 (v, "9007199254740991.0"); /* 2^53 - 1 */
mpfr_swap (u, v);
mpfr_swap (u, v);
diff --git a/tests/ttan.c b/tests/ttan.c
index 2d3d66ded..3c827291a 100644
--- a/tests/ttan.c
+++ b/tests/ttan.c
@@ -38,7 +38,7 @@ check_nans (void)
mpfr_init2 (y, 123L);
mpfr_set_nan (x);
- mpfr_tan (y, x, GMP_RNDN);
+ mpfr_tan (y, x, MPFR_RNDN);
if (! mpfr_nan_p (y))
{
printf ("Error: tan(NaN) != NaN\n");
@@ -46,7 +46,7 @@ check_nans (void)
}
mpfr_set_inf (x, 1);
- mpfr_tan (y, x, GMP_RNDN);
+ mpfr_tan (y, x, MPFR_RNDN);
if (! mpfr_nan_p (y))
{
printf ("Error: tan(Inf) != NaN\n");
@@ -54,7 +54,7 @@ check_nans (void)
}
mpfr_set_inf (x, -1);
- mpfr_tan (y, x, GMP_RNDN);
+ mpfr_tan (y, x, MPFR_RNDN);
if (! mpfr_nan_p (y))
{
printf ("Error: tan(-Inf) != NaN\n");
@@ -65,18 +65,18 @@ check_nans (void)
mpfr_set_prec (x, 14);
mpfr_set_str_binary (x, "0.10100000101010E0");
mpfr_set_prec (y, 24);
- mpfr_tan (y, x, GMP_RNDU);
+ mpfr_tan (y, x, MPFR_RNDU);
mpfr_set_prec (x, 24);
mpfr_set_str_binary (x, "101110011011001100100001E-24");
MPFR_ASSERTN(mpfr_cmp (x, y) == 0);
/* Compute ~Pi/2 to check overflow */
mpfr_set_prec (x, 20000);
- mpfr_const_pi (x, GMP_RNDD);
- mpfr_div_2ui (x, x, 1, GMP_RNDN);
+ mpfr_const_pi (x, MPFR_RNDD);
+ mpfr_div_2ui (x, x, 1, MPFR_RNDN);
mpfr_set_prec (y, 24);
- mpfr_tan (y, x, GMP_RNDN);
- if (mpfr_cmp_str (y, "0.100011101101011000100011E20001", 2, GMP_RNDN))
+ mpfr_tan (y, x, MPFR_RNDN);
+ if (mpfr_cmp_str (y, "0.100011101101011000100011E20001", 2, MPFR_RNDN))
{
printf("Error computing tan(~Pi/2)\n");
mpfr_dump (y);
@@ -87,7 +87,7 @@ check_nans (void)
mpfr_set_prec (x, 53);
mpfr_set_prec (y, 53);
mpfr_set_str_binary (x, "0.10011100110111000001000010110100101000000000000000000E34");
- mpfr_tan (y, x, GMP_RNDN);
+ mpfr_tan (y, x, MPFR_RNDN);
mpfr_set_str_binary (x, "0.1000010011001010001000010100000110100111000011010101E41");
MPFR_ASSERTN(mpfr_cmp (x, y) == 0);
@@ -110,11 +110,11 @@ main (int argc, char *argv[])
mpfr_init (x);
mpfr_set_prec (x, 2);
- mpfr_set_str (x, "0.5", 10, GMP_RNDN);
- mpfr_tan (x, x, GMP_RNDD);
+ mpfr_set_str (x, "0.5", 10, MPFR_RNDN);
+ mpfr_tan (x, x, MPFR_RNDD);
if (mpfr_cmp_ui_2exp(x, 1, -1))
{
- printf ("mpfr_tan(0.5, GMP_RNDD) failed\n"
+ printf ("mpfr_tan(0.5, MPFR_RNDD) failed\n"
"expected 0.5, got");
mpfr_print_binary(x);
putchar('\n');
@@ -125,10 +125,10 @@ main (int argc, char *argv[])
for (i=0; i<10; i++)
{
mpfr_set_prec (x, prec[i]);
- mpfr_const_pi (x, GMP_RNDN);
- mpfr_mul_ui (x, x, 3, GMP_RNDN);
- mpfr_div_ui (x, x, 4, GMP_RNDN);
- mpfr_tan (x, x, GMP_RNDN);
+ mpfr_const_pi (x, MPFR_RNDN);
+ mpfr_mul_ui (x, x, 3, MPFR_RNDN);
+ mpfr_div_ui (x, x, 4, MPFR_RNDN);
+ mpfr_tan (x, x, MPFR_RNDN);
if (mpfr_cmp_si (x, -1))
{
printf ("tan(3*Pi/4) fails for prec=%u\n", prec[i]);
@@ -140,10 +140,10 @@ main (int argc, char *argv[])
for (i=0; i<10; i++)
{
mpfr_set_prec (x, prec2[i]);
- mpfr_const_pi (x, GMP_RNDN);
- mpfr_mul_ui (x, x, 7, GMP_RNDN);
- mpfr_div_ui (x, x, 4, GMP_RNDN);
- mpfr_tan (x, x, GMP_RNDN);
+ mpfr_const_pi (x, MPFR_RNDN);
+ mpfr_mul_ui (x, x, 7, MPFR_RNDN);
+ mpfr_div_ui (x, x, 4, MPFR_RNDN);
+ mpfr_tan (x, x, MPFR_RNDN);
if (mpfr_cmp_si (x, -1))
{
printf ("tan(3*Pi/4) fails for prec=%u\n", prec2[i]);
diff --git a/tests/ttanh.c b/tests/ttanh.c
index 6e14c209a..5833edccf 100644
--- a/tests/ttanh.c
+++ b/tests/ttanh.c
@@ -38,20 +38,20 @@ special (void)
mpfr_init (x);
mpfr_set_nan (x);
- mpfr_tanh (x, x, GMP_RNDN);
+ mpfr_tanh (x, x, MPFR_RNDN);
MPFR_ASSERTN(mpfr_nan_p (x));
mpfr_set_inf (x, 1);
- mpfr_tanh (x, x, GMP_RNDN);
+ mpfr_tanh (x, x, MPFR_RNDN);
MPFR_ASSERTN(mpfr_cmp_ui (x, 1) == 0);
mpfr_set_inf (x, -1);
- mpfr_tanh (x, x, GMP_RNDN);
+ mpfr_tanh (x, x, MPFR_RNDN);
MPFR_ASSERTN(mpfr_cmp_si (x, -1) == 0);
mpfr_set_prec (x, 10);
mpfr_set_str_binary (x, "-0.1001011001");
- mpfr_tanh (x, x, GMP_RNDN);
+ mpfr_tanh (x, x, MPFR_RNDN);
MPFR_ASSERTN(mpfr_cmp_si_2exp (x, -135, -8) == 0);
mpfr_clear (x);
@@ -74,7 +74,7 @@ special_overflow (void)
mpfr_init2 (y, 24);
mpfr_set_str_binary (x, "0.101100100000000000110100E7");
- i = mpfr_tanh (y, x, GMP_RNDN);
+ i = mpfr_tanh (y, x, MPFR_RNDN);
if (mpfr_cmp_ui (y, 1) || i != 1)
{
printf("Overflow error (1). i=%d\ny=", i);
@@ -83,8 +83,8 @@ special_overflow (void)
}
MPFR_ASSERTN (!mpfr_overflow_p ());
- i = mpfr_tanh (y, x, GMP_RNDZ);
- if (mpfr_cmp_str (y, "0.111111111111111111111111E0", 2, GMP_RNDN)
+ i = mpfr_tanh (y, x, MPFR_RNDZ);
+ if (mpfr_cmp_str (y, "0.111111111111111111111111E0", 2, MPFR_RNDN)
|| i != -1)
{
printf("Overflow error (2).i=%d\ny=", i);
@@ -97,7 +97,7 @@ special_overflow (void)
set_emax (emax);
mpfr_set_str_binary (x, "0.1E1000000000");
- i = mpfr_tanh (y, x, GMP_RNDN);
+ i = mpfr_tanh (y, x, MPFR_RNDN);
if (mpfr_cmp_ui (y, 1) || i != 1)
{
printf("Overflow error (3). i=%d\ny=", i);
@@ -106,8 +106,8 @@ special_overflow (void)
}
MPFR_ASSERTN (!mpfr_overflow_p ());
mpfr_set_str_binary (x, "-0.1E1000000000");
- i = mpfr_tanh (y, x, GMP_RNDU);
- if (mpfr_cmp_str (y, "-0.111111111111111111111111E0", 2, GMP_RNDN)
+ i = mpfr_tanh (y, x, MPFR_RNDU);
+ if (mpfr_cmp_str (y, "-0.111111111111111111111111E0", 2, MPFR_RNDN)
|| i != 1)
{
printf("Overflow error (4). i=%d\ny=", i);
diff --git a/tests/ttrunc.c b/tests/ttrunc.c
index 0de72029c..e45709daa 100644
--- a/tests/ttrunc.c
+++ b/tests/ttrunc.c
@@ -47,7 +47,7 @@ main (void)
exit (1);
}
- mpfr_set_ui (x, 0, GMP_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
mpfr_ceil(y, x);
if (mpfr_cmp_ui(y,0))
{
@@ -57,7 +57,7 @@ main (void)
exit (1);
}
- mpfr_set_ui (x, 1, GMP_RNDN);
+ mpfr_set_ui (x, 1, MPFR_RNDN);
mpfr_ceil(y, x);
if (mpfr_cmp_ui(y,1))
{
@@ -82,13 +82,13 @@ main (void)
mpfr_set_prec(t2, k);
mpfr_floor(y, x);
- mpfr_set(y2, x, GMP_RNDD);
+ mpfr_set(y2, x, MPFR_RNDD);
mpfr_trunc(z, x);
- mpfr_set(z2, x, GMP_RNDZ);
+ mpfr_set(z2, x, MPFR_RNDZ);
mpfr_ceil(t, x);
- mpfr_set(t2, x, GMP_RNDU);
+ mpfr_set(t2, x, MPFR_RNDU);
if (!mpfr_eq(y, y2, k))
{
diff --git a/tests/tui_div.c b/tests/tui_div.c
index 8f3ffca80..ec5acdcfd 100644
--- a/tests/tui_div.c
+++ b/tests/tui_div.c
@@ -37,7 +37,7 @@ check (unsigned long y, const char *xs, mp_rnd_t rnd_mode, const char *zs)
if (mpfr_cmp_str1(zz, zs))
{
printf ("expected quotient is %s, got ", zs);
- mpfr_out_str (stdout, 10, 0, zz, GMP_RNDN);
+ mpfr_out_str (stdout, 10, 0, zz, MPFR_RNDN);
printf ("mpfr_ui_div failed for y=%lu x=%s with rnd_mode=%s\n",
y, xs, mpfr_print_rnd_mode (rnd_mode));
exit (1);
@@ -71,7 +71,7 @@ check_inexact (void)
{
mpfr_set_prec (y, py);
mpfr_set_prec (z, py + px);
- for (rnd = 0; rnd < GMP_RND_MAX; rnd++)
+ for (rnd = 0; rnd < MPFR_RND_MAX; rnd++)
{
inexact = mpfr_ui_div (y, u, x, (mp_rnd_t) rnd);
if (mpfr_mul (z, y, x, (mp_rnd_t) rnd))
@@ -113,7 +113,7 @@ check_nan (void)
MPFR_CLEAR_FLAGS (d);
MPFR_SET_INF (d);
MPFR_SET_POS (d);
- MPFR_ASSERTN (mpfr_ui_div (q, 1L, d, GMP_RNDZ) == 0); /* exact */
+ MPFR_ASSERTN (mpfr_ui_div (q, 1L, d, MPFR_RNDZ) == 0); /* exact */
MPFR_ASSERTN (mpfr_number_p (q));
MPFR_ASSERTN (mpfr_sgn (q) == 0);
@@ -121,39 +121,39 @@ check_nan (void)
MPFR_CLEAR_FLAGS (d);
MPFR_SET_INF (d);
MPFR_SET_NEG (d);
- MPFR_ASSERTN (mpfr_ui_div (q, 1L, d, GMP_RNDZ) == 0); /* exact */
+ MPFR_ASSERTN (mpfr_ui_div (q, 1L, d, MPFR_RNDZ) == 0); /* exact */
MPFR_ASSERTN (mpfr_number_p (q));
MPFR_ASSERTN (mpfr_sgn (q) == 0);
/* 1/nan == nan */
MPFR_SET_NAN (d);
- MPFR_ASSERTN (mpfr_ui_div (q, 1L, d, GMP_RNDZ) == 0); /* exact */
+ MPFR_ASSERTN (mpfr_ui_div (q, 1L, d, MPFR_RNDZ) == 0); /* exact */
MPFR_ASSERTN (mpfr_nan_p (q));
/* 0/0 == nan */
- mpfr_set_ui (d, 0L, GMP_RNDN);
- MPFR_ASSERTN (mpfr_ui_div (q, 0L, d, GMP_RNDZ) == 0); /* exact */
+ mpfr_set_ui (d, 0L, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_ui_div (q, 0L, d, MPFR_RNDZ) == 0); /* exact */
MPFR_ASSERTN (mpfr_nan_p (q));
/* 1/+0 = +inf */
- mpfr_set_ui (d, 0L, GMP_RNDN);
- MPFR_ASSERTN (mpfr_ui_div (q, 1L, d, GMP_RNDZ) == 0); /* exact */
+ mpfr_set_ui (d, 0L, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_ui_div (q, 1L, d, MPFR_RNDZ) == 0); /* exact */
MPFR_ASSERTN (mpfr_inf_p (q) && mpfr_sgn (q) > 0);
/* 1/-0 = -inf */
- mpfr_set_ui (d, 0L, GMP_RNDN);
- mpfr_neg (d, d, GMP_RNDN);
- MPFR_ASSERTN (mpfr_ui_div (q, 1L, d, GMP_RNDZ) == 0); /* exact */
+ mpfr_set_ui (d, 0L, MPFR_RNDN);
+ mpfr_neg (d, d, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_ui_div (q, 1L, d, MPFR_RNDZ) == 0); /* exact */
MPFR_ASSERTN (mpfr_inf_p (q) && mpfr_sgn (q) < 0);
/* 0/1 = +0 */
- mpfr_set_ui (d, 1L, GMP_RNDN);
- MPFR_ASSERTN (mpfr_ui_div (q, 0L, d, GMP_RNDZ) == 0); /* exact */
+ mpfr_set_ui (d, 1L, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_ui_div (q, 0L, d, MPFR_RNDZ) == 0); /* exact */
MPFR_ASSERTN (mpfr_cmp_ui (q, 0) == 0 && MPFR_IS_POS (q));
/* 0/-1 = -0 */
- mpfr_set_si (d, -1, GMP_RNDN);
- MPFR_ASSERTN (mpfr_ui_div (q, 0L, d, GMP_RNDZ) == 0); /* exact */
+ mpfr_set_si (d, -1, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_ui_div (q, 0L, d, MPFR_RNDZ) == 0); /* exact */
MPFR_ASSERTN (mpfr_cmp_ui (q, 0) == 0 && MPFR_IS_NEG (q));
mpfr_clear (d);
@@ -173,15 +173,15 @@ main (int argc, char *argv[])
check_nan ();
check_inexact ();
- check(948002822, "1.22191250737771397120e+20", GMP_RNDN,
+ check(948002822, "1.22191250737771397120e+20", MPFR_RNDN,
"7.758352715731357946e-12");
- check(1976245324, "1.25296395864546893357e+232", GMP_RNDZ,
+ check(1976245324, "1.25296395864546893357e+232", MPFR_RNDZ,
"1.5772563211925444801e-223");
- check(740454110, "2.11496253355831863313e+183", GMP_RNDZ,
+ check(740454110, "2.11496253355831863313e+183", MPFR_RNDZ,
"3.5010270784996976041e-175");
- check(1690540942, "1.28278599852446657468e-276", GMP_RNDU,
+ check(1690540942, "1.28278599852446657468e-276", MPFR_RNDU,
"1.3178666932321966062e285");
- check(1476599377, "-2.14191393656148625995e+305", GMP_RNDD,
+ check(1476599377, "-2.14191393656148625995e+305", MPFR_RNDD,
"-6.8938315017943889615e-297");
/* inv is for 1/x */
diff --git a/tests/tui_pow.c b/tests/tui_pow.c
index deec2b242..a15a1b254 100644
--- a/tests/tui_pow.c
+++ b/tests/tui_pow.c
@@ -38,12 +38,12 @@ test1 (void)
mpfr_init2 (a, 17);
mpfr_set_str_binary (x, "-0.101110001001011011011e-9");
- mpfr_ui_pow (y, 7, x, GMP_RNDN);
+ mpfr_ui_pow (y, 7, x, MPFR_RNDN);
mpfr_set_prec (x, 40);
mpfr_set_str_binary (x, "-0.1100101100101111011001010010110011110110E-1");
mpfr_set_prec (y, 74);
- mpfr_ui_pow (y, 8, x, GMP_RNDN);
+ mpfr_ui_pow (y, 8, x, MPFR_RNDN);
mpfr_set_prec (x, 74);
mpfr_set_str_binary (x, "0.11100000010100111101000011111011011010011000011000101011010011010101000011E-1");
if (mpfr_cmp (x, y))
@@ -53,14 +53,14 @@ test1 (void)
}
/* Check for ui_pow_ui */
- mpfr_ui_pow_ui (x, 0, 1, GMP_RNDN);
+ mpfr_ui_pow_ui (x, 0, 1, MPFR_RNDN);
MPFR_ASSERTN(mpfr_cmp_ui (x, 0) == 0 && MPFR_IS_POS (x));
- mpfr_ui_pow_ui (x, 0, 4, GMP_RNDN);
+ mpfr_ui_pow_ui (x, 0, 4, MPFR_RNDN);
MPFR_ASSERTN(mpfr_cmp_ui (x, 0) == 0 && MPFR_IS_POS (x));
- res1 = mpfr_ui_pow_ui (z, 17, 42, GMP_RNDD);
- mpfr_set_ui (x, 17, GMP_RNDN);
- mpfr_set_ui (y, 42, GMP_RNDN);
- res2 = mpfr_pow (a, x, y, GMP_RNDD);
+ res1 = mpfr_ui_pow_ui (z, 17, 42, MPFR_RNDD);
+ mpfr_set_ui (x, 17, MPFR_RNDN);
+ mpfr_set_ui (y, 42, MPFR_RNDN);
+ res2 = mpfr_pow (a, x, y, MPFR_RNDD);
if (mpfr_cmp (z, a) || res1 != res2)
{
printf ("Error for ui_pow_ui for 17^42\n"
@@ -70,8 +70,8 @@ test1 (void)
exit (1);
}
mpfr_set_prec (x, 2);
- mpfr_ui_pow_ui (x, 65537, 65535, GMP_RNDN);
- if (mpfr_cmp_str (x, "0.11E1048562", 2, GMP_RNDN) != 0)
+ mpfr_ui_pow_ui (x, 65537, 65535, MPFR_RNDN);
+ if (mpfr_cmp_str (x, "0.11E1048562", 2, MPFR_RNDN) != 0)
{
printf ("Error for ui_pow_ui for 65537 ^65535 with 2 bits of precision\n");
mpfr_dump (x);
@@ -101,7 +101,7 @@ check1 (mpfr_ptr x, mp_prec_t prec, unsigned long nt, mp_rnd_t rnd)
mpfr_set_prec (t, prec);
compare = mpfr_ui_pow (y, nt, x, rnd);
- err = (rnd == GMP_RNDN) ? yprec + 1 : yprec;
+ err = (rnd == MPFR_RNDN) ? yprec + 1 : yprec;
if (mpfr_can_round (y, err, rnd, rnd, prec))
{
mpfr_set (t, y, rnd);
@@ -109,15 +109,15 @@ check1 (mpfr_ptr x, mp_prec_t prec, unsigned long nt, mp_rnd_t rnd)
if (mpfr_cmp (t, z))
{
printf ("results differ for x=");
- mpfr_out_str (stdout, 2, prec, x, GMP_RNDN);
+ mpfr_out_str (stdout, 2, prec, x, MPFR_RNDN);
printf (" n=%lu", nt);
printf (" prec=%u rnd_mode=%s\n", (unsigned) prec,
mpfr_print_rnd_mode (rnd));
printf ("got ");
- mpfr_out_str (stdout, 2, prec, z, GMP_RNDN);
+ mpfr_out_str (stdout, 2, prec, z, MPFR_RNDN);
puts ("");
printf ("expected ");
- mpfr_out_str (stdout, 2, prec, t, GMP_RNDN);
+ mpfr_out_str (stdout, 2, prec, t, MPFR_RNDN);
puts ("");
printf ("approx ");
mpfr_print_binary (y);
@@ -127,7 +127,7 @@ check1 (mpfr_ptr x, mp_prec_t prec, unsigned long nt, mp_rnd_t rnd)
compare2 = mpfr_cmp (t, y);
/* if rounding to nearest, cannot know the sign of t - f(x)
because of composed rounding: y = o(f(x)) and t = o(y) */
- if ((rnd != GMP_RNDN) && (compare * compare2 >= 0))
+ if ((rnd != MPFR_RNDN) && (compare * compare2 >= 0))
compare = compare + compare2;
else
compare = inexact; /* cannot determine sign(t-f(x)) */
@@ -163,7 +163,7 @@ main (int argc, char *argv[])
n = randlimb ();
MPFR_SET_INF(x);
- mpfr_ui_pow (y, n, x, GMP_RNDN);
+ mpfr_ui_pow (y, n, x, MPFR_RNDN);
if(!MPFR_IS_INF(y))
{
printf ("evaluation of function in INF does not return INF\n");
@@ -171,7 +171,7 @@ main (int argc, char *argv[])
}
MPFR_CHANGE_SIGN(x);
- mpfr_ui_pow (y, n, x, GMP_RNDN);
+ mpfr_ui_pow (y, n, x, MPFR_RNDN);
if(!MPFR_IS_ZERO(y))
{
printf ("evaluation of function in -INF does not return 0");
@@ -179,7 +179,7 @@ main (int argc, char *argv[])
}
MPFR_SET_NAN(x);
- mpfr_ui_pow (y, n, x, GMP_RNDN);
+ mpfr_ui_pow (y, n, x, MPFR_RNDN);
if(!MPFR_IS_NAN(y))
{
printf ("evaluation of function in NAN does not return NAN");
@@ -202,17 +202,17 @@ main (int argc, char *argv[])
/* check exact power */
mpfr_set_str_binary (t, "0.110000E5");
- mpfr_ui_pow (z, 3, t, GMP_RNDN);
+ mpfr_ui_pow (z, 3, t, MPFR_RNDN);
mpfr_set_prec (x, 2);
mpfr_set_prec (y, 2);
- mpfr_set_str (x, "-0.5", 10, GMP_RNDZ);
- mpfr_ui_pow (y, 4, x, GMP_RNDD);
+ mpfr_set_str (x, "-0.5", 10, MPFR_RNDZ);
+ mpfr_ui_pow (y, 4, x, MPFR_RNDD);
if (mpfr_cmp_ui_2exp(y, 1, -1))
{
- fprintf (stderr, "Error for 4^(-0.5), prec=2, GMP_RNDD\n");
+ fprintf (stderr, "Error for 4^(-0.5), prec=2, MPFR_RNDD\n");
fprintf (stderr, "expected 0.5, got ");
- mpfr_out_str (stderr, 2, 0, y, GMP_RNDN);
+ mpfr_out_str (stderr, 2, 0, y, MPFR_RNDN);
fprintf (stderr, "\n");
exit (1);
}
@@ -221,13 +221,13 @@ main (int argc, char *argv[])
(03 Sep 2003) */
mpfr_set_prec (x, 2);
mpfr_set_prec (y, 2);
- mpfr_set_str (x, "0.5", 10, GMP_RNDN);
- mpfr_ui_pow (y, 398441521, x, GMP_RNDN);
+ mpfr_set_str (x, "0.5", 10, MPFR_RNDN);
+ mpfr_ui_pow (y, 398441521, x, MPFR_RNDN);
if (mpfr_cmp_ui_2exp(y, 1, 14))
{
- fprintf (stderr, "Error for 398441521^(0.5), prec=2, GMP_RNDN\n");
+ fprintf (stderr, "Error for 398441521^(0.5), prec=2, MPFR_RNDN\n");
fprintf (stderr, "expected 1.0e14, got ");
- mpfr_out_str (stderr, 2, 0, y, GMP_RNDN);
+ mpfr_out_str (stderr, 2, 0, y, MPFR_RNDN);
fprintf (stderr, "\n");
exit (1);
}
@@ -236,8 +236,8 @@ main (int argc, char *argv[])
mpfr_clear (t);
mpfr_set_prec (x, 2);
- mpfr_set_str (x, "0.5", 10, GMP_RNDN);
- check1 (x, 2, 398441521, GMP_RNDN); /* 398441521 = 19961^2 */
+ mpfr_set_str (x, "0.5", 10, MPFR_RNDN);
+ check1 (x, 2, 398441521, MPFR_RNDN); /* 398441521 = 19961^2 */
/* generic test */
for (prec = p0; prec <= p1; prec++)
diff --git a/tests/tui_sub.c b/tests/tui_sub.c
index f6613dd87..4c75261cc 100644
--- a/tests/tui_sub.c
+++ b/tests/tui_sub.c
@@ -39,7 +39,7 @@ special (void)
mpfr_set_prec (x, 24);
mpfr_set_prec (y, 24);
mpfr_set_str_binary (y, "0.111100110001011010111");
- inexact = mpfr_ui_sub (x, 1, y, GMP_RNDN);
+ inexact = mpfr_ui_sub (x, 1, y, MPFR_RNDN);
if (inexact)
{
printf ("Wrong inexact flag: got %d, expected 0\n", inexact);
@@ -49,7 +49,7 @@ special (void)
mpfr_set_prec (x, 24);
mpfr_set_prec (y, 24);
mpfr_set_str_binary (y, "0.111100110001011010111");
- if ((inexact = mpfr_ui_sub (x, 38181761, y, GMP_RNDN)) >= 0)
+ if ((inexact = mpfr_ui_sub (x, 38181761, y, MPFR_RNDN)) >= 0)
{
printf ("Wrong inexact flag: got %d, expected -1\n", inexact);
exit (1);
@@ -58,7 +58,7 @@ special (void)
mpfr_set_prec (x, 63);
mpfr_set_prec (y, 63);
mpfr_set_str_binary (y, "0.111110010010100100110101101010001001100101110001000101110111111E-1");
- if ((inexact = mpfr_ui_sub (x, 1541116494, y, GMP_RNDN)) <= 0)
+ if ((inexact = mpfr_ui_sub (x, 1541116494, y, MPFR_RNDN)) <= 0)
{
printf ("Wrong inexact flag: got %d, expected +1\n", inexact);
exit (1);
@@ -67,7 +67,7 @@ special (void)
mpfr_set_prec (x, 32);
mpfr_set_prec (y, 32);
mpfr_set_str_binary (y, "0.11011000110111010001011100011100E-1");
- if ((inexact = mpfr_ui_sub (x, 2000375416, y, GMP_RNDN)) >= 0)
+ if ((inexact = mpfr_ui_sub (x, 2000375416, y, MPFR_RNDN)) >= 0)
{
printf ("Wrong inexact flag: got %d, expected -1\n", inexact);
exit (1);
@@ -76,7 +76,7 @@ special (void)
mpfr_set_prec (x, 24);
mpfr_set_prec (y, 24);
mpfr_set_str_binary (y, "0.110011011001010011110111E-2");
- if ((inexact = mpfr_ui_sub (x, 927694848, y, GMP_RNDN)) <= 0)
+ if ((inexact = mpfr_ui_sub (x, 927694848, y, MPFR_RNDN)) <= 0)
{
printf ("Wrong inexact flag: got %d, expected +1\n", inexact);
exit (1);
@@ -88,34 +88,34 @@ special (void)
mpfr_set_prec (res, 5);
mpfr_set_str_binary (x, "1e-12");
- mpfr_ui_sub (y, 1, x, GMP_RNDD);
+ mpfr_ui_sub (y, 1, x, MPFR_RNDD);
mpfr_set_str_binary (res, "0.11111");
if (mpfr_cmp (y, res))
{
- printf ("Error in mpfr_ui_sub (y, 1, x, GMP_RNDD) for x=2^(-12)\nexpected 1.1111e-1, got ");
- mpfr_out_str (stdout, 2, 0, y, GMP_RNDN);
+ printf ("Error in mpfr_ui_sub (y, 1, x, MPFR_RNDD) for x=2^(-12)\nexpected 1.1111e-1, got ");
+ mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN);
printf ("\n");
exit (1);
}
- mpfr_ui_sub (y, 1, x, GMP_RNDU);
+ mpfr_ui_sub (y, 1, x, MPFR_RNDU);
mpfr_set_str_binary (res, "1.0");
if (mpfr_cmp (y, res))
{
- printf ("Error in mpfr_ui_sub (y, 1, x, GMP_RNDU) for x=2^(-12)\n"
+ printf ("Error in mpfr_ui_sub (y, 1, x, MPFR_RNDU) for x=2^(-12)\n"
"expected 1.0, got ");
- mpfr_out_str (stdout, 2, 0, y, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN);
printf ("\n");
exit (1);
}
- mpfr_ui_sub (y, 1, x, GMP_RNDN);
+ mpfr_ui_sub (y, 1, x, MPFR_RNDN);
mpfr_set_str_binary (res, "1.0");
if (mpfr_cmp (y, res))
{
- printf ("Error in mpfr_ui_sub (y, 1, x, GMP_RNDN) for x=2^(-12)\n"
+ printf ("Error in mpfr_ui_sub (y, 1, x, MPFR_RNDN) for x=2^(-12)\n"
"expected 1.0, got ");
- mpfr_out_str (stdout, 2, 0, y, GMP_RNDN);
+ mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN);
printf ("\n");
exit (1);
}
@@ -123,7 +123,7 @@ special (void)
mpfr_set_prec (x, 10);
mpfr_set_prec (y, 10);
mpfr_urandomb (x, RANDS);
- mpfr_ui_sub (y, 0, x, GMP_RNDN);
+ mpfr_ui_sub (y, 0, x, MPFR_RNDN);
if (MPFR_IS_ZERO(x))
MPFR_ASSERTN(MPFR_IS_ZERO(y));
else
@@ -131,7 +131,7 @@ special (void)
mpfr_set_prec (x, 73);
mpfr_set_str_binary (x, "0.1101111010101011011011100011010000000101110001011111001011011000101111101E-99");
- mpfr_ui_sub (x, 1, x, GMP_RNDZ);
+ mpfr_ui_sub (x, 1, x, MPFR_RNDZ);
mpfr_nextabove (x);
MPFR_ASSERTN(mpfr_cmp_ui (x, 1) == 0);
@@ -152,7 +152,7 @@ check (unsigned long y, const char *xs, mp_rnd_t rnd_mode, const char *zs)
if (mpfr_cmp_str1 (zz, zs) )
{
printf ("expected difference is %s, got\n",zs);
- mpfr_out_str(stdout, 10, 0, zz, GMP_RNDN);
+ mpfr_out_str(stdout, 10, 0, zz, MPFR_RNDN);
printf ("mpfr_ui_sub failed for y=%lu x=%s with rnd_mode=%s\n",
y, xs, mpfr_print_rnd_mode (rnd_mode));
exit (1);
@@ -176,7 +176,7 @@ check_two_sum (mp_prec_t p)
}
while (x < 1);
mpfr_urandomb (y, RANDS);
- rnd = GMP_RNDN;
+ rnd = MPFR_RNDN;
inexact = mpfr_ui_sub (u, x, y, rnd);
mpfr_sub_ui (v, u, x, rnd);
mpfr_add (w, v, y, rnd);
@@ -208,18 +208,18 @@ check_nans (void)
/* 1 - nan == nan */
mpfr_set_nan (x);
- mpfr_ui_sub (y, 1L, x, GMP_RNDN);
+ mpfr_ui_sub (y, 1L, x, MPFR_RNDN);
MPFR_ASSERTN (mpfr_nan_p (y));
/* 1 - +inf == -inf */
mpfr_set_inf (x, 1);
- mpfr_ui_sub (y, 1L, x, GMP_RNDN);
+ mpfr_ui_sub (y, 1L, x, MPFR_RNDN);
MPFR_ASSERTN (mpfr_inf_p (y));
MPFR_ASSERTN (mpfr_sgn (y) < 0);
/* 1 - -inf == +inf */
mpfr_set_inf (x, -1);
- mpfr_ui_sub (y, 1L, x, GMP_RNDN);
+ mpfr_ui_sub (y, 1L, x, MPFR_RNDN);
MPFR_ASSERTN (mpfr_inf_p (y));
MPFR_ASSERTN (mpfr_sgn (y) > 0);
@@ -240,7 +240,7 @@ static void check_neg (void)
for (i = 0; i <= 25; i++)
{
- mpfr_sqrt_ui (x, i, GMP_RNDN);
+ mpfr_sqrt_ui (x, i, MPFR_RNDN);
for (s = 0; s <= 1; s++)
{
RND_LOOP (r)
@@ -253,7 +253,7 @@ static void check_neg (void)
MPFR_ASSERTN (!(MPFR_IS_POS (yneg) ^ MPFR_IS_POS (ysub)));
MPFR_ASSERTN (tneg == tsub);
}
- mpfr_neg (x, x, GMP_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN);
}
}
@@ -277,21 +277,21 @@ main (int argc, char *argv[])
for (k=0; k<100; k++)
check_two_sum (p);
- check(1196426492, "1.4218093058435347e-3", GMP_RNDN,
+ check(1196426492, "1.4218093058435347e-3", MPFR_RNDN,
"1.1964264919985781e9");
- check(1092583421, "-1.0880649218158844e9", GMP_RNDN,
+ check(1092583421, "-1.0880649218158844e9", MPFR_RNDN,
"2.1806483428158845901e9");
- check(948002822, "1.22191250737771397120e+20", GMP_RNDN,
+ check(948002822, "1.22191250737771397120e+20", MPFR_RNDN,
"-1.2219125073682338611e20");
- check(832100416, "4.68311314939691330000e-215", GMP_RNDD,
+ check(832100416, "4.68311314939691330000e-215", MPFR_RNDD,
"8.3210041599999988079e8");
- check(1976245324, "1.25296395864546893357e+232", GMP_RNDZ,
+ check(1976245324, "1.25296395864546893357e+232", MPFR_RNDZ,
"-1.2529639586454686577e232");
- check(2128997392, "-1.08496826129284207724e+187", GMP_RNDU,
+ check(2128997392, "-1.08496826129284207724e+187", MPFR_RNDU,
"1.0849682612928422704e187");
- check(293607738, "-1.9967571564050541e-5", GMP_RNDU,
+ check(293607738, "-1.9967571564050541e-5", MPFR_RNDU,
"2.9360773800002003e8");
- check(354270183, "2.9469161763489528e3", GMP_RNDN,
+ check(354270183, "2.9469161763489528e3", MPFR_RNDN,
"3.5426723608382362e8");
check_neg ();
diff --git a/tests/ty0.c b/tests/ty0.c
index 34dda218b..f788e0c76 100644
--- a/tests/ty0.c
+++ b/tests/ty0.c
@@ -41,45 +41,45 @@ main (int argc, char *argv[])
/* special values */
mpfr_set_nan (x);
- mpfr_y0 (y, x, GMP_RNDN);
+ mpfr_y0 (y, x, MPFR_RNDN);
MPFR_ASSERTN(mpfr_nan_p (y));
mpfr_set_inf (x, 1); /* +Inf */
- mpfr_y0 (y, x, GMP_RNDN);
+ mpfr_y0 (y, x, MPFR_RNDN);
MPFR_ASSERTN(mpfr_cmp_ui (y, 0) == 0 && MPFR_IS_POS (y));
mpfr_set_inf (x, -1); /* -Inf */
- mpfr_y0 (y, x, GMP_RNDN);
+ mpfr_y0 (y, x, MPFR_RNDN);
MPFR_ASSERTN(mpfr_nan_p (y));
- mpfr_set_ui (x, 0, GMP_RNDN); /* +0 */
- mpfr_y0 (y, x, GMP_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN); /* +0 */
+ mpfr_y0 (y, x, MPFR_RNDN);
MPFR_ASSERTN(mpfr_inf_p (y) && MPFR_IS_NEG (y)); /* y0(+0)=-Inf */
- mpfr_set_ui (x, 0, GMP_RNDN);
- mpfr_neg (x, x, GMP_RNDN); /* -0 */
- mpfr_y0 (y, x, GMP_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN); /* -0 */
+ mpfr_y0 (y, x, MPFR_RNDN);
MPFR_ASSERTN(mpfr_inf_p (y) && MPFR_IS_NEG (y)); /* y0(-0)=-Inf */
mpfr_set_prec (x, 53);
mpfr_set_prec (y, 53);
- mpfr_set_ui (x, 1, GMP_RNDN);
- mpfr_y0 (y, x, GMP_RNDN);
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_y0 (y, x, MPFR_RNDN);
mpfr_set_str_binary (x, "0.00010110100110000000001000100110111100110101100011011111");
if (mpfr_cmp (x, y))
{
- printf ("Error in mpfr_y0 for x=1, rnd=GMP_RNDN\n");
+ printf ("Error in mpfr_y0 for x=1, rnd=MPFR_RNDN\n");
printf ("Expected "); mpfr_dump (x);
printf ("Got "); mpfr_dump (y);
exit (1);
}
- mpfr_set_si (x, -1, GMP_RNDN);
- mpfr_y0 (y, x, GMP_RNDN);
+ mpfr_set_si (x, -1, MPFR_RNDN);
+ mpfr_y0 (y, x, MPFR_RNDN);
if (!mpfr_nan_p (y))
{
- printf ("Error in mpfr_y0 for x=-1, rnd=GMP_RNDN\n");
+ printf ("Error in mpfr_y0 for x=-1, rnd=MPFR_RNDN\n");
printf ("Expected NaN\n");
printf ("Got "); mpfr_dump (y);
exit (1);
diff --git a/tests/ty1.c b/tests/ty1.c
index 2d5b3e9c6..f66acbf53 100644
--- a/tests/ty1.c
+++ b/tests/ty1.c
@@ -41,45 +41,45 @@ main (int argc, char *argv[])
/* special values */
mpfr_set_nan (x);
- mpfr_y1 (y, x, GMP_RNDN);
+ mpfr_y1 (y, x, MPFR_RNDN);
MPFR_ASSERTN(mpfr_nan_p (y));
mpfr_set_inf (x, 1); /* +Inf */
- mpfr_y1 (y, x, GMP_RNDN);
+ mpfr_y1 (y, x, MPFR_RNDN);
MPFR_ASSERTN(mpfr_cmp_ui (y, 0) == 0 && MPFR_IS_POS (y));
mpfr_set_inf (x, -1); /* -Inf */
- mpfr_y1 (y, x, GMP_RNDN);
+ mpfr_y1 (y, x, MPFR_RNDN);
MPFR_ASSERTN(mpfr_nan_p (y));
- mpfr_set_ui (x, 0, GMP_RNDN); /* +0 */
- mpfr_y1 (y, x, GMP_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN); /* +0 */
+ mpfr_y1 (y, x, MPFR_RNDN);
MPFR_ASSERTN(mpfr_inf_p (y) && MPFR_IS_NEG (y)); /* y1(+0)=-Inf */
- mpfr_set_ui (x, 0, GMP_RNDN);
- mpfr_neg (x, x, GMP_RNDN); /* -0 */
- mpfr_y1 (y, x, GMP_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN); /* -0 */
+ mpfr_y1 (y, x, MPFR_RNDN);
MPFR_ASSERTN(mpfr_inf_p (y) && MPFR_IS_NEG (y)); /* y1(-0)=-Inf */
mpfr_set_prec (x, 53);
mpfr_set_prec (y, 53);
- mpfr_set_ui (x, 1, GMP_RNDN);
- mpfr_y1 (y, x, GMP_RNDN);
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_y1 (y, x, MPFR_RNDN);
mpfr_set_str_binary (x, "-0.110001111111110110010000001111101011001101011100101");
if (mpfr_cmp (x, y))
{
- printf ("Error in mpfr_y1 for x=1, rnd=GMP_RNDN\n");
+ printf ("Error in mpfr_y1 for x=1, rnd=MPFR_RNDN\n");
printf ("Expected "); mpfr_dump (x);
printf ("Got "); mpfr_dump (y);
exit (1);
}
- mpfr_set_si (x, -1, GMP_RNDN);
- mpfr_y1 (y, x, GMP_RNDN);
+ mpfr_set_si (x, -1, MPFR_RNDN);
+ mpfr_y1 (y, x, MPFR_RNDN);
if (!mpfr_nan_p (y))
{
- printf ("Error in mpfr_y1 for x=-1, rnd=GMP_RNDN\n");
+ printf ("Error in mpfr_y1 for x=-1, rnd=MPFR_RNDN\n");
printf ("Expected NaN\n");
printf ("Got "); mpfr_dump (y);
exit (1);
diff --git a/tests/tyn.c b/tests/tyn.c
index ac4b11d25..c6661953b 100644
--- a/tests/tyn.c
+++ b/tests/tyn.c
@@ -48,136 +48,136 @@ main (int argc, char *argv[])
prec = atoi (argv[3]);
mpfr_set_prec (x, prec);
mpfr_set_prec (y, prec);
- mpfr_set_str (x, argv[2], 10, GMP_RNDN);
- mpfr_yn (y, n, x, GMP_RNDN);
+ mpfr_set_str (x, argv[2], 10, MPFR_RNDN);
+ mpfr_yn (y, n, x, MPFR_RNDN);
printf ("Y(%ld,", n);
- mpfr_out_str (stdout, 10, 0, x, GMP_RNDN);
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN);
printf (")=");
- mpfr_out_str (stdout, 10, 0, y, GMP_RNDN);
+ mpfr_out_str (stdout, 10, 0, y, MPFR_RNDN);
printf ("\n");
goto end;
}
/* special values */
mpfr_set_nan (x);
- mpfr_yn (y, 17, x, GMP_RNDN);
+ mpfr_yn (y, 17, x, MPFR_RNDN);
MPFR_ASSERTN(mpfr_nan_p (y));
mpfr_set_inf (x, 1); /* +Inf */
- mpfr_yn (y, 17, x, GMP_RNDN);
+ mpfr_yn (y, 17, x, MPFR_RNDN);
MPFR_ASSERTN(mpfr_cmp_ui (y, 0) == 0 && MPFR_IS_POS (y));
mpfr_set_inf (x, -1); /* -Inf */
- mpfr_yn (y, 17, x, GMP_RNDN);
+ mpfr_yn (y, 17, x, MPFR_RNDN);
MPFR_ASSERTN(mpfr_nan_p (y));
- mpfr_set_ui (x, 0, GMP_RNDN); /* +0 */
- mpfr_yn (y, 0, x, GMP_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN); /* +0 */
+ mpfr_yn (y, 0, x, MPFR_RNDN);
MPFR_ASSERTN(mpfr_inf_p (y) && MPFR_IS_NEG (y)); /* y0(+0)=-Inf */
- mpfr_yn (y, 17, x, GMP_RNDN);
+ mpfr_yn (y, 17, x, MPFR_RNDN);
MPFR_ASSERTN(mpfr_inf_p (y) && MPFR_IS_NEG (y)); /* y17(+0)=-Inf */
- mpfr_yn (y, -17, x, GMP_RNDN);
+ mpfr_yn (y, -17, x, MPFR_RNDN);
MPFR_ASSERTN(mpfr_inf_p (y) && MPFR_IS_POS (y)); /* y(-17,+0)=+Inf */
- mpfr_yn (y, -42, x, GMP_RNDN);
+ mpfr_yn (y, -42, x, MPFR_RNDN);
MPFR_ASSERTN(mpfr_inf_p (y) && MPFR_IS_NEG (y)); /* y(-42,+0)=-Inf */
- mpfr_set_ui (x, 0, GMP_RNDN);
- mpfr_neg (x, x, GMP_RNDN); /* -0 */
- mpfr_yn (y, 0, x, GMP_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN); /* -0 */
+ mpfr_yn (y, 0, x, MPFR_RNDN);
MPFR_ASSERTN(mpfr_inf_p (y) && MPFR_IS_NEG (y)); /* y0(-0)=-Inf */
- mpfr_yn (y, 17, x, GMP_RNDN);
+ mpfr_yn (y, 17, x, MPFR_RNDN);
MPFR_ASSERTN(mpfr_inf_p (y) && MPFR_IS_NEG (y)); /* y17(-0)=-Inf */
- mpfr_yn (y, -17, x, GMP_RNDN);
+ mpfr_yn (y, -17, x, MPFR_RNDN);
MPFR_ASSERTN(mpfr_inf_p (y) && MPFR_IS_POS (y)); /* y(-17,-0)=+Inf */
- mpfr_yn (y, -42, x, GMP_RNDN);
+ mpfr_yn (y, -42, x, MPFR_RNDN);
MPFR_ASSERTN(mpfr_inf_p (y) && MPFR_IS_NEG (y)); /* y(-42,-0)=-Inf */
mpfr_set_prec (x, 53);
mpfr_set_prec (y, 53);
- mpfr_set_ui (x, 1, GMP_RNDN);
- mpfr_yn (y, 0, x, GMP_RNDN);
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_yn (y, 0, x, MPFR_RNDN);
mpfr_set_str_binary (x, "0.00010110100110000000001000100110111100110101100011011111");
if (mpfr_cmp (x, y))
{
- printf ("Error in mpfr_yn for n=0, x=1, rnd=GMP_RNDN\n");
+ printf ("Error in mpfr_yn for n=0, x=1, rnd=MPFR_RNDN\n");
printf ("Expected "); mpfr_dump (x);
printf ("Got "); mpfr_dump (y);
exit (1);
}
- mpfr_set_ui (x, 1, GMP_RNDN);
- mpfr_yn (y, 1, x, GMP_RNDN);
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_yn (y, 1, x, MPFR_RNDN);
mpfr_set_str_binary (x, "-0.110001111111110110010000001111101011001101011100101");
if (mpfr_cmp (x, y))
{
- printf ("Error in mpfr_yn for n=1, x=1, rnd=GMP_RNDN\n");
+ printf ("Error in mpfr_yn for n=1, x=1, rnd=MPFR_RNDN\n");
printf ("Expected "); mpfr_dump (x);
printf ("Got "); mpfr_dump (y);
exit (1);
}
- mpfr_set_ui (x, 1, GMP_RNDN);
- mpfr_yn (y, -1, x, GMP_RNDN);
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_yn (y, -1, x, MPFR_RNDN);
mpfr_set_str_binary (x, "0.110001111111110110010000001111101011001101011100101");
if (mpfr_cmp (x, y))
{
- printf ("Error in mpfr_yn for n=-1, x=1, rnd=GMP_RNDN\n");
+ printf ("Error in mpfr_yn for n=-1, x=1, rnd=MPFR_RNDN\n");
printf ("Expected "); mpfr_dump (x);
printf ("Got "); mpfr_dump (y);
exit (1);
}
- mpfr_set_ui (x, 1, GMP_RNDN);
- mpfr_yn (y, 2, x, GMP_RNDN);
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_yn (y, 2, x, MPFR_RNDN);
mpfr_set_str_binary (x, "-1.101001101001001100100010101001000101101000010010001");
if (mpfr_cmp (x, y))
{
- printf ("Error in mpfr_yn for n=2, x=1, rnd=GMP_RNDN\n");
+ printf ("Error in mpfr_yn for n=2, x=1, rnd=MPFR_RNDN\n");
printf ("Expected "); mpfr_dump (x);
printf ("Got "); mpfr_dump (y);
exit (1);
}
- mpfr_set_ui (x, 1, GMP_RNDN);
- mpfr_yn (y, -2, x, GMP_RNDN);
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_yn (y, -2, x, MPFR_RNDN);
mpfr_set_str_binary (x, "-1.101001101001001100100010101001000101101000010010001");
if (mpfr_cmp (x, y))
{
- printf ("Error in mpfr_yn for n=-2, x=1, rnd=GMP_RNDN\n");
+ printf ("Error in mpfr_yn for n=-2, x=1, rnd=MPFR_RNDN\n");
printf ("Expected "); mpfr_dump (x);
printf ("Got "); mpfr_dump (y);
exit (1);
}
- mpfr_set_ui (x, 1, GMP_RNDN);
- mpfr_yn (y, 17, x, GMP_RNDN);
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_yn (y, 17, x, MPFR_RNDN);
mpfr_set_str_binary (x, "-0.11000100111000100010101101011000110011001101100001011E60");
if (mpfr_cmp (x, y))
{
- printf ("Error in mpfr_yn for n=17, x=1, rnd=GMP_RNDN\n");
+ printf ("Error in mpfr_yn for n=17, x=1, rnd=MPFR_RNDN\n");
printf ("Expected "); mpfr_dump (x);
printf ("Got "); mpfr_dump (y);
exit (1);
}
- mpfr_set_ui (x, 1, GMP_RNDN);
- mpfr_yn (y, -17, x, GMP_RNDN);
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_yn (y, -17, x, MPFR_RNDN);
mpfr_set_str_binary (x, "0.11000100111000100010101101011000110011001101100001011E60");
if (mpfr_cmp (x, y))
{
- printf ("Error in mpfr_yn for n=-17, x=1, rnd=GMP_RNDN\n");
+ printf ("Error in mpfr_yn for n=-17, x=1, rnd=MPFR_RNDN\n");
printf ("Expected "); mpfr_dump (x);
printf ("Got "); mpfr_dump (y);
exit (1);
}
- mpfr_set_ui (x, 17, GMP_RNDN);
- mpfr_yn (y, 1, x, GMP_RNDN);
+ mpfr_set_ui (x, 17, MPFR_RNDN);
+ mpfr_yn (y, 1, x, MPFR_RNDN);
mpfr_set_str_binary (x, "0.00101010110011011111001100000001101011011001111111");
if (mpfr_cmp (x, y))
{
- printf ("Error in mpfr_yn for n=1, x=17, rnd=GMP_RNDN\n");
+ printf ("Error in mpfr_yn for n=1, x=17, rnd=MPFR_RNDN\n");
printf ("Expected "); mpfr_dump (x);
printf ("Got "); mpfr_dump (y);
exit (1);
diff --git a/tests/tzeta.c b/tests/tzeta.c
index 44a72e595..335f32aa8 100644
--- a/tests/tzeta.c
+++ b/tests/tzeta.c
@@ -34,12 +34,12 @@ test1 (void)
mpfr_init2 (y, 42);
mpfr_set_str_binary (x, "1.1111111101000111011010010010100e-1");
- mpfr_zeta (y, x, GMP_RNDN); /* shouldn't crash */
+ mpfr_zeta (y, x, MPFR_RNDN); /* shouldn't crash */
mpfr_set_prec (x, 40);
mpfr_set_prec (y, 50);
mpfr_set_str_binary (x, "1.001101001101000010011010110100110000101e-1");
- mpfr_zeta (y, x, GMP_RNDU);
+ mpfr_zeta (y, x, MPFR_RNDU);
mpfr_set_prec (x, 50);
mpfr_set_str_binary (x, "-0.11111100011100111111101111100011110111001111111111E1");
if (mpfr_cmp (x, y))
@@ -48,7 +48,7 @@ test1 (void)
printf ("Expected "); mpfr_print_binary (x); puts ("");
printf ("Got "); mpfr_print_binary (y); puts ("");
mpfr_set_str_binary (x, "1.001101001101000010011010110100110000101e-1");
- mpfr_zeta (y, x, GMP_RNDU);
+ mpfr_zeta (y, x, MPFR_RNDU);
mpfr_print_binary (x); puts ("");
mpfr_print_binary (y); puts ("");
exit (1);
@@ -57,7 +57,7 @@ test1 (void)
mpfr_set_prec (x, 2);
mpfr_set_prec (y, 55);
mpfr_set_str_binary (x, "0.11e3");
- mpfr_zeta (y, x, GMP_RNDN);
+ mpfr_zeta (y, x, MPFR_RNDN);
mpfr_set_prec (x, 55);
mpfr_set_str_binary (x, "0.1000001000111000010011000010011000000100100100100010010E1");
if (mpfr_cmp (x, y))
@@ -71,7 +71,7 @@ test1 (void)
mpfr_set_prec (x, 3);
mpfr_set_prec (y, 47);
mpfr_set_str_binary (x, "0.111e4");
- mpfr_zeta (y, x, GMP_RNDN);
+ mpfr_zeta (y, x, MPFR_RNDN);
mpfr_set_prec (x, 47);
mpfr_set_str_binary (x, "1.0000000000000100000000111001001010111100101011");
if (mpfr_cmp (x, y))
@@ -84,26 +84,26 @@ test1 (void)
mpfr_set_prec (x, 7);
mpfr_set_str_binary (x, "1.000001");
mpfr_set_prec (y, 2);
- mpfr_zeta (y, x, GMP_RNDN);
+ mpfr_zeta (y, x, MPFR_RNDN);
MPFR_ASSERTN(mpfr_cmp_ui (y, 64) == 0);
/* another coverage test */
mpfr_set_prec (x, 24);
- mpfr_set_ui (x, 2, GMP_RNDN);
+ mpfr_set_ui (x, 2, MPFR_RNDN);
mpfr_set_prec (y, 2);
- mpfr_zeta (y, x, GMP_RNDN);
+ mpfr_zeta (y, x, MPFR_RNDN);
MPFR_ASSERTN(mpfr_cmp_ui_2exp (y, 3, -1) == 0);
mpfr_set_nan (x);
- mpfr_zeta (y, x, GMP_RNDN);
+ mpfr_zeta (y, x, MPFR_RNDN);
MPFR_ASSERTN(mpfr_nan_p (y));
mpfr_set_inf (x, 1);
- mpfr_zeta (y, x, GMP_RNDN);
+ mpfr_zeta (y, x, MPFR_RNDN);
MPFR_ASSERTN(mpfr_cmp_ui (y, 1) == 0);
mpfr_set_inf (x, -1);
- mpfr_zeta (y, x, GMP_RNDN);
+ mpfr_zeta (y, x, MPFR_RNDN);
MPFR_ASSERTN(mpfr_nan_p (y));
mpfr_clear (x);
@@ -167,18 +167,18 @@ test2 (void)
for(i = 0 ; i < n ; i+=2)
{
mpfr_set_str1 (x, val[i]);
- mpfr_zeta(y, x, GMP_RNDZ);
- if (mpfr_cmp_str (y, val[i+1] , 2, GMP_RNDZ))
+ mpfr_zeta(y, x, MPFR_RNDZ);
+ if (mpfr_cmp_str (y, val[i+1] , 2, MPFR_RNDZ))
{
printf("Wrong result for zeta(%s=", val[i]);
mpfr_print_binary (x);
printf (").\nGot : ");
mpfr_print_binary(y); putchar('\n');
printf("Expected: ");
- mpfr_set_str (y, val[i+1], 2, GMP_RNDZ);
+ mpfr_set_str (y, val[i+1], 2, MPFR_RNDZ);
mpfr_print_binary(y); putchar('\n');
mpfr_set_prec(y, 65);
- mpfr_zeta(y, x, GMP_RNDZ);
+ mpfr_zeta(y, x, MPFR_RNDZ);
printf("+ Prec : ");
mpfr_print_binary(y); putchar('\n');
exit(1);
@@ -217,11 +217,11 @@ main (int argc, char *argv[])
prec = atoi(argv[2]);
mpfr_init2 (s, prec);
mpfr_init2 (z, prec);
- mpfr_set_str (s, argv[1], 10, GMP_RNDN);
+ mpfr_set_str (s, argv[1], 10, MPFR_RNDN);
rnd_mode = (mp_rnd_t) atoi(argv[3]);
mpfr_zeta (z, s, rnd_mode);
- mpfr_out_str (stdout, 10, 0, z, GMP_RNDN);
+ mpfr_out_str (stdout, 10, 0, z, MPFR_RNDN);
printf ("\n");
mpfr_clear (s);
@@ -241,15 +241,15 @@ main (int argc, char *argv[])
mpfr_set_prec (s, 6);
mpfr_set_prec (z, 6);
mpfr_set_str_binary (s, "1.10010e4");
- mpfr_zeta (z, s, GMP_RNDZ);
+ mpfr_zeta (z, s, MPFR_RNDZ);
mpfr_set_prec (s, 53);
mpfr_set_prec (y, 53);
mpfr_set_prec (z, 53);
- mpfr_set_ui (s, 1, GMP_RNDN);
- mpfr_zeta (z, s, GMP_RNDN);
+ mpfr_set_ui (s, 1, MPFR_RNDN);
+ mpfr_zeta (z, s, MPFR_RNDN);
if (!mpfr_inf_p (z) || MPFR_SIGN (z) < 0)
{
printf ("Error in mpfr_zeta for s = 1 (should be +inf)\n");
@@ -258,25 +258,25 @@ main (int argc, char *argv[])
mpfr_set_str_binary (s, "0.1100011101110111111111111010000110010111001011001011");
mpfr_set_str_binary (y, "-0.11111101111011001001001111111000101010000100000100100E2");
- mpfr_zeta (z, s, GMP_RNDN);
+ mpfr_zeta (z, s, MPFR_RNDN);
if (mpfr_cmp (z, y) != 0)
{
printf ("Error in mpfr_zeta (1,RNDN)\n");
exit (1);
}
- mpfr_zeta (z, s, GMP_RNDZ);
+ mpfr_zeta (z, s, MPFR_RNDZ);
if (mpfr_cmp (z, y) != 0)
{
printf ("Error in mpfr_zeta (1,RNDZ)\n");
exit (1);
}
- mpfr_zeta (z, s, GMP_RNDU);
+ mpfr_zeta (z, s, MPFR_RNDU);
if (mpfr_cmp (z, y) != 0)
{
printf ("Error in mpfr_zeta (1,RNDU)\n");
exit (1);
}
- mpfr_zeta (z, s, GMP_RNDD);
+ mpfr_zeta (z, s, MPFR_RNDD);
mpfr_nexttoinf (y);
if (mpfr_cmp (z, y) != 0)
{
@@ -286,25 +286,25 @@ main (int argc, char *argv[])
mpfr_set_str_binary (s, "0.10001011010011100110010001100100001011000010011001011");
mpfr_set_str_binary (y, "-0.11010011010010101101110111011010011101111101111010110E1");
- mpfr_zeta (z, s, GMP_RNDN);
+ mpfr_zeta (z, s, MPFR_RNDN);
if (mpfr_cmp (z, y) != 0)
{
printf ("Error in mpfr_zeta (2,RNDN)\n");
exit (1);
}
- mpfr_zeta (z, s, GMP_RNDZ);
+ mpfr_zeta (z, s, MPFR_RNDZ);
if (mpfr_cmp (z, y) != 0)
{
printf ("Error in mpfr_zeta (2,RNDZ)\n");
exit (1);
}
- mpfr_zeta (z, s, GMP_RNDU);
+ mpfr_zeta (z, s, MPFR_RNDU);
if (mpfr_cmp (z, y) != 0)
{
printf ("Error in mpfr_zeta (2,RNDU)\n");
exit (1);
}
- mpfr_zeta (z, s, GMP_RNDD);
+ mpfr_zeta (z, s, MPFR_RNDD);
mpfr_nexttoinf (y);
if (mpfr_cmp (z, y) != 0)
{
@@ -314,41 +314,41 @@ main (int argc, char *argv[])
mpfr_set_str_binary (s, "0.1100111110100001111110111000110101111001011101000101");
mpfr_set_str_binary (y, "-0.10010111010110000111011111001101100001111011000001010E3");
- mpfr_zeta (z, s, GMP_RNDN);
+ mpfr_zeta (z, s, MPFR_RNDN);
if (mpfr_cmp (z, y) != 0)
{
printf ("Error in mpfr_zeta (3,RNDN)\n");
exit (1);
}
- mpfr_zeta (z, s, GMP_RNDD);
+ mpfr_zeta (z, s, MPFR_RNDD);
if (mpfr_cmp (z, y) != 0)
{
printf ("Error in mpfr_zeta (3,RNDD)\n");
exit (1);
}
mpfr_nexttozero (y);
- mpfr_zeta (z, s, GMP_RNDZ);
+ mpfr_zeta (z, s, MPFR_RNDZ);
if (mpfr_cmp (z, y) != 0)
{
printf ("Error in mpfr_zeta (3,RNDZ)\n");
exit (1);
}
- mpfr_zeta (z, s, GMP_RNDU);
+ mpfr_zeta (z, s, MPFR_RNDU);
if (mpfr_cmp (z, y) != 0)
{
printf ("Error in mpfr_zeta (3,RNDU)\n");
exit (1);
}
- mpfr_set_str (s, "-400000001", 10, GMP_RNDZ);
- mpfr_zeta (z, s, GMP_RNDN);
+ mpfr_set_str (s, "-400000001", 10, MPFR_RNDZ);
+ mpfr_zeta (z, s, MPFR_RNDN);
if (!(mpfr_inf_p (z) && MPFR_SIGN(z) < 0))
{
printf ("Error in mpfr_zeta (-400000001)\n");
exit (1);
}
- mpfr_set_str (s, "-400000003", 10, GMP_RNDZ);
- mpfr_zeta (z, s, GMP_RNDN);
+ mpfr_set_str (s, "-400000003", 10, MPFR_RNDZ);
+ mpfr_zeta (z, s, MPFR_RNDN);
if (!(mpfr_inf_p (z) && MPFR_SIGN(z) > 0))
{
printf ("Error in mpfr_zeta (-400000003)\n");
@@ -358,11 +358,11 @@ main (int argc, char *argv[])
mpfr_set_prec (s, 34);
mpfr_set_prec (z, 34);
mpfr_set_str_binary (s, "-1.111111100001011110000010001010000e-35");
- mpfr_zeta (z, s, GMP_RNDD);
+ mpfr_zeta (z, s, MPFR_RNDD);
mpfr_set_str_binary (s, "-1.111111111111111111111111111111111e-2");
if (mpfr_cmp (s, z))
{
- printf ("Error in mpfr_zeta, prec=34, GMP_RNDD\n");
+ printf ("Error in mpfr_zeta, prec=34, MPFR_RNDD\n");
mpfr_dump (z);
exit (1);
}
@@ -371,12 +371,12 @@ main (int argc, char *argv[])
mpfr_set_prec (s, 23);
mpfr_set_prec (z, 25);
mpfr_set_str_binary (s, "-1.0110110110001000000000e-27");
- mpfr_zeta (z, s, GMP_RNDN);
+ mpfr_zeta (z, s, MPFR_RNDN);
mpfr_set_prec (s, 25);
mpfr_set_str_binary (s, "-1.111111111111111111111111e-2");
if (mpfr_cmp (s, z))
{
- printf ("Error in mpfr_zeta, prec=25, GMP_RNDN\n");
+ printf ("Error in mpfr_zeta, prec=25, MPFR_RNDN\n");
printf ("expected "); mpfr_dump (s);
printf ("got "); mpfr_dump (z);
exit (1);
@@ -386,9 +386,9 @@ main (int argc, char *argv[])
mpfr_set_prec (s, 128);
mpfr_set_prec (z, 128);
mpfr_set_str_binary (s, "-0.1000000000000000000000000000000000000000000000000000000000000001E64");
- inex = mpfr_zeta (z, s, GMP_RNDN);
+ inex = mpfr_zeta (z, s, MPFR_RNDN);
MPFR_ASSERTN (mpfr_inf_p (z) && MPFR_SIGN (z) < 0 && inex < 0);
- inex = mpfr_zeta (z, s, GMP_RNDU);
+ inex = mpfr_zeta (z, s, MPFR_RNDU);
mpfr_set_inf (s, -1);
mpfr_nextabove (s);
MPFR_ASSERTN (mpfr_equal_p (z, s) && inex > 0);
diff --git a/tests/tzeta_ui.c b/tests/tzeta_ui.c
index 0dc1cb159..9718dec2c 100644
--- a/tests/tzeta_ui.c
+++ b/tests/tzeta_ui.c
@@ -48,19 +48,19 @@ main (int argc, char *argv[])
{
mpfr_set_prec (x, atoi (argv[2]));
mpfr_zeta_ui (x, atoi (argv[1]),
- argc > 3 ? (mp_rnd_t) atoi (argv[3]) : GMP_RNDN);
- mpfr_out_str (stdout, 10, 0, x, GMP_RNDN);
+ argc > 3 ? (mp_rnd_t) atoi (argv[3]) : MPFR_RNDN);
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN);
printf ("\n");
goto clear_and_exit;
}
mpfr_set_prec (x, 33);
mpfr_set_prec (y, 33);
- mpfr_zeta_ui (x, 3, GMP_RNDZ);
+ mpfr_zeta_ui (x, 3, MPFR_RNDZ);
mpfr_set_str_binary (y, "0.100110011101110100000000001001111E1");
if (mpfr_cmp (x, y))
{
- printf ("Error for zeta(3), prec=33, GMP_RNDZ\n");
+ printf ("Error for zeta(3), prec=33, MPFR_RNDZ\n");
printf ("expected "); mpfr_dump (y);
printf ("got "); mpfr_dump (x);
exit (1);
@@ -75,11 +75,11 @@ main (int argc, char *argv[])
mpfr_set_prec (y, yprec);
for (n = 0; n < 50; n++)
- for (rnd = 0; rnd < GMP_RND_MAX; rnd++)
+ for (rnd = 0; rnd < MPFR_RND_MAX; rnd++)
{
- inexact = mpfr_zeta_ui (y, n, GMP_RNDN);
- if (mpfr_can_round (y, yprec, GMP_RNDN, GMP_RNDZ, prec
- + (rnd == GMP_RNDN)))
+ inexact = mpfr_zeta_ui (y, n, MPFR_RNDN);
+ if (mpfr_can_round (y, yprec, MPFR_RNDN, MPFR_RNDZ, prec
+ + (rnd == MPFR_RNDN)))
{
mpfr_set (t, y, (mp_rnd_t) rnd);
inexact = mpfr_zeta_ui (z, n, (mp_rnd_t) rnd);
diff --git a/tuneup.c b/tuneup.c
index 655c7e655..40d5d3757 100644
--- a/tuneup.c
+++ b/tuneup.c
@@ -62,7 +62,7 @@ int verbose;
speed_starttime (); \
i = s->reps; \
do \
- mean_fun (w, x, GMP_RNDN); \
+ mean_fun (w, x, MPFR_RNDN); \
while (--i != 0); \
t = speed_endtime (); \
\
@@ -100,7 +100,7 @@ int verbose;
speed_starttime (); \
i = s->reps; \
do \
- mean_fun (w, x, y, GMP_RNDN); \
+ mean_fun (w, x, y, MPFR_RNDN); \
while (--i != 0); \
t = speed_endtime (); \
\
diff --git a/ui_pow.c b/ui_pow.c
index dfa40fb3a..90093e044 100644
--- a/ui_pow.c
+++ b/ui_pow.c
@@ -31,7 +31,7 @@ mpfr_ui_pow (mpfr_ptr y, unsigned long int n, mpfr_srcptr x, mp_rnd_t rnd_mode)
MPFR_SAVE_EXPO_MARK (expo);
mpfr_init2 (t, sizeof(n) * CHAR_BIT);
- inexact = mpfr_set_ui (t, n, GMP_RNDN);
+ inexact = mpfr_set_ui (t, n, MPFR_RNDN);
MPFR_ASSERTN (!inexact);
inexact = mpfr_pow (y, t, x, rnd_mode);
mpfr_clear (t);
diff --git a/ui_pow_ui.c b/ui_pow_ui.c
index 48ac19260..8c8b5f4ab 100644
--- a/ui_pow_ui.c
+++ b/ui_pow_ui.c
@@ -61,15 +61,15 @@ mpfr_ui_pow_ui (mpfr_ptr x, unsigned long int y, unsigned long int n,
{
int i = size_n;
- inexact = mpfr_set_ui (res, y, GMP_RNDU);
+ inexact = mpfr_set_ui (res, y, MPFR_RNDU);
err = 1;
/* now 2^(i-1) <= n < 2^i: i=1+floor(log2(n)) */
for (i -= 2; i >= 0; i--)
{
- inexact |= mpfr_mul (res, res, res, GMP_RNDU);
+ inexact |= mpfr_mul (res, res, res, MPFR_RNDU);
err++;
if (n & (1UL << i))
- inexact |= mpfr_mul_ui (res, res, y, GMP_RNDU);
+ inexact |= mpfr_mul_ui (res, res, y, MPFR_RNDU);
}
/* since the loop is executed floor(log2(n)) times,
we have err = 1+floor(log2(n)).
diff --git a/vasprintf.c b/vasprintf.c
index 95194e1a5..22e093088 100644
--- a/vasprintf.c
+++ b/vasprintf.c
@@ -182,7 +182,7 @@ specinfo_init (struct printf_spec *specinfo)
specinfo->width = 0;
specinfo->prec = 0;
specinfo->arg_type = NONE;
- specinfo->rnd_mode = GMP_RNDN;
+ specinfo->rnd_mode = MPFR_RNDN;
specinfo->spec = 'i';
specinfo->pad = ' ';
}
@@ -788,9 +788,9 @@ regular_ab (struct number_parts *np, mpfr_srcptr p,
0 if round to zero,
-1 if not decided yet. */
rnd_away =
- spec.rnd_mode == GMP_RNDD ? MPFR_IS_NEG (p) :
- spec.rnd_mode == GMP_RNDU ? MPFR_IS_POS (p) :
- spec.rnd_mode == GMP_RNDZ ? 0 : -1;
+ spec.rnd_mode == MPFR_RNDD ? MPFR_IS_NEG (p) :
+ spec.rnd_mode == MPFR_RNDU ? MPFR_IS_POS (p) :
+ spec.rnd_mode == MPFR_RNDZ ? 0 : -1;
/* exponent for radix-2 with the decimal point after the first
hexadecimal digit */
@@ -1141,22 +1141,22 @@ regular_fg (struct number_parts *np, mpfr_srcptr p,
/* compare y = |p| and 1 - 10^(-spec.prec) */
MPFR_ALIAS (y, p, 1, MPFR_EXP (p));
- mpfr_set_si (u, -spec.prec, GMP_RNDN); /* FIXME: analyze error */
- mpfr_exp10 (u, u, GMP_RNDN);
- mpfr_ui_sub (x, 1, u, GMP_RNDN);
+ mpfr_set_si (u, -spec.prec, MPFR_RNDN); /* FIXME: analyze error */
+ mpfr_exp10 (u, u, MPFR_RNDN);
+ mpfr_ui_sub (x, 1, u, MPFR_RNDN);
rnd_to_one =
mpfr_cmp (y, x) < 0 ? 0 :
- spec.rnd_mode == GMP_RNDD ? MPFR_IS_NEG (p) :
- spec.rnd_mode == GMP_RNDU ? MPFR_IS_POS (p) :
- spec.rnd_mode == GMP_RNDZ ? 0 : -1;
+ spec.rnd_mode == MPFR_RNDD ? MPFR_IS_NEG (p) :
+ spec.rnd_mode == MPFR_RNDU ? MPFR_IS_POS (p) :
+ spec.rnd_mode == MPFR_RNDZ ? 0 : -1;
if (rnd_to_one == -1)
/* round to nearest mode */
{
/* round to 1 iff y = |p| > 1 - 0.5 * 10^(-spec.prec) */
- mpfr_div_2ui (x, u, 1, GMP_RNDN);
- mpfr_ui_sub (x, 1, x, GMP_RNDN);
+ mpfr_div_2ui (x, u, 1, MPFR_RNDN);
+ mpfr_ui_sub (x, 1, x, MPFR_RNDN);
rnd_to_one = mpfr_cmp (y, x) > 0 ? 1 : 0;
}
@@ -1206,9 +1206,9 @@ regular_fg (struct number_parts *np, mpfr_srcptr p,
mpfr_t y;
MPFR_ALIAS (y, p, 1, MPFR_EXP (p)); /* y = |p| */
- mpfr_log10 (x, y, GMP_RNDD); /* FIXME: analyze error */
+ mpfr_log10 (x, y, MPFR_RNDD); /* FIXME: analyze error */
mpfr_floor (x, x);
- mpfr_abs (x, x, GMP_RNDD);
+ mpfr_abs (x, x, MPFR_RNDD);
/* We have rounded away from zero so that x == |e| (with
p = m*10^e, see above). */
@@ -1224,17 +1224,17 @@ regular_fg (struct number_parts *np, mpfr_srcptr p,
0 if round to zero,
-1 if not decided yet. */
rnd_away =
- spec.rnd_mode == GMP_RNDD ? MPFR_IS_NEG (p) :
- spec.rnd_mode == GMP_RNDU ? MPFR_IS_POS (p) :
- spec.rnd_mode == GMP_RNDZ ? 0 : -1;
+ spec.rnd_mode == MPFR_RNDD ? MPFR_IS_NEG (p) :
+ spec.rnd_mode == MPFR_RNDU ? MPFR_IS_POS (p) :
+ spec.rnd_mode == MPFR_RNDZ ? 0 : -1;
if (rnd_away == -1)
/* round to nearest mode */
{
/* round away iff |p| with x = 0.5 * 10^(-spec.prec) */
- mpfr_set_si (x, -spec.prec, GMP_RNDN);
- mpfr_exp10 (x, x, GMP_RNDN);
- mpfr_div_2ui (x, x, 1, GMP_RNDN);
+ mpfr_set_si (x, -spec.prec, MPFR_RNDN);
+ mpfr_exp10 (x, x, MPFR_RNDN);
+ mpfr_div_2ui (x, x, 1, MPFR_RNDN);
rnd_away = mpfr_cmp (y, x) > 0 ? 1 : 0;
}
@@ -1268,7 +1268,7 @@ regular_fg (struct number_parts *np, mpfr_srcptr p,
char *ptr;
size_t str_len;
const size_t nsd = spec.prec < 0 ? 0
- : spec.prec - mpfr_get_ui (x, GMP_RNDZ) + 1;
+ : spec.prec - mpfr_get_ui (x, MPFR_RNDZ) + 1;
/* WARNING: nsd may equal 1, we use here the fact that
mpfr_get_str can return one digit with base ten
(undocumented feature, see comments in get_str.c) */
@@ -1318,11 +1318,11 @@ regular_fg (struct number_parts *np, mpfr_srcptr p,
mp_exp_t exp;
size_t nsd; /* Number of significant digits */
- mpfr_abs (x, p, GMP_RNDD); /* With our choice of precision,
+ mpfr_abs (x, p, MPFR_RNDD); /* With our choice of precision,
x == |p| exactly. */
- mpfr_log10 (x, x, GMP_RNDZ);
+ mpfr_log10 (x, x, MPFR_RNDZ);
mpfr_floor (x, x);
- mpfr_add_ui (x, x, 1, GMP_RNDZ);
+ mpfr_add_ui (x, x, 1, MPFR_RNDZ);
/* We have rounded towards zero so that x == e + 1 (with p = m*10^e,
see above). x is now the number of digits in the integral part. */
@@ -1334,7 +1334,7 @@ regular_fg (struct number_parts *np, mpfr_srcptr p,
return -1;
}
- np->ip_size = mpfr_get_ui (x, GMP_RNDN);
+ np->ip_size = mpfr_get_ui (x, MPFR_RNDN);
nsd = spec.prec < 0 ? 0 : spec.prec + np->ip_size;
str = mpfr_get_str (NULL, &exp, 10, nsd, p, spec.rnd_mode);
@@ -1600,8 +1600,8 @@ partition_number (struct number_parts *np, mpfr_srcptr p,
mpfr_t z;
mpfr_init2 (z, 53);
- mpfr_log10 (z, y, GMP_RNDD);
- x = mpfr_get_si (z, GMP_RNDD);
+ mpfr_log10 (z, y, MPFR_RNDD);
+ x = mpfr_get_si (z, MPFR_RNDD);
mpfr_clear (z);
}
@@ -1617,9 +1617,9 @@ partition_number (struct number_parts *np, mpfr_srcptr p,
0 if not,
-1 if not decided yet. */
round_to_1em4 =
- spec.rnd_mode == GMP_RNDD ? MPFR_IS_NEG (p) :
- spec.rnd_mode == GMP_RNDU ? MPFR_IS_POS (p) :
- spec.rnd_mode == GMP_RNDZ ? 0 : -1;
+ spec.rnd_mode == MPFR_RNDD ? MPFR_IS_NEG (p) :
+ spec.rnd_mode == MPFR_RNDU ? MPFR_IS_POS (p) :
+ spec.rnd_mode == MPFR_RNDZ ? 0 : -1;
if (round_to_1em4 == -1)
/* round to nearest mode: |p| is output as "1e-04" iff
@@ -1628,14 +1628,14 @@ partition_number (struct number_parts *np, mpfr_srcptr p,
mpfr_t z;
mpfr_init2 (z, MPFR_PREC (p)); /* FIXME: analyse error*/
- mpfr_set_si (z, -threshold, GMP_RNDN);
- mpfr_exp10 (z, z, GMP_RNDN);
- mpfr_div_2ui (z, z, 1, GMP_RNDN);
- mpfr_ui_sub (z, 1, z, GMP_RNDN);
+ mpfr_set_si (z, -threshold, MPFR_RNDN);
+ mpfr_exp10 (z, z, MPFR_RNDN);
+ mpfr_div_2ui (z, z, 1, MPFR_RNDN);
+ mpfr_ui_sub (z, 1, z, MPFR_RNDN);
/* here, z = 1 - 10^(-threshold)/2 */
- mpfr_div_ui (z, z, 625, GMP_RNDN);
- mpfr_div_2ui (z, z, 4, GMP_RNDN);
+ mpfr_div_ui (z, z, 625, MPFR_RNDN);
+ mpfr_div_2ui (z, z, 4, MPFR_RNDN);
round_to_1em4 = mpfr_cmp (y, z) < 0 ? 0 : 1;
mpfr_clear (z);
@@ -1889,20 +1889,20 @@ mpfr_vasprintf (char **ptr, const char *fmt, va_list ap)
break;
case 'D':
++fmt;
- spec.rnd_mode = GMP_RNDD;
+ spec.rnd_mode = MPFR_RNDD;
break;
case 'U':
++fmt;
- spec.rnd_mode = GMP_RNDU;
+ spec.rnd_mode = MPFR_RNDU;
break;
case 'Z':
++fmt;
- spec.rnd_mode = GMP_RNDZ;
+ spec.rnd_mode = MPFR_RNDZ;
break;
case 'N':
++fmt;
default:
- spec.rnd_mode = GMP_RNDN;
+ spec.rnd_mode = MPFR_RNDN;
}
}
diff --git a/yn.c b/yn.c
index 41a2deca7..353bbb9be 100644
--- a/yn.c
+++ b/yn.c
@@ -52,23 +52,23 @@ mpfr_yn_s1 (mpfr_ptr s, mpfr_srcptr y, unsigned long n)
mpz_init_set_ui (f, 1);
/* we compute n!*S1 = sum(a[k]*y^k,k=0..n) where a[k] = n!*(n-k)!/k!,
a[0] = (n!)^2, a[1] = n!*(n-1)!, ..., a[n-1] = n, a[n] = 1 */
- mpfr_set_ui (s, 1, GMP_RNDN); /* a[n] */
+ mpfr_set_ui (s, 1, MPFR_RNDN); /* a[n] */
emax = MPFR_EXP(s);
for (k = n; k-- > 0;)
{
/* a[k]/a[k+1] = (n-k)!/k!/(n-(k+1))!*(k+1)! = (k+1)*(n-k) */
- mpfr_mul (s, s, y, GMP_RNDN);
+ mpfr_mul (s, s, y, MPFR_RNDN);
mpz_mul_ui (f, f, n - k);
mpz_mul_ui (f, f, k + 1);
/* invariant: f = a[k] */
- mpfr_add_z (s, s, f, GMP_RNDN);
+ mpfr_add_z (s, s, f, MPFR_RNDN);
e = MPFR_EXP(s);
if (e > emax)
emax = e;
}
/* now we have f = (n!)^2 */
mpz_sqrt (f, f);
- mpfr_div_z (s, s, f, GMP_RNDN);
+ mpfr_div_z (s, s, f, MPFR_RNDN);
mpz_clear (f);
return emax - MPFR_EXP(s);
}
@@ -89,7 +89,7 @@ mpfr_yn_s3 (mpfr_ptr s, mpfr_srcptr y, mpfr_srcptr c, unsigned long n)
mpz_t p, q; /* p/q will store h(k)+h(n+k) */
mp_exp_t exps, expU;
- zz = mpfr_get_ui (y, GMP_RNDU); /* y = z^2/4 */
+ zz = mpfr_get_ui (y, MPFR_RNDU); /* y = z^2/4 */
MPFR_ASSERTN (zz < ULONG_MAX - 2);
zz += 2; /* z^2 <= 2^zz */
mpz_init_set_ui (p, 0);
@@ -104,18 +104,18 @@ mpfr_yn_s3 (mpfr_ptr s, mpfr_srcptr y, mpfr_srcptr c, unsigned long n)
}
mpfr_init2 (t, MPFR_PREC(s));
mpfr_init2 (u, MPFR_PREC(s));
- mpfr_fac_ui (t, n, GMP_RNDN);
- mpfr_div (t, c, t, GMP_RNDN); /* c/n! */
- mpfr_mul_z (u, t, p, GMP_RNDN);
- mpfr_div_z (s, u, q, GMP_RNDN);
+ mpfr_fac_ui (t, n, MPFR_RNDN);
+ mpfr_div (t, c, t, MPFR_RNDN); /* c/n! */
+ mpfr_mul_z (u, t, p, MPFR_RNDN);
+ mpfr_div_z (s, u, q, MPFR_RNDN);
exps = MPFR_EXP (s);
expU = exps;
for (k = 1; ;k ++)
{
/* update t */
- mpfr_mul (t, t, y, GMP_RNDN);
- mpfr_div_ui (t, t, k, GMP_RNDN);
- mpfr_div_ui (t, t, n + k, GMP_RNDN);
+ mpfr_mul (t, t, y, MPFR_RNDN);
+ mpfr_div_ui (t, t, k, MPFR_RNDN);
+ mpfr_div_ui (t, t, n + k, MPFR_RNDN);
/* update p/q:
p/q + 1/k + 1/(n+k) = [p*k*(n+k) + q*(n+k) + q*k]/(q*k*(n+k)) */
mpz_mul_ui (p, p, k);
@@ -123,12 +123,12 @@ mpfr_yn_s3 (mpfr_ptr s, mpfr_srcptr y, mpfr_srcptr c, unsigned long n)
mpz_addmul_ui (p, q, n + 2 * k);
mpz_mul_ui (q, q, k);
mpz_mul_ui (q, q, n + k);
- mpfr_mul_z (u, t, p, GMP_RNDN);
- mpfr_div_z (u, u, q, GMP_RNDN);
+ mpfr_mul_z (u, t, p, MPFR_RNDN);
+ mpfr_div_z (u, u, q, MPFR_RNDN);
exps = MPFR_EXP (u);
if (exps > expU)
expU = exps;
- mpfr_add (s, s, u, GMP_RNDN);
+ mpfr_add (s, s, u, MPFR_RNDN);
exps = MPFR_EXP (s);
if (exps > expU)
expU = exps;
@@ -221,34 +221,34 @@ mpfr_yn (mpfr_ptr res, long n, mpfr_srcptr z, mp_rnd_t r)
mpfr_init2 (t, prec);
mpfr_init2 (logz, prec);
/* first enclose log(z) + euler - log(2) = log(z/2) + euler */
- mpfr_log (logz, z, GMP_RNDD); /* lower bound of log(z) */
- mpfr_set (h, logz, GMP_RNDU); /* exact */
+ mpfr_log (logz, z, MPFR_RNDD); /* lower bound of log(z) */
+ mpfr_set (h, logz, MPFR_RNDU); /* exact */
mpfr_nextabove (h); /* upper bound of log(z) */
- mpfr_const_euler (t, GMP_RNDD); /* lower bound of euler */
- mpfr_add (l, logz, t, GMP_RNDD); /* lower bound of log(z) + euler */
+ mpfr_const_euler (t, MPFR_RNDD); /* lower bound of euler */
+ mpfr_add (l, logz, t, MPFR_RNDD); /* lower bound of log(z) + euler */
mpfr_nextabove (t); /* upper bound of euler */
- mpfr_add (h, h, t, GMP_RNDU); /* upper bound of log(z) + euler */
- mpfr_const_log2 (t, GMP_RNDU); /* upper bound of log(2) */
- mpfr_sub (l, l, t, GMP_RNDD); /* lower bound of log(z/2) + euler */
+ mpfr_add (h, h, t, MPFR_RNDU); /* upper bound of log(z) + euler */
+ mpfr_const_log2 (t, MPFR_RNDU); /* upper bound of log(2) */
+ mpfr_sub (l, l, t, MPFR_RNDD); /* lower bound of log(z/2) + euler */
mpfr_nextbelow (t); /* lower bound of log(2) */
- mpfr_sub (h, h, t, GMP_RNDU); /* upper bound of log(z/2) + euler */
- mpfr_const_pi (t, GMP_RNDU); /* upper bound of Pi */
- mpfr_div (l, l, t, GMP_RNDD); /* lower bound of (log(z/2)+euler)/Pi */
+ mpfr_sub (h, h, t, MPFR_RNDU); /* upper bound of log(z/2) + euler */
+ mpfr_const_pi (t, MPFR_RNDU); /* upper bound of Pi */
+ mpfr_div (l, l, t, MPFR_RNDD); /* lower bound of (log(z/2)+euler)/Pi */
mpfr_nextbelow (t); /* lower bound of Pi */
- mpfr_div (h, h, t, GMP_RNDD); /* upper bound of (log(z/2)+euler)/Pi */
- mpfr_mul_2ui (l, l, 1, GMP_RNDD); /* lower bound on g(z)*log(z) */
- mpfr_mul_2ui (h, h, 1, GMP_RNDU); /* upper bound on g(z)*log(z) */
+ mpfr_div (h, h, t, MPFR_RNDD); /* upper bound of (log(z/2)+euler)/Pi */
+ mpfr_mul_2ui (l, l, 1, MPFR_RNDD); /* lower bound on g(z)*log(z) */
+ mpfr_mul_2ui (h, h, 1, MPFR_RNDU); /* upper bound on g(z)*log(z) */
/* we now have l <= g(z)*log(z) <= h, and we need to add -z^2/2*log(z)
to h */
- mpfr_mul (t, z, z, GMP_RNDU); /* upper bound on z^2 */
+ mpfr_mul (t, z, z, MPFR_RNDU); /* upper bound on z^2 */
/* since logz is negative, a lower bound corresponds to an upper bound
for its absolute value */
- mpfr_neg (t, t, GMP_RNDD);
- mpfr_div_2ui (t, t, 1, GMP_RNDD);
- mpfr_mul (t, t, logz, GMP_RNDU); /* upper bound on z^2/2*log(z) */
+ mpfr_neg (t, t, MPFR_RNDD);
+ mpfr_div_2ui (t, t, 1, MPFR_RNDD);
+ mpfr_mul (t, t, logz, MPFR_RNDU); /* upper bound on z^2/2*log(z) */
/* an underflow may happen in the above instructions, clear flag */
mpfr_clear_underflow ();
- mpfr_add (h, h, t, GMP_RNDU);
+ mpfr_add (h, h, t, MPFR_RNDU);
inex = mpfr_prec_round (l, MPFR_PREC(res), r);
inex2 = mpfr_prec_round (h, MPFR_PREC(res), r);
/* we need h=l and inex=inex2 */
@@ -277,17 +277,17 @@ mpfr_yn (mpfr_ptr res, long n, mpfr_srcptr z, mp_rnd_t r)
then |y1(z)| > 2^emax */
prec = MPFR_PREC(res) + 10;
mpfr_init2 (y, prec);
- mpfr_const_pi (y, GMP_RNDU); /* Pi*(1+u)^2, where here and below u
+ mpfr_const_pi (y, MPFR_RNDU); /* Pi*(1+u)^2, where here and below u
represents a quantity <= 1/2^prec */
- mpfr_mul (y, y, z, GMP_RNDU); /* Pi*z * (1+u)^4, upper bound */
- MPFR_BLOCK (flags, mpfr_ui_div (y, 2, y, GMP_RNDZ));
+ mpfr_mul (y, y, z, MPFR_RNDU); /* Pi*z * (1+u)^4, upper bound */
+ MPFR_BLOCK (flags, mpfr_ui_div (y, 2, y, MPFR_RNDZ));
/* 2/Pi/z * (1+u)^6, lower bound, with possible overflow */
if (MPFR_OVERFLOW (flags))
{
mpfr_clear (y);
return mpfr_overflow (res, r, -1);
}
- mpfr_neg (y, y, GMP_RNDN);
+ mpfr_neg (y, y, MPFR_RNDN);
/* (1+u)^6 can be written 1+7u [for another value of u], thus the
error on 2/Pi/z is less than 7ulp(y). The truncation error is less
than 1/4, thus if ulp(y)>=1/4, the total error is less than 8ulp(y),
@@ -334,35 +334,35 @@ mpfr_yn (mpfr_ptr res, long n, mpfr_srcptr z, mp_rnd_t r)
mpfr_set_prec (s2, prec);
mpfr_set_prec (s3, prec);
- mpfr_mul (y, z, z, GMP_RNDN);
- mpfr_div_2ui (y, y, 2, GMP_RNDN); /* z^2/4 */
+ mpfr_mul (y, z, z, MPFR_RNDN);
+ mpfr_div_2ui (y, y, 2, MPFR_RNDN); /* z^2/4 */
/* store (z/2)^n temporarily in s2 */
- mpfr_pow_ui (s2, z, absn, GMP_RNDN);
- mpfr_div_2si (s2, s2, absn, GMP_RNDN);
+ mpfr_pow_ui (s2, z, absn, MPFR_RNDN);
+ mpfr_div_2si (s2, s2, absn, MPFR_RNDN);
/* compute S1 * (z/2)^(-n) */
if (n == 0)
{
- mpfr_set_ui (s1, 0, GMP_RNDN);
+ mpfr_set_ui (s1, 0, MPFR_RNDN);
err1 = 0;
}
else
err1 = mpfr_yn_s1 (s1, y, absn - 1);
- mpfr_div (s1, s1, s2, GMP_RNDN); /* (z/2)^(-n) * S1 */
+ mpfr_div (s1, s1, s2, MPFR_RNDN); /* (z/2)^(-n) * S1 */
/* See algorithms.tex: the relative error on s1 is bounded by
(3n+3)*2^(e+1-prec). */
err1 = MPFR_INT_CEIL_LOG2 (3 * absn + 3) + err1 + 1;
/* rel_err(s1) <= 2^(err1-prec), thus err(s1) <= 2^err1 ulps */
/* compute (z/2)^n * S3 */
- mpfr_neg (y, y, GMP_RNDN); /* -z^2/4 */
+ mpfr_neg (y, y, MPFR_RNDN); /* -z^2/4 */
err3 = mpfr_yn_s3 (s3, y, s2, absn); /* (z/2)^n * S3 */
/* the error on s3 is bounded by 2^err3 ulps */
/* add s1+s3 */
err1 += MPFR_EXP(s1);
- mpfr_add (s1, s1, s3, GMP_RNDN);
+ mpfr_add (s1, s1, s3, MPFR_RNDN);
/* the error is bounded by 1/2 + 2^err1*2^(- EXP(s1))
+ 2^err3*2^(EXP(s3) - EXP(s1)) */
err3 += MPFR_EXP(s3);
@@ -372,28 +372,28 @@ mpfr_yn (mpfr_ptr res, long n, mpfr_srcptr z, mp_rnd_t r)
/* now the error on s1 is bounded by 2^err1*ulp(s1) */
/* compute S2 */
- mpfr_div_2ui (s2, z, 1, GMP_RNDN); /* z/2 */
- mpfr_log (s2, s2, GMP_RNDN); /* log(z/2) */
- mpfr_const_euler (s3, GMP_RNDN);
+ mpfr_div_2ui (s2, z, 1, MPFR_RNDN); /* z/2 */
+ mpfr_log (s2, s2, MPFR_RNDN); /* log(z/2) */
+ mpfr_const_euler (s3, MPFR_RNDN);
err2 = MPFR_EXP(s2) > MPFR_EXP(s3) ? MPFR_EXP(s2) : MPFR_EXP(s3);
- mpfr_add (s2, s2, s3, GMP_RNDN); /* log(z/2) + gamma */
+ mpfr_add (s2, s2, s3, MPFR_RNDN); /* log(z/2) + gamma */
err2 -= MPFR_EXP(s2);
- mpfr_mul_2ui (s2, s2, 1, GMP_RNDN); /* 2*(log(z/2) + gamma) */
- mpfr_jn (s3, absn, z, GMP_RNDN); /* Jn(z) */
- mpfr_mul (s2, s2, s3, GMP_RNDN); /* 2*(log(z/2) + gamma)*Jn(z) */
+ mpfr_mul_2ui (s2, s2, 1, MPFR_RNDN); /* 2*(log(z/2) + gamma) */
+ mpfr_jn (s3, absn, z, MPFR_RNDN); /* Jn(z) */
+ mpfr_mul (s2, s2, s3, MPFR_RNDN); /* 2*(log(z/2) + gamma)*Jn(z) */
err2 += 4; /* the error on s2 is bounded by 2^err2 ulps, see
algorithms.tex */
/* add all three sums */
err1 += MPFR_EXP(s1); /* the error on s1 is bounded by 2^err1 */
err2 += MPFR_EXP(s2); /* the error on s2 is bounded by 2^err2 */
- mpfr_sub (s2, s2, s1, GMP_RNDN); /* s2 - (s1+s3) */
+ mpfr_sub (s2, s2, s1, MPFR_RNDN); /* s2 - (s1+s3) */
err2 = (err1 > err2) ? err1 + 1 : err2 + 1;
err2 -= MPFR_EXP(s2);
err2 = (err2 >= 0) ? err2 + 1 : 1;
/* now the error on s2 is bounded by 2^err2*ulp(s2) */
- mpfr_const_pi (y, GMP_RNDN); /* error bounded by 1 ulp */
- mpfr_div (s2, s2, y, GMP_RNDN); /* error bounded by
+ mpfr_const_pi (y, MPFR_RNDN); /* error bounded by 1 ulp */
+ mpfr_div (s2, s2, y, MPFR_RNDN); /* error bounded by
2^(err2+1)*ulp(s2) */
err2 ++;
diff --git a/zeta.c b/zeta.c
index 6e1983fd2..98471ef73 100644
--- a/zeta.c
+++ b/zeta.c
@@ -52,27 +52,27 @@ mpfr_zeta_part_b (mpfr_t b, mpfr_srcptr s, int n, int p, mpfr_t *tc)
/* t equals 2p-2, 2p-3, ... ; s1 equals s+t */
t = 2 * p - 2;
- mpfr_set (d, tc[p], GMP_RNDN);
+ mpfr_set (d, tc[p], MPFR_RNDN);
for (l = 1; l < p; l++)
{
- mpfr_add_ui (s1, s, t, GMP_RNDN); /* s + (2p-2l) */
- mpfr_mul (d, d, s1, GMP_RNDN);
+ mpfr_add_ui (s1, s, t, MPFR_RNDN); /* s + (2p-2l) */
+ mpfr_mul (d, d, s1, MPFR_RNDN);
t = t - 1;
- mpfr_add_ui (s1, s, t, GMP_RNDN); /* s + (2p-2l-1) */
- mpfr_mul (d, d, s1, GMP_RNDN);
+ mpfr_add_ui (s1, s, t, MPFR_RNDN); /* s + (2p-2l-1) */
+ mpfr_mul (d, d, s1, MPFR_RNDN);
t = t - 1;
- mpfr_div_ui (d, d, n2, GMP_RNDN);
- mpfr_add (d, d, tc[p-l], GMP_RNDN);
+ mpfr_div_ui (d, d, n2, MPFR_RNDN);
+ mpfr_add (d, d, tc[p-l], MPFR_RNDN);
/* since s is positive and the tc[i] have alternate signs,
the following is unlikely */
if (MPFR_UNLIKELY (mpfr_cmpabs (d, tc[p-l]) > 0))
- mpfr_set (d, tc[p-l], GMP_RNDN);
+ mpfr_set (d, tc[p-l], MPFR_RNDN);
}
- mpfr_mul (d, d, s, GMP_RNDN);
- mpfr_add (s1, s, __gmpfr_one, GMP_RNDN);
- mpfr_neg (s1, s1, GMP_RNDN);
- mpfr_ui_pow (u, n, s1, GMP_RNDN);
- mpfr_mul (b, d, u, GMP_RNDN);
+ mpfr_mul (d, d, s, MPFR_RNDN);
+ mpfr_add (s1, s, __gmpfr_one, MPFR_RNDN);
+ mpfr_neg (s1, s1, MPFR_RNDN);
+ mpfr_ui_pow (u, n, s1, MPFR_RNDN);
+ mpfr_mul (b, d, u, MPFR_RNDN);
MPFR_GROUP_CLEAR (group);
}
@@ -90,17 +90,17 @@ mpfr_zeta_c (int p, mpfr_t *tc)
if (p > 0)
{
mpfr_init2 (d, MPFR_PREC (tc[1]));
- mpfr_div_ui (tc[1], __gmpfr_one, 12, GMP_RNDN);
+ mpfr_div_ui (tc[1], __gmpfr_one, 12, MPFR_RNDN);
for (k = 2; k <= p; k++)
{
- mpfr_set_ui (d, k-1, GMP_RNDN);
- mpfr_div_ui (d, d, 12*k+6, GMP_RNDN);
+ mpfr_set_ui (d, k-1, MPFR_RNDN);
+ mpfr_div_ui (d, d, 12*k+6, MPFR_RNDN);
for (l=2; l < k; l++)
{
- mpfr_div_ui (d, d, 4*(2*k-2*l+3)*(2*k-2*l+2), GMP_RNDN);
- mpfr_add (d, d, tc[l], GMP_RNDN);
+ mpfr_div_ui (d, d, 4*(2*k-2*l+3)*(2*k-2*l+2), MPFR_RNDN);
+ mpfr_add (d, d, tc[l], MPFR_RNDN);
}
- mpfr_div_ui (tc[k], d, 24, GMP_RNDN);
+ mpfr_div_ui (tc[k], d, 24, MPFR_RNDN);
MPFR_CHANGE_SIGN (tc[k]);
}
mpfr_clear (d);
@@ -119,16 +119,16 @@ mpfr_zeta_part_a (mpfr_t sum, mpfr_srcptr s, int n)
MPFR_GROUP_INIT_2 (group, MPFR_PREC (sum), u, s1);
- mpfr_neg (s1, s, GMP_RNDN);
- mpfr_ui_pow (u, n, s1, GMP_RNDN);
- mpfr_div_2ui (u, u, 1, GMP_RNDN);
- mpfr_set (sum, u, GMP_RNDN);
+ mpfr_neg (s1, s, MPFR_RNDN);
+ mpfr_ui_pow (u, n, s1, MPFR_RNDN);
+ mpfr_div_2ui (u, u, 1, MPFR_RNDN);
+ mpfr_set (sum, u, MPFR_RNDN);
for (i=n-1; i>1; i--)
{
- mpfr_ui_pow (u, i, s1, GMP_RNDN);
- mpfr_add (sum, sum, u, GMP_RNDN);
+ mpfr_ui_pow (u, i, s1, MPFR_RNDN);
+ mpfr_add (sum, sum, u, MPFR_RNDN);
}
- mpfr_add (sum, sum, __gmpfr_one, GMP_RNDN);
+ mpfr_add (sum, sum, __gmpfr_one, MPFR_RNDN);
MPFR_GROUP_CLEAR (group);
}
@@ -182,7 +182,7 @@ mpfr_zeta_pos (mpfr_t z, mpfr_srcptr s, mp_rnd_t rnd_mode)
/* we want that s1 = s-1 is exact, i.e. we should have PREC(s1) >= EXP(s) */
dint = (mpfr_uexp_t) MPFR_GET_EXP (s);
mpfr_init2 (s1, MAX (precs, dint));
- inex = mpfr_sub (s1, s, __gmpfr_one, GMP_RNDN);
+ inex = mpfr_sub (s1, s, __gmpfr_one, MPFR_RNDN);
MPFR_ASSERTD (inex == 0);
/* case s=1 */
@@ -210,9 +210,9 @@ mpfr_zeta_pos (mpfr_t z, mpfr_srcptr s, mp_rnd_t rnd_mode)
MPFR_TRACE (printf ("branch 1\ninternal precision=%lu\n",
(unsigned long) dint));
MPFR_GROUP_REPREC_4 (group, dint, b, c, z_pre, f);
- mpfr_div (z_pre, __gmpfr_one, s1, GMP_RNDN);
- mpfr_const_euler (f, GMP_RNDN);
- mpfr_add (z_pre, z_pre, f, GMP_RNDN);
+ mpfr_div (z_pre, __gmpfr_one, s1, MPFR_RNDN);
+ mpfr_const_euler (f, MPFR_RNDN);
+ mpfr_add (z_pre, z_pre, f, MPFR_RNDN);
}
else /* Branch 2 */
{
@@ -221,7 +221,7 @@ mpfr_zeta_pos (mpfr_t z, mpfr_srcptr s, mp_rnd_t rnd_mode)
MPFR_TRACE (printf ("branch 2\n"));
/* Computation of parameters n, p and working precision */
dnep = (double) d * LOG2;
- sd = mpfr_get_d (s, GMP_RNDN);
+ sd = mpfr_get_d (s, MPFR_RNDN);
/* beta = dnep + 0.61 + sd * log (6.2832 / sd);
but a larger value is ok */
#define LOG6dot2832 1.83787940484160805532
@@ -266,12 +266,12 @@ mpfr_zeta_pos (mpfr_t z, mpfr_srcptr s, mp_rnd_t rnd_mode)
mpfr_zeta_part_a (z_pre, s, n);
mpfr_zeta_part_b (b, s, n, p, tc1);
/* s1 = s-1 is already computed above */
- mpfr_div (c, __gmpfr_one, s1, GMP_RNDN);
- mpfr_ui_pow (f, n, s1, GMP_RNDN);
- mpfr_div (c, c, f, GMP_RNDN);
+ mpfr_div (c, __gmpfr_one, s1, MPFR_RNDN);
+ mpfr_ui_pow (f, n, s1, MPFR_RNDN);
+ mpfr_div (c, c, f, MPFR_RNDN);
MPFR_TRACE (MPFR_DUMP (c));
- mpfr_add (z_pre, z_pre, c, GMP_RNDN);
- mpfr_add (z_pre, z_pre, b, GMP_RNDN);
+ mpfr_add (z_pre, z_pre, c, MPFR_RNDN);
+ mpfr_add (z_pre, z_pre, b, MPFR_RNDN);
for (l=1; l<=p; l++)
mpfr_clear (tc1[l]);
(*__gmp_free_func) (tc1, size);
@@ -320,7 +320,7 @@ mpfr_zeta (mpfr_t z, mpfr_srcptr s, mp_rnd_t rnd_mode)
else if (MPFR_IS_INF (s))
{
if (MPFR_IS_POS (s))
- return mpfr_set_ui (z, 1, GMP_RNDN); /* Zeta(+Inf) = 1 */
+ return mpfr_set_ui (z, 1, MPFR_RNDN); /* Zeta(+Inf) = 1 */
MPFR_SET_NAN (z); /* Zeta(-Inf) = NaN */
MPFR_RET_NAN;
}
@@ -345,25 +345,25 @@ mpfr_zeta (mpfr_t z, mpfr_srcptr s, mp_rnd_t rnd_mode)
{
int signs = MPFR_SIGN(s);
mpfr_set_si_2exp (z, -1, -1, rnd_mode); /* -1/2 */
- if (rnd_mode == GMP_RNDA)
- rnd_mode = GMP_RNDD; /* the result is around -1/2, thus negative */
- if ((rnd_mode == GMP_RNDU || rnd_mode == GMP_RNDZ) && signs < 0)
+ if (rnd_mode == MPFR_RNDA)
+ rnd_mode = MPFR_RNDD; /* the result is around -1/2, thus negative */
+ if ((rnd_mode == MPFR_RNDU || rnd_mode == MPFR_RNDZ) && signs < 0)
{
mpfr_nextabove (z); /* z = -1/2 + epsilon */
inex = 1;
}
- else if (rnd_mode == GMP_RNDD && signs > 0)
+ else if (rnd_mode == MPFR_RNDD && signs > 0)
{
mpfr_nextbelow (z); /* z = -1/2 - epsilon */
inex = -1;
}
else
{
- if (rnd_mode == GMP_RNDU) /* s > 0: z = -1/2 */
+ if (rnd_mode == MPFR_RNDU) /* s > 0: z = -1/2 */
inex = 1;
- else if (rnd_mode == GMP_RNDD)
+ else if (rnd_mode == MPFR_RNDD)
inex = -1; /* s < 0: z = -1/2 */
- else /* (GMP_RNDZ and s > 0) or GMP_RNDN: z = -1/2 */
+ else /* (MPFR_RNDZ and s > 0) or MPFR_RNDN: z = -1/2 */
inex = (signs > 0) ? 1 : -1;
}
return mpfr_check_range (z, inex, rnd_mode);
@@ -399,7 +399,7 @@ mpfr_zeta (mpfr_t z, mpfr_srcptr s, mp_rnd_t rnd_mode)
/* Precision precs1 needed to represent 1 - s, and s + 2,
without any truncation */
precs1 = precs + 2 + MAX (0, - MPFR_GET_EXP (s));
- sd = mpfr_get_d (s, GMP_RNDN) - 1.0;
+ sd = mpfr_get_d (s, MPFR_RNDN) - 1.0;
if (sd < 0.0)
sd = -sd; /* now sd = abs(s-1.0) */
/* Precision prec1 is the precision on elementary computations;
@@ -417,28 +417,28 @@ mpfr_zeta (mpfr_t z, mpfr_srcptr s, mp_rnd_t rnd_mode)
MPFR_ZIV_INIT (loop, prec1);
for (;;)
{
- mpfr_sub (s1, __gmpfr_one, s, GMP_RNDN);/* s1 = 1-s */
- mpfr_zeta_pos (z_pre, s1, GMP_RNDN); /* zeta(1-s) */
- mpfr_gamma (y, s1, GMP_RNDN); /* gamma(1-s) */
+ mpfr_sub (s1, __gmpfr_one, s, MPFR_RNDN);/* s1 = 1-s */
+ mpfr_zeta_pos (z_pre, s1, MPFR_RNDN); /* zeta(1-s) */
+ mpfr_gamma (y, s1, MPFR_RNDN); /* gamma(1-s) */
if (MPFR_IS_INF (y)) /* Zeta(s) < 0 for -4k-2 < s < -4k,
Zeta(s) > 0 for -4k < s < -4k+2 */
{
- mpfr_div_2ui (s1, s, 2, GMP_RNDN); /* s/4, exact */
- mpfr_frac (s1, s1, GMP_RNDN); /* exact, -1 < s1 < 0 */
+ mpfr_div_2ui (s1, s, 2, MPFR_RNDN); /* s/4, exact */
+ mpfr_frac (s1, s1, MPFR_RNDN); /* exact, -1 < s1 < 0 */
overflow = (mpfr_cmp_si_2exp (s1, -1, -1) > 0) ? -1 : 1;
break;
}
- mpfr_mul (z_pre, z_pre, y, GMP_RNDN); /* gamma(1-s)*zeta(1-s) */
- mpfr_const_pi (p, GMP_RNDD);
- mpfr_mul (y, s, p, GMP_RNDN);
- mpfr_div_2ui (y, y, 1, GMP_RNDN); /* s*Pi/2 */
- mpfr_sin (y, y, GMP_RNDN); /* sin(Pi*s/2) */
- mpfr_mul (z_pre, z_pre, y, GMP_RNDN);
- mpfr_mul_2ui (y, p, 1, GMP_RNDN); /* 2*Pi */
- mpfr_neg (s1, s1, GMP_RNDN); /* s-1 */
- mpfr_pow (y, y, s1, GMP_RNDN); /* (2*Pi)^(s-1) */
- mpfr_mul (z_pre, z_pre, y, GMP_RNDN);
- mpfr_mul_2ui (z_pre, z_pre, 1, GMP_RNDN);
+ mpfr_mul (z_pre, z_pre, y, MPFR_RNDN); /* gamma(1-s)*zeta(1-s) */
+ mpfr_const_pi (p, MPFR_RNDD);
+ mpfr_mul (y, s, p, MPFR_RNDN);
+ mpfr_div_2ui (y, y, 1, MPFR_RNDN); /* s*Pi/2 */
+ mpfr_sin (y, y, MPFR_RNDN); /* sin(Pi*s/2) */
+ mpfr_mul (z_pre, z_pre, y, MPFR_RNDN);
+ mpfr_mul_2ui (y, p, 1, MPFR_RNDN); /* 2*Pi */
+ mpfr_neg (s1, s1, MPFR_RNDN); /* s-1 */
+ mpfr_pow (y, y, s1, MPFR_RNDN); /* (2*Pi)^(s-1) */
+ mpfr_mul (z_pre, z_pre, y, MPFR_RNDN);
+ mpfr_mul_2ui (z_pre, z_pre, 1, MPFR_RNDN);
if (MPFR_LIKELY (MPFR_CAN_ROUND (z_pre, prec1 - add, precz,
rnd_mode)))
diff --git a/zeta_ui.c b/zeta_ui.c
index 198485c4b..8d8e67d5f 100644
--- a/zeta_ui.c
+++ b/zeta_ui.c
@@ -49,8 +49,8 @@ mpfr_zeta_ui (mpfr_ptr z, unsigned long m, mp_rnd_t r)
mpfr_t y;
int inex;
- if (r == GMP_RNDA)
- r = GMP_RNDU; /* since the result is always positive */
+ if (r == MPFR_RNDA)
+ r = MPFR_RNDU; /* since the result is always positive */
if (m >= p) /* 2^(-m) < ulp(1) = 2^(1-p). This means that
2^(-m) <= 1/2*ulp(1). We have 3^(-m)+4^(-m)+... < 2^(-m)
@@ -59,7 +59,7 @@ mpfr_zeta_ui (mpfr_ptr z, unsigned long m, mp_rnd_t r)
{
if (m == 2) /* necessarily p=2 */
return mpfr_set_ui_2exp (z, 13, -3, r);
- else if (r == GMP_RNDZ || r == GMP_RNDD || (r == GMP_RNDN && m > p))
+ else if (r == MPFR_RNDZ || r == MPFR_RNDD || (r == MPFR_RNDN && m > p))
{
mpfr_set_ui (z, 1, r);
return -1;
@@ -80,14 +80,14 @@ mpfr_zeta_ui (mpfr_ptr z, unsigned long m, mp_rnd_t r)
{
/* the following is a lower bound for log(3)/log(2) */
mpfr_set_str_binary (y, "1.100101011100000000011010001110");
- mpfr_mul_ui (y, y, m, GMP_RNDZ); /* lower bound for log2(3^m) */
+ mpfr_mul_ui (y, y, m, MPFR_RNDZ); /* lower bound for log2(3^m) */
if (mpfr_cmp_ui (y, p + 2) >= 0)
{
mpfr_clear (y);
- mpfr_set_ui (z, 1, GMP_RNDZ);
- mpfr_div_2ui (z, z, m, GMP_RNDZ);
- mpfr_add_ui (z, z, 1, GMP_RNDZ);
- if (r != GMP_RNDU)
+ mpfr_set_ui (z, 1, MPFR_RNDZ);
+ mpfr_div_2ui (z, z, m, MPFR_RNDZ);
+ mpfr_add_ui (z, z, 1, MPFR_RNDZ);
+ if (r != MPFR_RNDU)
return -1;
mpfr_nextabove (z);
return 1;
@@ -204,8 +204,8 @@ mpfr_zeta_ui (mpfr_ptr z, unsigned long m, mp_rnd_t r)
/* divide by d[n] */
mpz_mul_2exp (s, s, p);
mpz_tdiv_q (s, s, d);
- mpfr_set_z (y, s, GMP_RNDN);
- mpfr_div_2ui (y, y, p, GMP_RNDN);
+ mpfr_set_z (y, s, MPFR_RNDN);
+ mpfr_div_2ui (y, y, p, MPFR_RNDN);
err = MPFR_INT_CEIL_LOG2 (err);