diff options
50 files changed, 185 insertions, 184 deletions
@@ -106,8 +106,8 @@ mpfr_agm (mpfr_ptr r, mpfr_srcptr op2, mpfr_srcptr op1, mp_rnd_t rnd_mode) mpfr_set (a,op1,GMP_RNDN); } - vo=mpfr_get_d(b); - uo=mpfr_get_d(a); + vo = mpfr_get_d1 (b); + uo = mpfr_get_d1 (a); mpfr_set(u,a,GMP_RNDN); mpfr_set(v,b,GMP_RNDN); @@ -74,7 +74,7 @@ mpfr_exp (mpfr_ptr y, mpfr_srcptr x, mp_rnd_t rnd_mode) /* result is +Inf when exp(x) >= 2^(__mpfr_emax), i.e. x >= __mpfr_emax * log(2) */ - d = mpfr_get_d (x); + d = mpfr_get_d1 (x); if (d >= (double) __mpfr_emax * LOG2) return mpfr_set_overflow(y, rnd_mode, 1); @@ -114,7 +114,7 @@ mpfr_exp_2 (mpfr_ptr y, mpfr_srcptr x, mp_rnd_t rnd_mode) precy = MPFR_PREC(y); - n = (int) (mpfr_get_d(x) / LOG2); + n = (int) (mpfr_get_d1 (x) / LOG2); /* for the O(n^(1/2)*M(n)) method, the Taylor series computation of n/K terms costs about n/(2K) multiplications when computed in fixed @@ -146,9 +146,9 @@ mpfr_exp_2 (mpfr_ptr y, mpfr_srcptr x, mp_rnd_t rnd_mode) /* r = floor(n*log(2)) */ #ifdef DEBUG - printf("x=%1.20e\n",mpfr_get_d(x)); + printf("x=%1.20e\n", mpfr_get_d1 (x)); printf(" ="); mpfr_print_binary(x); putchar('\n'); - printf("r=%1.20e\n",mpfr_get_d(r)); + printf("r=%1.20e\n", mpfr_get_d1 (r)); printf(" ="); mpfr_print_binary(r); putchar('\n'); #endif mpfr_sub(r, x, r, GMP_RNDU); @@ -159,7 +159,7 @@ mpfr_exp_2 (mpfr_ptr y, mpfr_srcptr x, mp_rnd_t rnd_mode) mpfr_sub(r, x, r, GMP_RNDU); } #ifdef DEBUG - printf("x-r=%1.20e\n",mpfr_get_d(r)); + printf("x-r=%1.20e\n", mpfr_get_d1 (r)); printf(" ="); mpfr_print_binary(r); putchar('\n'); if (MPFR_SIGN(r)<0) { fprintf(stderr,"Error in mpfr_exp: r<0\n"); exit(1); } #endif @@ -194,7 +194,8 @@ mpfr_exp_2 (mpfr_ptr y, mpfr_srcptr x, mp_rnd_t rnd_mode) K += k; #ifdef DEBUG printf("after mult. by 2^n:\n"); - if (MPFR_EXP(s)>-1024) printf("s=%1.20e\n",mpfr_get_d(s)); + if (MPFR_EXP(s) > -1024) + printf("s=%1.20e\n", mpfr_get_d1 (s)); printf(" ="); mpfr_print_binary(s); putchar('\n'); printf("err=%d bits\n", K); #endif @@ -160,14 +160,14 @@ mpfr_get_d3 (mpfr_srcptr src, mp_exp_t e, mp_rnd_t rnd_mode) traps on some implementations). */ double -mpfr_get_d2 (mpfr_srcptr src, mp_rnd_t rnd_mode) +mpfr_get_d (mpfr_srcptr src, mp_rnd_t rnd_mode) { return mpfr_get_d3 (src, MPFR_IS_FP(src) && MPFR_NOTZERO(src) ? MPFR_EXP(src) : 0, rnd_mode); } double -mpfr_get_d (mpfr_srcptr src) +mpfr_get_d1 (mpfr_srcptr src) { return mpfr_get_d3 (src, MPFR_IS_FP(src) && MPFR_NOTZERO(src) ? MPFR_EXP(src) : 0, __gmp_default_rounding_mode); @@ -103,7 +103,7 @@ mpfr_log (mpfr_ptr r, mpfr_srcptr a, mp_rnd_t rnd_mode) q=MPFR_PREC(r); - ref=mpfr_get_d(a)-1.0; + ref = mpfr_get_d1 (a) - 1.0; if (ref<0) ref=-ref; @@ -128,7 +128,7 @@ mpfr_log10 (mpfr_ptr r, mpfr_srcptr a, mp_rnd_t rnd_mode) /* log10(10^n) is exact */ if ((MPFR_SIGN(t) > 0) && mpfr_isinteger(t)) - if (mpfr_ui_pow_ui (tt, 10, (unsigned long int) mpfr_get_d (t) + 0.5, + if (mpfr_ui_pow_ui (tt, 10, (unsigned long int) mpfr_get_d1 (t) + 0.5, GMP_RNDN) == 0) if (mpfr_cmp (a, tt) == 0) ok = 1; diff --git a/mpf2mpfr.h b/mpf2mpfr.h index 87f191b62..e4470a789 100644 --- a/mpf2mpfr.h +++ b/mpf2mpfr.h @@ -38,7 +38,7 @@ MA 02111-1307, USA. */ #undef mpf_floor #define mpf_floor mpfr_floor #undef mpf_get_d -#define mpf_get_d mpfr_get_d +#define mpf_get_d mpfr_get_d1 #undef mpf_get_prec #define mpf_get_prec mpfr_get_prec #undef mpf_init @@ -147,8 +147,8 @@ void mpfr_set_nan _PROTO ((mpfr_ptr)); void mpfr_set_inf _PROTO ((mpfr_ptr, int)); mp_exp_t mpfr_get_z_exp _PROTO ((mpz_ptr, mpfr_srcptr)); int mpfr_set_q _PROTO ((mpfr_ptr, mpq_srcptr, mp_rnd_t)); -double mpfr_get_d _PROTO ((mpfr_srcptr)); -double mpfr_get_d2 _PROTO ((mpfr_srcptr, mp_rnd_t)); +double mpfr_get_d1 _PROTO ((mpfr_srcptr)); +double mpfr_get_d _PROTO ((mpfr_srcptr, mp_rnd_t)); int mpfr_set_f _PROTO ((mpfr_ptr, mpf_srcptr, mp_rnd_t)); int mpfr_set_si _PROTO ((mpfr_ptr, long, mp_rnd_t)); int mpfr_set_ui _PROTO ((mpfr_ptr, unsigned long, mp_rnd_t)); @@ -823,11 +823,11 @@ See @code{mpfr_set_str}. @section Conversion Functions @cindex Conversion functions -@deftypefun double mpfr_get_d2 (mpfr_t @var{op}, mp_rnd_t @var{rnd}) +@deftypefun double mpfr_get_d (mpfr_t @var{op}, mp_rnd_t @var{rnd}) Convert @var{op} to a double, using the rounding mode @var{rnd}. @end deftypefun -@deftypefun double mpfr_get_d (mpfr_t @var{op}) +@deftypefun double mpfr_get_d1 (mpfr_t @var{op}) Convert @var{op} to a double, using the default MPFR rounding mode (see function @code{mpfr_set_default_rounding_mode}). @end deftypefun diff --git a/tests/reuse.c b/tests/reuse.c index 61f880cd9..2f2024d90 100644 --- a/tests/reuse.c +++ b/tests/reuse.c @@ -86,9 +86,9 @@ test3 (char *foo, mp_prec_t prec, mp_rnd_t rnd) if (mpfr_compare (res1, ref1)) { fprintf (stderr, "Error for %s(a, a, c) for a=%e, c=%e\n", foo, - mpfr_get_d (ref2), mpfr_get_d (ref3)); - fprintf (stderr, "expected %e, got %e\n", mpfr_get_d (ref1), - mpfr_get_d (res1)); + mpfr_get_d1 (ref2), mpfr_get_d1 (ref3)); + fprintf (stderr, "expected %e, got %e\n", mpfr_get_d1 (ref1), + mpfr_get_d1 (res1)); exit (1); } @@ -97,9 +97,9 @@ test3 (char *foo, mp_prec_t prec, mp_rnd_t rnd) testfunc (res1, ref2, res1, rnd); if (mpfr_compare (res1, ref1)) { fprintf (stderr, "Error for %s(a, b, a) for b=%e, a=%e\n", foo, - mpfr_get_d (ref2), mpfr_get_d (ref3)); - fprintf (stderr, "expected %e, got %e\n", mpfr_get_d (ref1), - mpfr_get_d (res1)); + mpfr_get_d1 (ref2), mpfr_get_d1 (ref3)); + fprintf (stderr, "expected %e, got %e\n", mpfr_get_d1 (ref1), + mpfr_get_d1 (res1)); exit (1); } @@ -111,9 +111,9 @@ test3 (char *foo, mp_prec_t prec, mp_rnd_t rnd) if (mpfr_compare (res1, ref1)) { fprintf (stderr, "Error for %s(a, a, a) for a=%e\n", foo, - mpfr_get_d (ref2)); - fprintf (stderr, "expected %e, got %e\n", mpfr_get_d (ref1), - mpfr_get_d (res1)); + mpfr_get_d1 (ref2)); + fprintf (stderr, "expected %e, got %e\n", mpfr_get_d1 (ref1), + mpfr_get_d1 (res1)); exit (1); } } @@ -188,9 +188,9 @@ test4 (char *foo, mp_prec_t prec, mp_rnd_t rnd) fprintf (stderr, "Error for %s(a, a, b, c) for a=%e, b=%e, c=%e\n", foo, - mpfr_get_d (op1), mpfr_get_d (op2), mpfr_get_d (op3)); - fprintf (stderr, "expected %e, got %e\n", mpfr_get_d (ref), - mpfr_get_d (res)); + mpfr_get_d1 (op1), mpfr_get_d1 (op2), mpfr_get_d1 (op3)); + fprintf (stderr, "expected %e, got %e\n", mpfr_get_d1 (ref), + mpfr_get_d1 (res)); exit (1); } @@ -203,9 +203,9 @@ test4 (char *foo, mp_prec_t prec, mp_rnd_t rnd) fprintf (stderr, "Error for %s(b, a, b, c) for a=%e, b=%e, c=%e\n", foo, - mpfr_get_d (op1), mpfr_get_d (op2), mpfr_get_d (op3)); - fprintf (stderr, "expected %e, got %e\n", mpfr_get_d (ref), - mpfr_get_d (res)); + mpfr_get_d1 (op1), mpfr_get_d1 (op2), mpfr_get_d1 (op3)); + fprintf (stderr, "expected %e, got %e\n", mpfr_get_d1 (ref), + mpfr_get_d1 (res)); exit (1); } @@ -218,9 +218,9 @@ test4 (char *foo, mp_prec_t prec, mp_rnd_t rnd) fprintf (stderr, "Error for %s(c, a, b, c) for a=%e, b=%e, c=%e\n", foo, - mpfr_get_d (op1), mpfr_get_d (op2), mpfr_get_d (op3)); - fprintf (stderr, "expected %e, got %e\n", mpfr_get_d (ref), - mpfr_get_d (res)); + mpfr_get_d1 (op1), mpfr_get_d1 (op2), mpfr_get_d1 (op3)); + fprintf (stderr, "expected %e, got %e\n", mpfr_get_d1 (ref), + mpfr_get_d1 (res)); exit (1); } @@ -233,9 +233,9 @@ test4 (char *foo, mp_prec_t prec, mp_rnd_t rnd) fprintf (stderr, "Error for %s(a, a, a, c) for a=%e, a=%e, c=%e\n", foo, - mpfr_get_d (op1), mpfr_get_d (op2), mpfr_get_d (op3)); - fprintf (stderr, "expected %e, got %e\n", mpfr_get_d (ref), - mpfr_get_d (res)); + mpfr_get_d1 (op1), mpfr_get_d1 (op2), mpfr_get_d1 (op3)); + fprintf (stderr, "expected %e, got %e\n", mpfr_get_d1 (ref), + mpfr_get_d1 (res)); exit (1); } @@ -248,9 +248,9 @@ test4 (char *foo, mp_prec_t prec, mp_rnd_t rnd) fprintf (stderr, "Error for %s(a, a, b, a) for a=%e, a=%e, c=%e\n", foo, - mpfr_get_d (op1), mpfr_get_d (op2), mpfr_get_d (op3)); - fprintf (stderr, "expected %e, got %e\n", mpfr_get_d (ref), - mpfr_get_d (res)); + mpfr_get_d1 (op1), mpfr_get_d1 (op2), mpfr_get_d1 (op3)); + fprintf (stderr, "expected %e, got %e\n", mpfr_get_d1 (ref), + mpfr_get_d1 (res)); exit (1); } @@ -263,9 +263,9 @@ test4 (char *foo, mp_prec_t prec, mp_rnd_t rnd) fprintf (stderr, "Error for %s(b, a, b, b) for a=%e, a=%e, c=%e\n", foo, - mpfr_get_d (op1), mpfr_get_d (op2), mpfr_get_d (op3)); - fprintf (stderr, "expected %e, got %e\n", mpfr_get_d (ref), - mpfr_get_d (res)); + mpfr_get_d1 (op1), mpfr_get_d1 (op2), mpfr_get_d1 (op3)); + fprintf (stderr, "expected %e, got %e\n", mpfr_get_d1 (ref), + mpfr_get_d1 (res)); exit (1); } @@ -277,9 +277,9 @@ test4 (char *foo, mp_prec_t prec, mp_rnd_t rnd) { fprintf (stderr, "Error for %s(a, a, a, a) for a=%e\n", foo, - mpfr_get_d (op1)); - fprintf (stderr, "expected %e, got %e\n", mpfr_get_d (ref), - mpfr_get_d (res)); + mpfr_get_d1 (op1)); + fprintf (stderr, "expected %e, got %e\n", mpfr_get_d1 (ref), + mpfr_get_d1 (res)); exit (1); } } @@ -341,9 +341,9 @@ test2ui (char *foo, mp_prec_t prec, mp_rnd_t rnd) if (mpfr_compare (res1, ref1)) { fprintf (stderr, "Error for %s(a, a, c) for a=%e c=%u\n", foo, - mpfr_get_d (ref2), ref3); - fprintf (stderr, "expected %e, got %e\n", mpfr_get_d (ref1), - mpfr_get_d (res1)); + mpfr_get_d1 (ref2), ref3); + fprintf (stderr, "expected %e, got %e\n", mpfr_get_d1 (ref1), + mpfr_get_d1 (res1)); exit (1); } } @@ -394,9 +394,9 @@ testui2 (char *foo, mp_prec_t prec, mp_rnd_t rnd) testfunc (res1, ref2, res1, rnd); if (mpfr_compare (res1, ref1)) { fprintf (stderr, "Error for %s(a, b, a) for b=%u a=%e\n", foo, - ref2, mpfr_get_d (ref3)); - fprintf (stderr, "expected %e, got %e\n", mpfr_get_d (ref1), - mpfr_get_d (res1)); + ref2, mpfr_get_d1 (ref3)); + fprintf (stderr, "expected %e, got %e\n", mpfr_get_d1 (ref1), + mpfr_get_d1 (res1)); exit (1); } } @@ -437,9 +437,9 @@ test2 (char *foo, mp_prec_t prec, mp_rnd_t rnd) mpfr_set (res1, ref2, rnd); /* exact operation */ testfunc (res1, res1, rnd); if (mpfr_compare (res1, ref1)) { - fprintf (stderr, "Error for %s(a, a) for a=%e\n", foo, mpfr_get_d (ref2)); - fprintf (stderr, "expected %e, got %e\n", mpfr_get_d (ref1), - mpfr_get_d (res1)); + fprintf (stderr, "Error for %s(a, a) for a=%e\n", foo, mpfr_get_d1 (ref2)); + fprintf (stderr, "expected %e, got %e\n", mpfr_get_d1 (ref1), + mpfr_get_d1 (res1)); exit (1); } } @@ -480,9 +480,9 @@ test2a (char *foo, mp_prec_t prec) mpfr_set (res1, ref2, GMP_RNDN); /* exact operation */ testfunc (res1, res1); if (mpfr_compare (res1, ref1)) { - fprintf (stderr, "Error for %s(a, a) for a=%e\n", foo, mpfr_get_d (ref2)); - fprintf (stderr, "expected %e, got %e\n", mpfr_get_d (ref1), - mpfr_get_d (res1)); + fprintf (stderr, "Error for %s(a, a) for a=%e\n", foo, mpfr_get_d1 (ref2)); + fprintf (stderr, "expected %e, got %e\n", mpfr_get_d1 (ref1), + mpfr_get_d1 (res1)); exit (1); } } @@ -525,9 +525,9 @@ test3a (char *foo, mp_prec_t prec, mp_rnd_t rnd) mpfr_set (res1, ref3, rnd); /* exact operation */ testfunc (res1, res2, res1, rnd); if (mpfr_compare (res1, ref1) || mpfr_compare (res2, ref2)) { - fprintf (stderr, "Error for %s(a, b, a) for a=%e\n", foo, mpfr_get_d (ref3)); - fprintf (stderr, "expected (%e,%e), got (%e,%e)\n", mpfr_get_d (ref1), - mpfr_get_d (ref2), mpfr_get_d (res1), mpfr_get_d (res2)); + fprintf (stderr, "Error for %s(a, b, a) for a=%e\n", foo, mpfr_get_d1 (ref3)); + fprintf (stderr, "expected (%e,%e), got (%e,%e)\n", mpfr_get_d1 (ref1), + mpfr_get_d1 (ref2), mpfr_get_d1 (res1), mpfr_get_d1 (res2)); exit (1); } @@ -535,9 +535,9 @@ test3a (char *foo, mp_prec_t prec, mp_rnd_t rnd) mpfr_set (res2, ref3, rnd); /* exact operation */ testfunc (res1, res2, res2, rnd); if (mpfr_compare (res1, ref1) || mpfr_compare (res2, ref2)) { - fprintf (stderr, "Error for %s(a, b, b) for b=%e\n", foo, mpfr_get_d (ref3)); - fprintf (stderr, "expected (%e,%e), got (%e,%e)\n", mpfr_get_d (ref1), - mpfr_get_d (ref2), mpfr_get_d (res1), mpfr_get_d (res2)); + fprintf (stderr, "Error for %s(a, b, b) for b=%e\n", foo, mpfr_get_d1 (ref3)); + fprintf (stderr, "expected (%e,%e), got (%e,%e)\n", mpfr_get_d1 (ref1), + mpfr_get_d1 (ref2), mpfr_get_d1 (res1), mpfr_get_d1 (res2)); exit (1); } } diff --git a/tests/tabs.c b/tests/tabs.c index 9b92c49f6..308fca23b 100644 --- a/tests/tabs.c +++ b/tests/tabs.c @@ -93,13 +93,13 @@ main (int argc, char *argv[]) mpfr_set_d(x, 1.0, GMP_RNDN); mpfr_abs(x, x, GMP_RNDN); - if (mpfr_get_d(x) != 1.0) { + if (mpfr_get_d1 (x) != 1.0) { fprintf(stderr, "Error in mpfr_abs(1.0)\n"); exit(1); } mpfr_set_d(x, -1.0, GMP_RNDN); mpfr_abs(x, x, GMP_RNDN); - if (mpfr_get_d(x) != 1.0) { + if (mpfr_get_d1 (x) != 1.0) { fprintf(stderr, "Error in mpfr_abs(-1.0)\n"); exit(1); } @@ -135,7 +135,7 @@ main (int argc, char *argv[]) rnd = LONG_RAND() % 4; mpfr_set_d (x, d, 0); mpfr_abs (x, x, rnd); - dd = mpfr_get_d (x); + dd = mpfr_get_d1 (x); if (!isnan(d) && (dd != absd)) { fprintf(stderr, diff --git a/tests/tadd.c b/tests/tadd.c index eb1cb67ba..546483127 100644 --- a/tests/tadd.c +++ b/tests/tadd.c @@ -61,7 +61,7 @@ check (double x, double y, mp_rnd_t rnd_mode, unsigned int px, if (px==53 && py==53 && pz==53) cert=1; #endif if (z1==0.0) z1=x+y; else cert=1; - z2 = mpfr_get_d(zz); + z2 = mpfr_get_d1 (zz); mpfr_set_d (yy, z2, GMP_RNDN); if (!mpfr_cmp (zz, yy) && cert && z1!=z2 && !(isnan(z1) && isnan(z2))) { printf("expected sum is %1.20e, got %1.20e\n",z1,z2); @@ -88,7 +88,7 @@ checknan (double x, double y, mp_rnd_t rnd_mode, unsigned int px, mpfr_set_machine_rnd_mode(rnd_mode); #endif if (MPFR_IS_NAN(zz) == 0) { printf("Error, not an MPFR_NAN for xx = %1.20e, y = %1.20e\n", x, y); exit(1); } - z2 = mpfr_get_d(zz); + z2 = mpfr_get_d1 (zz); if (!isnan(z2)) { printf("Error, not a NaN after conversion, xx = %1.20e yy = %1.20e, got %1.20e\n", x, y, z2); exit(1); } mpfr_clear(xx); mpfr_clear(yy); mpfr_clear(zz); @@ -110,7 +110,7 @@ check3 (double x, double y, mp_rnd_t rnd_mode) else mpfr_add(xx, xx, yy, rnd_mode); mpfr_set_machine_rnd_mode(rnd_mode); z1 = (neg) ? x-y : x+y; - z2 = mpfr_get_d(xx); + z2 = mpfr_get_d1 (xx); mpfr_set_d (yy, z2, GMP_RNDN); if (!mpfr_cmp (xx, yy) && z1!=z2 && !(isnan(z1) && isnan(z2))) { printf("expected result is %1.20e, got %1.20e\n",z1,z2); @@ -138,7 +138,7 @@ check4 (double x, double y, mp_rnd_t rnd_mode) else mpfr_add(xx, yy, xx, rnd_mode); mpfr_set_machine_rnd_mode(rnd_mode); z1 = (neg) ? y-x : x+y; - z2 = mpfr_get_d(xx); + z2 = mpfr_get_d1 (xx); mpfr_set_d (yy, z2, GMP_RNDN); /* check that xx is representable as a double and no overflow occurred */ if ((mpfr_cmp (xx, yy) == 0) && (z1 != z2)) { @@ -164,7 +164,7 @@ check5 (double x, mp_rnd_t rnd_mode) else mpfr_add(xx, xx, xx, rnd_mode); mpfr_set_machine_rnd_mode(rnd_mode); z1 = (neg) ? x-x : x+x; - z2 = mpfr_get_d(xx); + z2 = mpfr_get_d1 (xx); mpfr_set_d (yy, z2, GMP_RNDN); /* check NaNs first since mpfr_cmp does not like them */ if (!(isnan(z1) && isnan(z2)) && !mpfr_cmp (xx, yy) && z1!=z2) @@ -188,7 +188,7 @@ check2 (double x, int px, double y, int py, int pz, mp_rnd_t rnd_mode) mpfr_set_d(yy, y, rnd_mode); mpfr_add(zz, xx, yy, rnd_mode); mpfr_set_machine_rnd_mode(rnd_mode); - z = x+y; z2=mpfr_get_d(zz); u=ulp(z,z2); + z = x+y; z2=mpfr_get_d1 (zz); u=ulp(z,z2); /* one ulp difference is possible due to composed rounding */ if (px>=53 && py>=53 && pz>=53 && ABS(u)>1) { printf("x=%1.20e,%d y=%1.20e,%d pz=%d,rnd=%s\n", @@ -300,7 +300,7 @@ check64 (void) mpfr_set_d (x, -5.03525136761487735093e-74, GMP_RNDN); mpfr_set_d (t, 8.51539046314262304109e-91, GMP_RNDN); mpfr_add (u, x, t, GMP_RNDN); - if (mpfr_get_d (u) != -5.0352513676148773509283672e-74) { + if (mpfr_get_d1 (u) != -5.0352513676148773509283672e-74) { fprintf (stderr, "mpfr_add(u, x, t) failed for prec(x)=92, prec(t)=86\n"); exit (1); } @@ -356,7 +356,7 @@ check64 (void) mpfr_set_str_raw(x, "0.10011010101000110101010000000011001001001110001011101011111011101E623"); mpfr_set_str_raw(t, "0.10011010101000110101010000000011001001001110001011101011111011100E623"); mpfr_sub(u, x, t, GMP_RNDU); - if (mpfr_get_d(u) != 9.4349060620538533806e167) { /* 2^558 */ + if (mpfr_get_d1 (u) != 9.4349060620538533806e167) { /* 2^558 */ printf("Error (1) in mpfr_sub\n"); exit(1); } @@ -438,7 +438,7 @@ check64 (void) mpfr_set_nan (x); mpfr_add (x, t, u, GMP_RNDN); if (mpfr_cmp_ui (x, 2)) { - fprintf (stderr, "Error in mpfr_add: 1+1 gives %e\n", mpfr_get_d (x)); + fprintf (stderr, "Error in mpfr_add: 1+1 gives %e\n", mpfr_get_d1 (x)); exit (1); } @@ -537,7 +537,7 @@ check_same (void) mpfr_init(x); mpfr_set_d(x, 1.0, GMP_RNDZ); mpfr_add(x, x, x, GMP_RNDZ); - if (mpfr_get_d(x) != 2.0) { + if (mpfr_get_d1 (x) != 2.0) { printf("Error when all 3 operands are equal\n"); exit(1); } mpfr_clear(x); diff --git a/tests/tadd_ui.c b/tests/tadd_ui.c index cd5127043..2321d2586 100644 --- a/tests/tadd_ui.c +++ b/tests/tadd_ui.c @@ -51,7 +51,7 @@ check3 (double x, unsigned long y, unsigned int rnd_mode, double z1) mpfr_set_machine_rnd_mode(rnd_mode); #endif if (z1==0.0) z1 = x+y; - z2 = mpfr_get_d(zz); + z2 = mpfr_get_d1 (zz); if (z1!=z2 && !(isnan(z1) && isnan(z2))) { printf("expected sum is %1.20e, got %1.20e\n",z1,z2); printf("mpfr_add_ui failed for x=%1.20e y=%lu with rnd_mode=%s\n", diff --git a/tests/tagm.c b/tests/tagm.c index 95a1cbffa..bacb15b4b 100644 --- a/tests/tagm.c +++ b/tests/tagm.c @@ -95,7 +95,7 @@ check4 (double a, double b, mp_rnd_t rnd_mode, double res1) if (res1==0.0) res1=dagm(a,b); else ck=1; if (ck==0) printf("%1.20e\n", res1); - res2 = mpfr_get_d(tres); + res2 = mpfr_get_d1 (tres); if (ck && res1!=res2 && (!isnan(res1) || !isnan(res2))) { printf("mpfr_agm failed for a=%1.20e, b=%1.20e, rnd_mode=%d\n",a,b,rnd_mode); diff --git a/tests/tasin.c b/tests/tasin.c index b0eb02376..469627653 100644 --- a/tests/tasin.c +++ b/tests/tasin.c @@ -46,7 +46,7 @@ main (void) if (mpfr_cmp (y, z)) { fprintf (stderr, "sin(-1) is wrong, expected %.20e, got %.20e\n", - mpfr_get_d (z), mpfr_get_d (y)); + mpfr_get_d1 (z), mpfr_get_d1 (y)); exit (1); } diff --git a/tests/tcmp_ui.c b/tests/tcmp_ui.c index 351337b42..ba0c565bd 100644 --- a/tests/tcmp_ui.c +++ b/tests/tcmp_ui.c @@ -34,41 +34,41 @@ main (void) mpfr_set_ui(x, 3, GMP_RNDZ); if (mpfr_cmp_ui(x, i=3)!=0) { - printf("Error in mpfr_cmp_ui(%1.20f,%lu)\n",mpfr_get_d(x), i); + printf("Error in mpfr_cmp_ui(%1.20f,%lu)\n",mpfr_get_d1 (x), i); mpfr_clear(x); exit(1); } if (mpfr_cmp_ui(x, i=2)<=0) { - printf("Error in mpfr_cmp_ui(%1.20f,%lu)\n",mpfr_get_d(x), i); + printf("Error in mpfr_cmp_ui(%1.20f,%lu)\n",mpfr_get_d1 (x), i); mpfr_clear(x); exit(1); } if (mpfr_cmp_ui(x, i=4)>=0) { - printf("Error in mpfr_cmp_ui(%1.20f,%lu)\n",mpfr_get_d(x), i); + printf("Error in mpfr_cmp_ui(%1.20f,%lu)\n",mpfr_get_d1 (x), i); mpfr_clear(x); exit(1); } mpfr_set_ui (x, 0, GMP_RNDZ); mpfr_neg (x, x, GMP_RNDZ); if (mpfr_cmp_ui (x, i=0)) { - printf("Error in mpfr_cmp_ui(%1.20f,%lu)\n",mpfr_get_d(x), i); + printf("Error in mpfr_cmp_ui(%1.20f,%lu)\n",mpfr_get_d1 (x), i); mpfr_clear(x); exit(1); } mpfr_set_si(x, -3, GMP_RNDZ); if (mpfr_cmp_si(x, s=-3)!=0) { - printf("Error in mpfr_cmp_si(%1.20f,%ld)\n",mpfr_get_d(x), s); + printf("Error in mpfr_cmp_si(%1.20f,%ld)\n",mpfr_get_d1 (x), s); mpfr_clear(x); exit(1); } if (mpfr_cmp_si(x, s=-4)<=0) { - printf("Error in mpfr_cmp_si(%1.20f,%ld)\n",mpfr_get_d(x), s); + printf("Error in mpfr_cmp_si(%1.20f,%ld)\n",mpfr_get_d1 (x), s); mpfr_clear(x); exit(1); } if (mpfr_cmp_si(x, s=1)>=0) { - printf("Error in mpfr_cmp_si(%1.20f,%ld)\n",mpfr_get_d(x), s); + printf("Error in mpfr_cmp_si(%1.20f,%ld)\n",mpfr_get_d1 (x), s); mpfr_clear(x); exit(1); } diff --git a/tests/tconst_log2.c b/tests/tconst_log2.c index b3579bdca..875ebceb3 100644 --- a/tests/tconst_log2.c +++ b/tests/tconst_log2.c @@ -86,10 +86,10 @@ main (int argc, char *argv[]) /* check precision of 2 bits */ mpfr_set_prec (x, 2); mpfr_const_log2 (x, GMP_RNDN); - if (mpfr_get_d (x) != 0.75) + if (mpfr_get_d1 (x) != 0.75) { fprintf (stderr, "mpfr_const_log2 failed for prec=2, rnd=GMP_RNDN\n"); - fprintf (stderr, "expected 0.75, got %f\n", mpfr_get_d (x)); + fprintf (stderr, "expected 0.75, got %f\n", mpfr_get_d1 (x)); exit (1); } @@ -104,7 +104,7 @@ main (int argc, char *argv[]) mpfr_set_prec (x, 53); mpfr_const_log2 (x, rnd); - if (mpfr_get_d(x) != 6.9314718055994530941e-1) + if (mpfr_get_d1 (x) != 6.9314718055994530941e-1) { fprintf (stderr, "mpfr_const_log2 failed for prec=53\n"); exit (1); diff --git a/tests/tconst_pi.c b/tests/tconst_pi.c index cdda57e47..d3f1d742e 100644 --- a/tests/tconst_pi.c +++ b/tests/tconst_pi.c @@ -38,7 +38,7 @@ main (int argc, char *argv[]) if (argc>=2) { printf("Pi="); mpfr_out_str(stdout, 10, 0, x, rnd); putchar('\n'); } - else if (mpfr_get_d(x) != 3.141592653589793116) { + else if (mpfr_get_d1 (x) != 3.141592653589793116) { fprintf(stderr, "mpfr_const_pi failed for prec=53\n"); exit(1); } mpfr_clear(x); diff --git a/tests/tcos.c b/tests/tcos.c index 2a45de1d9..60963a879 100644 --- a/tests/tcos.c +++ b/tests/tcos.c @@ -38,12 +38,12 @@ check53 (double x, double cos_x, mp_rnd_t rnd_mode) mpfr_init2 (c, 53); mpfr_set_d (xx, x, rnd_mode); /* should be exact */ mpfr_cos (c, xx, rnd_mode); - if (mpfr_get_d (c) != cos_x && (!isnan(cos_x) || !mpfr_nan_p(c))) + if (mpfr_get_d1 (c) != cos_x && (!isnan(cos_x) || !mpfr_nan_p(c))) { fprintf (stderr, "mpfr_cos failed for x=%1.20e, rnd=%s\n", x, mpfr_print_rnd_mode (rnd_mode)); fprintf (stderr, "mpfr_cos gives cos(x)=%1.20e, expected %1.20e\n", - mpfr_get_d (c), cos_x); + mpfr_get_d1 (c), cos_x); exit (1); } mpfr_clear (xx); diff --git a/tests/tdiv.c b/tests/tdiv.c index 499d4bc26..c07c2a3eb 100644 --- a/tests/tdiv.c +++ b/tests/tdiv.c @@ -51,7 +51,7 @@ check4 (double N, double D, mp_rnd_t rnd_mode, int p, double Q) mpfr_set_machine_rnd_mode(rnd_mode); #endif if (Q==0.0) Q = N/D; - Q2 = mpfr_get_d(q); + Q2 = mpfr_get_d1 (q); if (p==53 && Q!=Q2 && (!isnan(Q) || !isnan(Q2))) { printf("mpfr_div failed for n=%1.20e, d=%1.20e, rnd_mode=%s\n", N, D, mpfr_print_rnd_mode(rnd_mode)); @@ -71,7 +71,7 @@ check24 (float N, float D, mp_rnd_t rnd_mode, float Q) mpfr_set_d(n, N, rnd_mode); mpfr_set_d(d, D, rnd_mode); mpfr_div(q, n, d, rnd_mode); - Q2 = mpfr_get_d(q); + Q2 = mpfr_get_d1 (q); if (Q!=Q2) { printf("mpfr_div failed for n=%1.10e, d=%1.10e, prec=24, rnd_mode=%s\n", N, D, mpfr_print_rnd_mode(rnd_mode)); diff --git a/tests/tdiv_ui.c b/tests/tdiv_ui.c index b351a0153..addc350ab 100644 --- a/tests/tdiv_ui.c +++ b/tests/tdiv_ui.c @@ -43,7 +43,7 @@ check (double d, unsigned long u, mp_rnd_t rnd, double e) if (e==0.0) e = d / u; mpfr_set_d(x, d, rnd); mpfr_div_ui(y, x, u, rnd); - f = mpfr_get_d(y); + f = mpfr_get_d1 (y); if (f != e && (!isnan(f) || !isnan(e))) { printf("mpfr_div_ui failed for x=%1.20e, u=%lu, rnd=%s\n", d, u, mpfr_print_rnd_mode(rnd)); @@ -104,7 +104,7 @@ special (void) { mpfr_set_prec (y, yprec); mpfr_div_ui (y, x, 1, GMP_RNDN); - if (mpfr_get_d (x) != mpfr_get_d (y)) + if (mpfr_get_d1 (x) != mpfr_get_d1 (y)) { fprintf (stderr, "division by 1.0 fails for xprec=%u, yprec=%u\n", xprec, yprec); printf ("expected "); mpfr_print_binary (x); putchar ('\n'); @@ -206,7 +206,7 @@ main (int argc, char **argv) mpfr_set_ui(x, 3, GMP_RNDD); mpfr_log(x, x, GMP_RNDD); mpfr_div_ui(x, x, 5, GMP_RNDD); - if (mpfr_get_d(x) != 0.21972245773362189536) { + if (mpfr_get_d1 (x) != 0.21972245773362189536) { fprintf(stderr, "Error in mpfr_div_ui for x=ln(3), u=5\n"); exit(1); } mpfr_clear(x); diff --git a/tests/texp.c b/tests/texp.c index 74d552ea1..333ff1904 100644 --- a/tests/texp.c +++ b/tests/texp.c @@ -52,7 +52,7 @@ check3 (double d, mp_rnd_t rnd, double e) if (e==0.0) e = exp(d); else ck=1; /* really check */ mpfr_set_d(x, d, rnd); mpfr_exp(y, x, rnd); - f = mpfr_get_d(y); + f = mpfr_get_d1 (y); if (f != e && (!isnan(f) || !isnan(e))) { u = ulp(e, f); if (u<0) { @@ -103,7 +103,7 @@ check_large (double d, int n, mp_rnd_t rnd) mpfr_out_str(stdout, 10, 0, y, rnd); putchar('\n'); printf(" ="); mpfr_print_binary(y); putchar('\n'); - if (n==53) printf(" =%1.20e\n", mpfr_get_d(y)); + if (n==53) printf(" =%1.20e\n", mpfr_get_d1 (y)); mpfr_clear(x); mpfr_clear(y); return 0; @@ -118,7 +118,7 @@ check_worst_case (double X, double expx) mpfr_init2(x, 53); mpfr_init2(y, 53); mpfr_set_d(x, X, GMP_RNDN); mpfr_exp(y, x, GMP_RNDD); - if (mpfr_get_d(y) != expx) { + if (mpfr_get_d1 (y) != expx) { fprintf(stderr, "exp(x) rounded towards -infinity is wrong\n"); exit(1); } mpfr_exp(x, x, GMP_RNDN); diff --git a/tests/texp2.c b/tests/texp2.c index abc2723b2..a464d9dfe 100644 --- a/tests/texp2.c +++ b/tests/texp2.c @@ -43,7 +43,7 @@ main (int argc, char *argv[]) mpfr_set_prec (y, 53); mpfr_set_d (x, -1683977482443233.0 / 2199023255552.0, GMP_RNDN); mpfr_exp2 (y, x, GMP_RNDN); - if (mpfr_get_d (y) != 2.991959870867646566478e-231) + if (mpfr_get_d1 (y) != 2.991959870867646566478e-231) { fprintf (stderr, "Error for x=-1683977482443233/2^41\n"); exit (1); diff --git a/tests/tfma.c b/tests/tfma.c index d950a5dc3..f196b50ea 100644 --- a/tests/tfma.c +++ b/tests/tfma.c @@ -312,8 +312,8 @@ main (int argc, char *argv[]) fprintf (stderr, " z="); mpfr_out_str (stderr, 2, 0, z, GMP_RNDN); fprintf (stderr, " s="); mpfr_out_str (stderr, 2, 0, s, GMP_RNDN); fprintf (stderr, "\n"); - fprintf (stderr, "z=%1.20e s=%1.20e\n", mpfr_get_d (z), - mpfr_get_d (s)); + fprintf (stderr, "z=%1.20e s=%1.20e\n", mpfr_get_d1 (z), + mpfr_get_d1 (s)); exit (1); } } diff --git a/tests/tget_d.c b/tests/tget_d.c index a6df633a8..754fc74cb 100644 --- a/tests/tget_d.c +++ b/tests/tget_d.c @@ -44,7 +44,7 @@ check_denorms () mpfr_div_2exp (x, x, 1022, GMP_RNDN); /* 2^(-1022) */ for (n=0; n<52; n++, d /= 2.0) { - dd = mpfr_get_d (x); + dd = mpfr_get_d1 (x); if (d != dd) /* should be 0 or 2^(-1022-n) */ { fprintf (stderr, "Wrong result for 2^(%ld), ", -1022-n); @@ -110,8 +110,8 @@ main (void) d = si ? 0.5 - dd : 0.5 + dd; if ((LONG_RAND() / 1024) & 1) { - c = mpfr_get_d2 (y, rnd_mode); - f = "mpfr_get_d2"; + c = mpfr_get_d (y, rnd_mode); + f = "mpfr_get_d"; } else { diff --git a/tests/tlog.c b/tests/tlog.c index 7243777c6..3a0dcd1c4 100644 --- a/tests/tlog.c +++ b/tests/tlog.c @@ -75,7 +75,7 @@ check1 (double a, mp_rnd_t rnd_mode, double res1, int ck, int max_ulp) mpfr_init2(tres, 53); mpfr_set_d(ta, a, GMP_RNDN); mpfr_log(tres, ta, rnd_mode); - res2=mpfr_get_d(tres); + res2=mpfr_get_d1 (tres); mpfr_clear(ta); mpfr_clear(tres); if (res1!=res2 && (!isnan(res1) || !isnan(res2))) { @@ -247,7 +247,7 @@ special (void) mpfr_init2 (y, 53); mpfr_set_ui (x, 3, GMP_RNDD); mpfr_log (y, x, GMP_RNDD); - if (mpfr_get_d (y) != 1.09861228866810956) { + if (mpfr_get_d1 (y) != 1.09861228866810956) { fprintf (stderr, "Error in mpfr_log(3) for GMP_RNDD\n"); exit (1); } diff --git a/tests/tlog10.c b/tests/tlog10.c index da71bff89..4f64ba115 100644 --- a/tests/tlog10.c +++ b/tests/tlog10.c @@ -46,7 +46,7 @@ main (int argc, char *argv[]) { mpfr_mul_ui (x, x, 10, GMP_RNDN); /* x = 10^n */ mpfr_log10 (y, x, GMP_RNDN); - if (mpfr_get_d (y) != (double) n) + if (mpfr_get_d1 (y) != (double) n) { fprintf (stderr, "log10(10^n) <> n for n=%u\n", n); exit (1); diff --git a/tests/tmul.c b/tests/tmul.c index d61659168..7b572a7f5 100644 --- a/tests/tmul.c +++ b/tests/tmul.c @@ -56,7 +56,7 @@ check (double x, double y, mp_rnd_t rnd_mode, unsigned int px, mpfr_set_machine_rnd_mode(rnd_mode); #endif z1 = (res==0.0) ? x*y : res; - z2 = mpfr_get_d(zz); + z2 = mpfr_get_d1 (zz); if (z1!=z2 && (z1>=MINNORM || z1<=-MINNORM)) { printf("mpfr_mul "); if (res==0.0) printf("differs from libm.a"); else printf("failed"); @@ -79,7 +79,7 @@ check53 (double x, double y, mp_rnd_t rnd_mode, double z1) mpfr_set_d (xx, x, rnd_mode); mpfr_set_d (yy, y, rnd_mode); mpfr_mul (zz, xx, yy, rnd_mode); - z2 = mpfr_get_d (zz); + z2 = mpfr_get_d1 (zz); if (z1!=z2 && (!isnan(z1) || !isnan(z2))) { printf("mpfr_mul failed for x=%1.20e y=%1.20e with rnd_mode=%s\n", x, y, mpfr_print_rnd_mode(rnd_mode)); @@ -103,7 +103,7 @@ check24 (float x, float y, mp_rnd_t rnd_mode, float z1) mpfr_set_d (xx, x, rnd_mode); mpfr_set_d (yy, y, rnd_mode); mpfr_mul (zz, xx, yy, rnd_mode); - z2 = (float) mpfr_get_d (zz); + z2 = (float) mpfr_get_d1 (zz); if (z1 != z2) { fprintf (stderr, "mpfr_mul failed for x=%1.0f y=%1.0f with prec=24 and" @@ -176,8 +176,8 @@ check_sign (void) mpfr_set_d(a, -1.0, GMP_RNDN); mpfr_set_d(b, 2.0, GMP_RNDN); mpfr_mul(a, b, b, GMP_RNDN); - if (mpfr_get_d(a) != 4.0) { - fprintf(stderr,"2.0*2.0 gives %1.20e\n", mpfr_get_d(a)); exit(1); + if (mpfr_get_d1 (a) != 4.0) { + fprintf(stderr,"2.0*2.0 gives %1.20e\n", mpfr_get_d1 (a)); exit(1); } mpfr_clear(a); mpfr_clear(b); } diff --git a/tests/tmul_2exp.c b/tests/tmul_2exp.c index 827ec3fe3..c4e1ae1d2 100644 --- a/tests/tmul_2exp.c +++ b/tests/tmul_2exp.c @@ -50,7 +50,7 @@ main (int argc, char *argv[]) x = DBL_RAND (); mpfr_set_d (w, x, 0); mpfr_mul_2exp (w, w, 10, GMP_RNDZ); - if (x != (z = mpfr_get_d(w)/1024)) + if (x != (z = mpfr_get_d1 (w)/1024)) { fprintf(stderr, "%f != %f\n", x, z); return -1; @@ -58,7 +58,7 @@ main (int argc, char *argv[]) mpfr_set_d(w, x, 0); mpfr_div_2exp(w, w, 10, GMP_RNDZ); - if (x != (z = mpfr_get_d(w)*1024)) + if (x != (z = mpfr_get_d1 (w)*1024)) { fprintf(stderr, "%f != %f\n", x, z); mpfr_clear(w); diff --git a/tests/tmul_ui.c b/tests/tmul_ui.c index b7f93d414..298d25d28 100644 --- a/tests/tmul_ui.c +++ b/tests/tmul_ui.c @@ -136,7 +136,7 @@ main (int argc, char *argv[]) mpfr_set_d (x, 1.0/3.0, GMP_RNDZ); mpfr_mul_ui (x, x, 3, GMP_RNDU); - if (mpfr_get_d (x) != 1.0) + if (mpfr_get_d1 (x) != 1.0) { fprintf (stderr, "Error in mpfr_mul_ui: U(Z(1/3)*3) does not give 1\n"); exit (1); @@ -215,7 +215,7 @@ main (int argc, char *argv[]) { mpfr_set_prec (y, yprec); mpfr_mul_ui (y, x, 1, GMP_RNDN); - if (mpfr_get_d (x) != mpfr_get_d (y)) + if (mpfr_get_d1 (x) != mpfr_get_d1 (y)) { fprintf (stderr, "multiplication by 1.0 fails for xprec=%u, yprec=%u\n", xprec, yprec); printf ("expected "); mpfr_print_binary (x); putchar ('\n'); diff --git a/tests/trandom.c b/tests/trandom.c index bfcd6aaff..54df59acc 100644 --- a/tests/trandom.c +++ b/tests/trandom.c @@ -46,7 +46,7 @@ test_random (unsigned long nbtests, unsigned long prec, int verbose) for (k = 0; k < nbtests; k++) { mpfr_random(x); - d = mpfr_get_d(x); av += d; var += d*d; + d = mpfr_get_d1 (x); av += d; var += d*d; tab[(int)(size_tab * d)]++; } @@ -92,7 +92,7 @@ test_random2 (unsigned long nbtests, unsigned long prec, int verbose) for (k = 0; k < nbtests; k++) { mpfr_random2 (x, MPFR_ABSSIZE(x), 0); - d = mpfr_get_d(x); av += d; var += d*d; + d = mpfr_get_d1 (x); av += d; var += d*d; if (d < 1) tab[(int)(size_tab * d)]++; } @@ -139,7 +139,7 @@ test_urandomb (unsigned long nbtests, unsigned long prec, int verbose) for (k = 0; k < nbtests; k++) { mpfr_urandomb(x, state); - d = mpfr_get_d(x); av += d; var += d*d; + d = mpfr_get_d1 (x); av += d; var += d*d; tab[(int)(size_tab * d)]++; } diff --git a/tests/tround_prec.c b/tests/tround_prec.c index f46b83e38..419afa445 100644 --- a/tests/tround_prec.c +++ b/tests/tround_prec.c @@ -36,7 +36,7 @@ main (void) if (mpfr_cmp_ui(x, 4)) { fprintf (stderr, "Error in tround: got %1.1f instead of 4\n", - mpfr_get_d (x)); + mpfr_get_d1 (x)); exit (1); } @@ -47,7 +47,7 @@ main (void) if (mpfr_cmp_ui(x, 5)) { fprintf (stderr, "Error in tround: got %1.1f instead of 5\n", - mpfr_get_d (x)); + mpfr_get_d1 (x)); exit (1); } @@ -58,7 +58,7 @@ main (void) if (mpfr_cmp_si(x, -5)) { fprintf (stderr, "Error in tround: got %1.1f instead of -5\n", - mpfr_get_d (x)); + mpfr_get_d1 (x)); exit (1); } @@ -69,7 +69,7 @@ main (void) if (mpfr_cmp_ui(x, 5)) { fprintf (stderr, "Error in tround: got %1.1f instead of 5\n", - mpfr_get_d (x)); + mpfr_get_d1 (x)); exit (1); } diff --git a/tests/tset_d.c b/tests/tset_d.c index 1f1621064..dfaa4f4ef 100644 --- a/tests/tset_d.c +++ b/tests/tset_d.c @@ -58,50 +58,50 @@ 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); - if (mpfr_get_d (x) != 4.0) + if (mpfr_get_d1 (x) != 4.0) { fprintf (stderr, "Error in tset_d: got %g instead of 4.0\n", - mpfr_get_d (x)); + mpfr_get_d1 (x)); exit (1); } mpfr_set_d (x, -5.0, GMP_RNDN); - if (mpfr_get_d (x) != -4.0) + if (mpfr_get_d1 (x) != -4.0) { fprintf (stderr, "Error in tset_d: got %g instead of -4.0\n", - mpfr_get_d (x)); + mpfr_get_d1 (x)); exit (1); } mpfr_set_d (x, 9.84891017624509146344e-01, GMP_RNDU); - if (mpfr_get_d (x) != 1.0) + if (mpfr_get_d1 (x) != 1.0) { fprintf (stderr, "Error in tset_d: got %g instead of 1.0\n", - mpfr_get_d (x)); + mpfr_get_d1 (x)); exit (1); } mpfr_init2(z, 32); mpfr_set_d(z, 1.0, 0); - if (mpfr_get_d(z) != 1.0) { + if (mpfr_get_d1 (z) != 1.0) { mpfr_print_binary(z); putchar('\n'); printf("Error: 1.0 != 1.0\n"); exit(1); } mpfr_set_prec(x, 53); mpfr_init2(y, 53); mpfr_set_d(x, d=-1.08007920352320089721e+150, 0); - if (mpfr_get_d(x) != d) { + if (mpfr_get_d1 (x) != d) { mpfr_print_binary(x); putchar('\n'); printf("Error: get_d o set_d <> identity for d = %1.20e %1.20e\n",d, - mpfr_get_d(x)); exit(1); + mpfr_get_d1 (x)); exit(1); } SEED_RAND (time(NULL)); mpfr_set_d(x, 8.06294740693074521573e-310, 0); d = -6.72658901114033715233e-165; mpfr_set_d(x, d, 0); - if (d != mpfr_get_d(x)) { + if (d != mpfr_get_d1 (x)) { mpfr_print_binary(x); putchar('\n'); printf("Error: get_d o set_d <> identity for d = %1.20e %1.20e\n",d, - mpfr_get_d(x)); exit(1); + mpfr_get_d1 (x)); exit(1); } n = (argc==1) ? 1000000 : atoi(argv[1]); for (k = 1; k <= n; k++) @@ -116,11 +116,11 @@ main (int argc, char *argv[]) while (ABS(d) <= 2.2e-307); #endif mpfr_set_d (x, d, 0); - dd = mpfr_get_d (x); + dd = mpfr_get_d1 (x); if (d != dd && (!isnan(d) || !isnan(dd))) { fprintf(stderr, - "Mismatch on : %1.18g != %1.18g\n", d, mpfr_get_d(x)); + "Mismatch on : %1.18g != %1.18g\n", d, mpfr_get_d1 (x)); mpfr_print_binary(x); putchar('\n'); exit(1); } diff --git a/tests/tset_q.c b/tests/tset_q.c index 26c876916..57497843f 100644 --- a/tests/tset_q.c +++ b/tests/tset_q.c @@ -45,7 +45,7 @@ check (long int n, long int d, mp_rnd_t rnd, double y) y = (double) n / d; #endif inexact = mpfr_set_q (x, q, rnd); - z = mpfr_get_d (x); + z = mpfr_get_d1 (x); /* check values */ if (y != z) diff --git a/tests/tset_si.c b/tests/tset_si.c index 53efbf4f5..afe00ec79 100644 --- a/tests/tset_si.c +++ b/tests/tset_si.c @@ -45,7 +45,7 @@ main (int argc, char *argv[]) { z = random() - (1 << 30); inex = mpfr_set_si(x, z, GMP_RNDZ); - d = (long) mpfr_get_d(x); + d = (long) mpfr_get_d1 (x); if (d != z) { fprintf(stderr, "Error in mpfr_set_si: expected %ld got %ld\n", z, d); exit(1); } @@ -62,7 +62,7 @@ main (int argc, char *argv[]) { zl = random(); inex = mpfr_set_ui (x, zl, GMP_RNDZ); - dl = (unsigned long) mpfr_get_d (x); + dl = (unsigned long) mpfr_get_d1 (x); if (dl != zl) { fprintf(stderr, "Error in mpfr_set_ui: expected %lu got %lu\n", zl, dl); exit(1); } @@ -109,17 +109,17 @@ main (int argc, char *argv[]) mpfr_set_prec(x, 2); inex = mpfr_set_si(x, 33096, GMP_RNDU); - if (mpfr_get_d(x) != 49152.0 || inex <= 0) + if (mpfr_get_d1 (x) != 49152.0 || inex <= 0) { fprintf(stderr, "Error in mpfr_set_si, expected 49152, got %lu, inex %d\n", - (unsigned long) mpfr_get_d(x), inex); + (unsigned long) mpfr_get_d1 (x), inex); exit(1); } inex = mpfr_set_ui(x, 33096, GMP_RNDU); - if (mpfr_get_d(x) != 49152.0) + if (mpfr_get_d1 (x) != 49152.0) { fprintf(stderr, "Error in mpfr_set_ui, expected 49152, got %lu, inex %d\n", - (unsigned long) mpfr_get_d(x), inex); + (unsigned long) mpfr_get_d1 (x), inex); exit(1); } diff --git a/tests/tset_str.c b/tests/tset_str.c index 4ad9bb1ba..75c595a34 100644 --- a/tests/tset_str.c +++ b/tests/tset_str.c @@ -99,7 +99,7 @@ main (int argc, char *argv[]) mpfr_set_str_raw (x, "+110101100.01010000101101000000100111001000101011101110E00"); mpfr_set_str_raw (x, "1.0"); - if (mpfr_get_d (x) != 1.0) + if (mpfr_get_d1 (x) != 1.0) { fprintf (stderr, "Error in mpfr_set_str_raw for s=1.0\n"); mpfr_clear(x); @@ -110,7 +110,7 @@ main (int argc, char *argv[]) mpfr_set_str_raw (x, "+0000"); mpfr_set_str_raw (x, "+0000E0"); mpfr_set_str_raw (x, "0000E0"); - if (mpfr_get_d (x) != 0.0) + if (mpfr_get_d1 (x) != 0.0) { fprintf (stderr, "Error in mpfr_set_str_raw for s=0.0\n"); mpfr_clear (x); diff --git a/tests/tset_z.c b/tests/tset_z.c index c627b8bcc..7c8309034 100644 --- a/tests/tset_z.c +++ b/tests/tset_z.c @@ -37,7 +37,7 @@ check(long i, unsigned char rnd) mpfr_init2(f, 53); mpz_init(z); mpz_set_ui(z, i); mpfr_set_z(f, z, rnd); - if ((long)mpfr_get_d(f) != i) { + if ((long)mpfr_get_d1 (f) != i) { printf("Error in mpfr_set_z for i=%ld rnd_mode=%d\n",i,rnd); exit(1); } diff --git a/tests/tsin.c b/tests/tsin.c index 9d5eb1bc2..e199bd638 100644 --- a/tests/tsin.c +++ b/tests/tsin.c @@ -38,12 +38,12 @@ check53 (double x, double sin_x, mp_rnd_t rnd_mode) mpfr_init2 (s, 53); mpfr_set_d (xx, x, rnd_mode); /* should be exact */ mpfr_sin (s, xx, rnd_mode); - if (mpfr_get_d (s) != sin_x && (!isnan(sin_x) || !mpfr_nan_p(s))) + if (mpfr_get_d1 (s) != sin_x && (!isnan(sin_x) || !mpfr_nan_p(s))) { fprintf (stderr, "mpfr_sin failed for x=%1.20e, rnd=%s\n", x, mpfr_print_rnd_mode (rnd_mode)); fprintf (stderr, "mpfr_sin gives sin(x)=%1.20e, expected %1.20e\n", - mpfr_get_d (s), sin_x); + mpfr_get_d1 (s), sin_x); exit(1); } mpfr_clear (xx); @@ -79,7 +79,7 @@ main (int argc, char *argv[]) mpfr_set_d (x, 0.5, GMP_RNDN); mpfr_sin (x, x, GMP_RNDD); - if (mpfr_get_d(x) != 0.375) + if (mpfr_get_d1 (x) != 0.375) { fprintf (stderr, "mpfr_sin(0.5, GMP_RNDD) failed with precision=2\n"); exit (1); diff --git a/tests/tsin_cos.c b/tests/tsin_cos.c index a447bb92c..01b7c4332 100644 --- a/tests/tsin_cos.c +++ b/tests/tsin_cos.c @@ -56,18 +56,18 @@ void check53 (double x, double sin_x, double cos_x, mp_rnd_t rnd_mode) mpfr_init2 (c, 53); mpfr_set_d (xx, x, rnd_mode); /* should be exact */ mpfr_sin_cos (s, c, xx, rnd_mode); - if (mpfr_get_d (s) != sin_x && (!isnan(sin_x) || !mpfr_nan_p(s))) { + if (mpfr_get_d1 (s) != sin_x && (!isnan(sin_x) || !mpfr_nan_p(s))) { fprintf (stderr, "mpfr_sin_cos failed for x=%1.20e, rnd=%s\n", x, mpfr_print_rnd_mode (rnd_mode)); fprintf (stderr, "mpfr_sin_cos gives sin(x)=%1.20e, expected %1.20e\n", - mpfr_get_d (s), sin_x); + mpfr_get_d1 (s), sin_x); exit(1); } - if (mpfr_get_d (c) != cos_x && (!isnan(cos_x) || !mpfr_nan_p(c))) { + if (mpfr_get_d1 (c) != cos_x && (!isnan(cos_x) || !mpfr_nan_p(c))) { fprintf (stderr, "mpfr_sin_cos failed for x=%1.20e, rnd=%s\n", x, mpfr_print_rnd_mode (rnd_mode)); fprintf (stderr, "mpfr_sin_cos gives cos(x)=%1.20e, expected %1.20e\n", - mpfr_get_d (c), cos_x); + mpfr_get_d1 (c), cos_x); exit(1); } mpfr_clear (xx); @@ -83,11 +83,11 @@ void check53sin (double x, double sin_x, mp_rnd_t rnd_mode) mpfr_init2 (s, 53); mpfr_set_d (xx, x, rnd_mode); /* should be exact */ mpfr_sin_cos (s, NULL, xx, rnd_mode); - if (mpfr_get_d (s) != sin_x && (!isnan(sin_x) || !mpfr_nan_p(s))) { + if (mpfr_get_d1 (s) != sin_x && (!isnan(sin_x) || !mpfr_nan_p(s))) { fprintf (stderr, "mpfr_sin_cos failed for x=%1.20e, rnd=%s\n", x, mpfr_print_rnd_mode (rnd_mode)); fprintf (stderr, "mpfr_sin_cos gives sin(x)=%1.20e, expected %1.20e\n", - mpfr_get_d (s), sin_x); + mpfr_get_d1 (s), sin_x); exit(1); } mpfr_clear (xx); @@ -102,11 +102,11 @@ void check53cos (double x, double cos_x, mp_rnd_t rnd_mode) mpfr_init2 (c, 53); mpfr_set_d (xx, x, rnd_mode); /* should be exact */ mpfr_sin_cos (NULL, c, xx, rnd_mode); - if (mpfr_get_d (c) != cos_x && (!isnan(cos_x) || !mpfr_nan_p(c))) { + if (mpfr_get_d1 (c) != cos_x && (!isnan(cos_x) || !mpfr_nan_p(c))) { fprintf (stderr, "mpfr_sin_cos failed for x=%1.20e, rnd=%s\n", x, mpfr_print_rnd_mode (rnd_mode)); fprintf (stderr, "mpfr_sin_cos gives cos(x)=%1.20e, expected %1.20e\n", - mpfr_get_d (c), cos_x); + mpfr_get_d1 (c), cos_x); exit(1); } mpfr_clear (xx); diff --git a/tests/tsqrt.c b/tests/tsqrt.c index f657acfa9..bf6f1f5e5 100644 --- a/tests/tsqrt.c +++ b/tests/tsqrt.c @@ -62,7 +62,7 @@ check3 (double a, mp_rnd_t rnd_mode, double Q) } } - Q2 = mpfr_get_d(q); + Q2 = mpfr_get_d1 (q); if (Q!=Q2 && (!isnan(Q) || !isnan(Q2))) { u = ulp(Q2,Q); if (ck) { @@ -111,7 +111,7 @@ check24 (float a, mp_rnd_t rnd_mode, float Q) mpfr_init2(q, 24); mpfr_set_d(q, a, rnd_mode); mpfr_sqrt(q, q, rnd_mode); - Q2 = mpfr_get_d(q); + Q2 = mpfr_get_d1 (q); if (Q!=Q2) { printf("mpfr_sqrt failed for a=%1.10e, prec=24, rnd_mode=%s\n", a, mpfr_print_rnd_mode(rnd_mode)); @@ -198,7 +198,7 @@ special (void) mpfr_set_ui (z, 1, GMP_RNDN); mpfr_add_one_ulp (z, GMP_RNDN); mpfr_sqrt (x, z, GMP_RNDU); - if (mpfr_get_d (x) != 1.5) + if (mpfr_get_d1 (x) != 1.5) { fprintf (stderr, "Error: sqrt(1+ulp(1), up) should give 1.5 (prec=%u)\n", (unsigned) p); printf ("got "); mpfr_print_binary (x); putchar ('\n'); @@ -224,7 +224,7 @@ special (void) mpfr_sqrt (z, x, GMP_RNDN); if (mpfr_cmp_ui (z, 0) < 0) { fprintf (stderr, "Error: square root of %e gives %e\n", - mpfr_get_d (x), mpfr_get_d (z)); + mpfr_get_d1 (x), mpfr_get_d1 (z)); exit (1); } diff --git a/tests/tsqrt_ui.c b/tests/tsqrt_ui.c index 81b1733f6..f3c7efabf 100644 --- a/tests/tsqrt_ui.c +++ b/tests/tsqrt_ui.c @@ -43,7 +43,7 @@ check (unsigned long a, mp_rnd_t rnd_mode, double Q) mpfr_sqrt_ui(q, a, rnd_mode); ck = (Q >= 0.0); if (!ck) Q = sqrt(1.0 * a); - Q2 = mpfr_get_d(q); + Q2 = mpfr_get_d1 (q); if (Q!=Q2 && (!isnan(Q) || !isnan(Q2))) { u = ulp(Q2,Q); if (ck) printf("mpfr_sqrt_ui failed"); diff --git a/tests/tsub.c b/tests/tsub.c index 1569ab245..785dea183 100644 --- a/tests/tsub.c +++ b/tests/tsub.c @@ -169,7 +169,7 @@ check_diverse (void) /* check in-place operations */ mpfr_set_d (x, 1.0, GMP_RNDN); mpfr_sub (x, x, x, GMP_RNDN); - if (mpfr_get_d (x) != 0.0) + if (mpfr_get_d1 (x) != 0.0) { fprintf (stderr, "Error for mpfr_add (x, x, x, GMP_RNDN) with x=1.0\n"); exit (1); @@ -182,7 +182,7 @@ check_diverse (void) mpfr_set_d (y, 2.32221184180698677665e+05, GMP_RNDN); mpfr_sub (z, x, y, GMP_RNDN); res = 1229085880.815819263458251953125; - got = mpfr_get_d (z); + got = mpfr_get_d1 (z); if (got != res) { fprintf (stderr, "Error in mpfr_sub (1.22e9 - 2.32e5)\n"); diff --git a/tests/tsub_ui.c b/tests/tsub_ui.c index fea903c50..eccc97dc4 100644 --- a/tests/tsub_ui.c +++ b/tests/tsub_ui.c @@ -51,7 +51,7 @@ check3 (double x, unsigned long y, mp_rnd_t rnd_mode, double z1) mpfr_set_machine_rnd_mode(rnd_mode); #endif if (z1==0.0) z1 = x-y; - z2 = mpfr_get_d(zz); + z2 = mpfr_get_d1 (zz); if (z1!=z2 && !(isnan(z1) && isnan(z2))) { printf("expected sum is %1.20e, got %1.20e\n",z1,z2); printf("mpfr_sub_ui failed for x=%1.20e y=%lu with rnd_mode=%s\n", diff --git a/tests/tswap.c b/tests/tswap.c index 06e51318b..4088d8851 100644 --- a/tests/tswap.c +++ b/tests/tswap.c @@ -35,7 +35,7 @@ main (void) mpfr_set_d (v, 9007199254740991.0, GMP_RNDN); /* 2^53 - 1 */ mpfr_swap (u, v); mpfr_swap (u, v); - if (mpfr_cmp_ui (u, 16777215) || (mpfr_get_d (v) != 9007199254740991.0)) { + if (mpfr_cmp_ui (u, 16777215) || (mpfr_get_d1 (v) != 9007199254740991.0)) { fprintf (stderr, "Error in mpfr_swap\n"); exit (1); } diff --git a/tests/ttan.c b/tests/ttan.c index da9b7c727..627bc6201 100644 --- a/tests/ttan.c +++ b/tests/ttan.c @@ -38,11 +38,11 @@ check53 (double x, double tan_x, mp_rnd_t rnd_mode) mpfr_init2 (s, 53); mpfr_set_d (xx, x, rnd_mode); /* should be exact */ mpfr_tan (s, xx, rnd_mode); - if (mpfr_get_d (s) != tan_x && (!isnan(tan_x) || !mpfr_nan_p(s))) { + if (mpfr_get_d1 (s) != tan_x && (!isnan(tan_x) || !mpfr_nan_p(s))) { fprintf (stderr, "mpfr_tan failed for x=%1.20e, rnd=%s\n", x, mpfr_print_rnd_mode (rnd_mode)); fprintf (stderr, "mpfr_tan gives tan(x)=%1.20e, expected %1.20e\n", - mpfr_get_d (s), tan_x); + mpfr_get_d1 (s), tan_x); exit(1); } mpfr_clear (xx); @@ -71,10 +71,10 @@ main(int argc, char *argv[]) mpfr_set_prec (x, 2); mpfr_set_d (x, 0.5, GMP_RNDN); mpfr_tan (x, x, GMP_RNDD); - if (mpfr_get_d (x) != 0.5) + if (mpfr_get_d1 (x) != 0.5) { fprintf (stderr, "mpfr_tan(0.5, GMP_RNDD) failed\n"); - fprintf (stderr, "expected 0.5, got %f\n", mpfr_get_d (x)); + fprintf (stderr, "expected 0.5, got %f\n", mpfr_get_d1 (x)); exit (1); } diff --git a/tests/ttrunc.c b/tests/ttrunc.c index fa4ffb94f..c829964fe 100644 --- a/tests/ttrunc.c +++ b/tests/ttrunc.c @@ -42,23 +42,23 @@ main (void) mpfr_set_d(x, 0.5, GMP_RNDN); mpfr_ceil(y, x); - if (mpfr_get_d(y) != 1.0) { + if (mpfr_get_d1 (y) != 1.0) { fprintf(stderr, "Error in mpfr_ceil for x=0.5: expected 1.0, got %f\n", - mpfr_get_d(y)); exit(1); + mpfr_get_d1 (y)); exit(1); } mpfr_set_d(x, 0.0, GMP_RNDN); mpfr_ceil(y, x); - if (mpfr_get_d(y) != 0.0) { + if (mpfr_get_d1 (y) != 0.0) { fprintf(stderr, "Error in mpfr_ceil for x=0.0: expected 0.0, got %f\n", - mpfr_get_d(y)); exit(1); + mpfr_get_d1 (y)); exit(1); } mpfr_set_d(x, 1.0, GMP_RNDN); mpfr_ceil(y, x); - if (mpfr_get_d(y) != 1.0) { + if (mpfr_get_d1 (y) != 1.0) { fprintf(stderr, "Error in mpfr_ceil for x=1.0: expected 1.0, got %f\n", - mpfr_get_d(y)); exit(1); + mpfr_get_d1 (y)); exit(1); } for (j=0;j<1000;j++) { diff --git a/tests/tui_div.c b/tests/tui_div.c index 74f8127d0..770faed5b 100644 --- a/tests/tui_div.c +++ b/tests/tui_div.c @@ -48,7 +48,7 @@ check (unsigned long y, double x, mp_rnd_t rnd_mode, double z1) mpfr_set_machine_rnd_mode(rnd_mode); #endif if (z1==0.0) z1 = y/x; - z2 = mpfr_get_d(zz); + z2 = mpfr_get_d1 (zz); if (z1!=z2 && !(isnan(z1) && isnan(z2))) { printf("expected quotient is %1.20e, got %1.20e\n",z1,z2); printf("mpfr_ui_div failed for y=%lu x=%1.20e with rnd_mode=%s\n", diff --git a/tests/tui_sub.c b/tests/tui_sub.c index f73eccbe1..2d34dc56d 100644 --- a/tests/tui_sub.c +++ b/tests/tui_sub.c @@ -144,7 +144,7 @@ check (unsigned long y, double x, mp_rnd_t rnd_mode, double z1) mpfr_set_machine_rnd_mode(rnd_mode); #endif if (z1==0.0) z1 = y-x; - z2 = mpfr_get_d(zz); + z2 = mpfr_get_d1 (zz); if (z1!=z2 && !(isnan(z1) && isnan(z2))) { printf("expected difference is %1.20e, got %1.20e\n",z1,z2); printf("mpfr_ui_sub failed for y=%lu x=%1.20e with rnd_mode=%s\n", diff --git a/tests/tzeta.c b/tests/tzeta.c index f8f4ef39d..9aac21bf4 100644 --- a/tests/tzeta.c +++ b/tests/tzeta.c @@ -46,7 +46,7 @@ main(void) mpfr_print_binary(result);printf("\n"); t=mpfr_out_str(stdout,10,0,result,GMP_RNDN);printf("\n"); #endif - if (mpfr_get_d(result) != 1.64493406684822640607e+00) { + if (mpfr_get_d1 (result) != 1.64493406684822640607e+00) { fprintf(stderr, "mpfr_zeta fails for s=2 and rnd_mode=GMP_RNDN\n"); exit(1); } @@ -43,7 +43,7 @@ mpfr_zeta (result, op, rnd_mode) and clear NaN/Inf flags of result */ /* first version */ - if (mpfr_get_d(op) != 2.0 || rnd_mode != GMP_RNDN + if (mpfr_get_d1 (op) != 2.0 || rnd_mode != GMP_RNDN || MPFR_PREC(result) != 53) { fprintf(stderr, "not yet implemented\n"); exit(1); } |