diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Makefile.am | 9 | ||||
-rw-r--r-- | tests/atan.dat | 10 | ||||
-rw-r--r-- | tests/div.dat | 8 | ||||
-rw-r--r-- | tests/log.dat | 31 | ||||
-rw-r--r-- | tests/mpc-tests.h | 9 | ||||
-rwxr-xr-x | tests/mul.dat | 5 | ||||
-rw-r--r-- | tests/pow.dat | 13 | ||||
-rw-r--r-- | tests/random.c | 10 | ||||
-rw-r--r-- | tests/read_data.c | 64 | ||||
-rw-r--r-- | tests/sqrt.dat | 1 | ||||
-rw-r--r-- | tests/tadd.c | 4 | ||||
-rw-r--r-- | tests/tadd_fr.c | 6 | ||||
-rw-r--r-- | tests/tadd_si.c | 4 | ||||
-rw-r--r-- | tests/tadd_ui.c | 4 | ||||
-rw-r--r-- | tests/tan.dat | 1 | ||||
-rw-r--r-- | tests/tatan.c | 8 | ||||
-rw-r--r-- | tests/tcos.c | 10 | ||||
-rw-r--r-- | tests/tcosh.c | 10 | ||||
-rw-r--r-- | tests/tdiv_2si.c (renamed from tests/tdiv_2exp.c) | 6 | ||||
-rw-r--r-- | tests/tdiv_2ui.c | 35 | ||||
-rw-r--r-- | tests/tfma.c | 4 | ||||
-rw-r--r-- | tests/tgeneric.c | 124 | ||||
-rw-r--r-- | tests/tmul.c | 22 | ||||
-rw-r--r-- | tests/tmul_2si.c (renamed from tests/tmul_2exp.c) | 6 | ||||
-rw-r--r-- | tests/tmul_2ui.c | 35 | ||||
-rw-r--r-- | tests/tmul_i.c | 10 | ||||
-rw-r--r-- | tests/tnorm.c | 18 | ||||
-rw-r--r-- | tests/tpow.c | 6 | ||||
-rw-r--r-- | tests/tpow_fr.c | 8 | ||||
-rw-r--r-- | tests/tpow_ui.c | 8 | ||||
-rw-r--r-- | tests/treimref.c | 10 | ||||
-rw-r--r-- | tests/tset.c | 28 | ||||
-rw-r--r-- | tests/tsqr.c | 8 | ||||
-rw-r--r-- | tests/ttan.c | 46 | ||||
-rw-r--r-- | tests/tui_div.c | 6 |
35 files changed, 356 insertions, 231 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am index ac572f6..6369c84 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,6 +1,6 @@ ## tests/Makefile.am -- Process this file with automake to produce Makefile.in ## -## Copyright (C) 2008, 2009, 2010, 2011 INRIA +## Copyright (C) 2008, 2009, 2010, 2011, 2012 INRIA ## ## This file is part of GNU MPC. ## @@ -28,9 +28,10 @@ AM_LDFLAGS = -no-install LOADLIBES=$(DEFS) -I$(top_srcdir)/src -I$(top_builddir) $(CPPFLAGS) $(CFLAGS) -L$(top_builddir)/tests/.libs -lmpc-tests -lmpc -lm $(LIBS) check_PROGRAMS = tabs tacos tacosh tadd tadd_fr tadd_si tadd_ui targ tasin \ -tasinh tatan tatanh tconj tcos tcosh tdiv tdiv_2exp tdiv_fr tdiv_ui texp tfma \ -tfr_div tfr_sub timag tio_str tlog tlog10 tmul tmul_2exp tmul_fr tmul_i \ -tmul_si tmul_ui tneg tnorm tpow tpow_ld tpow_d tpow_fr tpow_si tpow_ui tpow_z \ +tasinh tatan tatanh tconj tcos tcosh tdiv tdiv_2si tdiv_2ui tdiv_fr tdiv_ui \ +texp tfma tfr_div tfr_sub timag tio_str tlog tlog10 \ +tmul tmul_2si tmul_2ui tmul_fr tmul_i tmul_si tmul_ui \ +tneg tnorm tpow tpow_ld tpow_d tpow_fr tpow_si tpow_ui tpow_z \ tprec tproj treal treimref trootofunity tset tsin tsin_cos tsinh tsqr tsqrt \ tstrtoc tsub \ tsub_fr tsub_ui tswap ttan ttanh tui_div tui_ui_sub tget_version diff --git a/tests/atan.dat b/tests/atan.dat index ddb4d43..f3ba3ec 100644 --- a/tests/atan.dat +++ b/tests/atan.dat @@ -1,6 +1,6 @@ # Data file for mpc_atan. # -# Copyright (C) 2009 INRIA +# Copyright (C) 2009, 2012 INRIA # # This file is part of GNU MPC. # @@ -137,6 +137,14 @@ # general inputs + - 72 0x91EA521228BFC46ACAp-118 72 -0x9E96A01DBAD6470974p-73 72 0x84C3E02A5C6DEE8410p-118 72 -0x99B43C52A95A21C220p-73 U N +- - 72 0x91EA521228BFC46AC9p-118 72 -0x9E96A01DBAD6470974p-73 72 0x84C3E02A5C6DEE8410p-118 72 -0x99B43C52A95A21C220p-73 D D +- + 72 0x91EA521228BFC46AC9p-118 72 -0x9E96A01DBAD6470973p-73 72 0x84C3E02A5C6DEE8410p-118 72 -0x99B43C52A95A21C220p-73 D U ++ + 72 0x91EA521228BFC46ACAp-118 72 0x9E96A01DBAD6470974p-73 72 0x84C3E02A5C6DEE8410p-118 72 0x99B43C52A95A21C220p-73 U N +- + 72 0x91EA521228BFC46AC9p-118 72 0x9E96A01DBAD6470974p-73 72 0x84C3E02A5C6DEE8410p-118 72 0x99B43C52A95A21C220p-73 D U +- - 72 0x91EA521228BFC46AC9p-118 72 0x9E96A01DBAD6470973p-73 72 0x84C3E02A5C6DEE8410p-118 72 0x99B43C52A95A21C220p-73 D D + - 156 -0xC90FDAA22167B20DB08A0C3B1FF415CABE49624p-155 156 0xEA84E971BD52E49CCEE036E303D5ECB2D9D9B9Ap-222 156 -0xF0CE58073F866A53F25DB85DE8D503FBDD81051p-109 156 0xCF81D7C76BB9754A52056CB0F144B0C6700CC8Cp-128 N N - - 2 0.75 2 -3 2 0x1p-7 2 -1 N N - + 2 0.75 2 3 2 0x1p-7 2 1 N N + +# improve test coverage ++ - 57 -0x1.921fb54442d184 57 -0x8.a7e33db93ecf18@-34 57 -0xa.529626a89a1960@23 57 -0x3.9a5472b5709e74@14 N N diff --git a/tests/div.dat b/tests/div.dat index 2cffc7e..6f5e600 100644 --- a/tests/div.dat +++ b/tests/div.dat @@ -1,6 +1,6 @@ # Data file for mpc_div. # -# Copyright (C) 2008, 2009, 2010, 2011 INRIA +# Copyright (C) 2008, 2009, 2010, 2011, 2012 INRIA # # This file is part of GNU MPC. # @@ -2478,3 +2478,9 @@ 0 + 2 0 2 inf 10 0x3ffp1073741813 10 0x3ffp1073741813 10 0x2abp-10 10 -0x2abp-10 N N # negative overflow 0 - 2 0 2 -inf 10 -0x3ffp1073741813 10 -0x3ffp1073741813 10 0x2abp-10 10 -0x2abp-10 N N + +# examples to exercise underflow +# (1.5+i)*2^emin/(1-i) gives (0.25 + 1.25*i)*2^emin +- - 2 0 2 0x1p-1073741823 2 0x3p-1073741824 2 0x1p-1073741823 2 1 2 -1 Z Z +# (1.5+i)*2^emin/(1+i) gives (1.25 - 0.25*i)*2^emin +- + 2 0x1p-1073741823 2 -0 2 0x3p-1073741824 2 0x1p-1073741823 2 1 2 1 Z Z diff --git a/tests/log.dat b/tests/log.dat index 57e3b35..ee95025 100644 --- a/tests/log.dat +++ b/tests/log.dat @@ -1,13 +1,13 @@ # Data test file for mpc_log. # -# Copyright (C) 2008, 2009, 2010 INRIA +# Copyright (C) 2008, 2009, 2010, 2012 INRIA # # This file is part of GNU MPC. # # GNU MPC is free software; you can redistribute it and/or modify it under # the terms of the GNU Lesser General Public License as published by the # Free Software Foundation; either version 3 of the License, or (at your -#o ption) any later version. +# option) any later version. # # GNU MPC is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS @@ -166,10 +166,25 @@ + + 53 0x162E4301C0025p-23 2 0x1p0 2 0x1p67108864 2 0x1p67108864 U U + + 53 0xB1721802E8F1p-21 2 0x1p0 2 0x1p134217728 2 0x1p134217728 U U + + 53 0x2C5C85FF57581p-22 2 0x1p0 2 0x1p268435456 2 0x1p268435456 U U -# Due to intermediate overflow, the following result has real part infinity -# instead of the correct result. Since this may happen in other parts of the -# library as well, we do not consider it a bug for the moment. -# + + 53 0x58B90BFD4BCBFp-22 2 0x1p0 2 0x1p536870912 2 0x1p536870912 U U -# log(-1 + i*eps) : infinite loop ? -# 0 0 2 0 2 0b11 2 -1 2 0x1p-1073741813 N N +# Example leading to intermediate overflow in x^2+y^2 ++ + 53 0x58B90BFD4BCBFp-22 2 0x1p0 2 0x1p536870912 2 0x1p536870912 U U ++ + 53 0x58B90BFAA42A98p-25 2 0x1p0 2 0x3p1073741821 2 0x3p1073741821 U U +# Example leading to intermediate underflow in x^2+y^2 +- - 53 -0x58B90BFB3775A8p-25 2 0x3p-2 2 0x1p-1073741824 2 0x1p-1073741824 D D + +# log (-1 + i*eps), looped in previous version +- - 2 0 2 3 2 -1 2 0x1p-1073741813 N N +- - 2 0 2 3 2 -1 2 0x1p-1073741813 D D ++ + 2 0x1p-1073741824 2 4 2 -1 2 0x1p-1073741813 U U +# log(1 + i*eps), could cause similar problems +- + 2 0 2 0x1p-1073741824 2 1 2 0x1p-1073741824 N N +- - 2 0 2 0 2 1 2 0x1p-1073741824 D D ++ + 2 0x1p-1073741824 2 0x1p-1073741824 2 1 2 0x1p-1073741824 U U +# log (eps + i) +- - 2 0 2 0x3p-1 2 0x1p-1073741824 2 1 N N +- - 2 0 2 0x3p-1 2 0x1p-1073741824 2 1 D D ++ + 2 0x1p-1073741824 2 2 2 0x1p-1073741824 2 1 U U + +# log (close to 1 + i*eps), improves test coverage ++ - 2 -0x1p-36 2 0x1p-1073741824 36 0x0.FFFFFFFFF 2 0x1p-1073741824 N N diff --git a/tests/mpc-tests.h b/tests/mpc-tests.h index bf3fec9..fe3e452 100644 --- a/tests/mpc-tests.h +++ b/tests/mpc-tests.h @@ -43,8 +43,15 @@ along with this program. If not, see http://www.gnu.org/licenses/ . } \ } while (0) +#if defined (__cplusplus) +extern "C" { +#endif __MPC_DECLSPEC int mpc_mul_naive (mpc_ptr, mpc_srcptr, mpc_srcptr, mpc_rnd_t); __MPC_DECLSPEC int mpc_mul_karatsuba (mpc_ptr, mpc_srcptr, mpc_srcptr, mpc_rnd_t); +__MPC_DECLSPEC int mpc_fma_naive (mpc_ptr, mpc_srcptr, mpc_srcptr, mpc_srcptr, mpc_rnd_t); +#if defined (__cplusplus) +} +#endif /* end pieces copied from mpc-impl.h */ #define MPC_OUT(x) \ @@ -58,7 +65,7 @@ do { \ #define MPFR_OUT(x) \ do { \ printf (#x "[%lu]=", (unsigned long int) mpfr_get_prec (x)); \ - mpfr_out_str (stdout, 2, 0, x, GMP_RNDN); \ + mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN); \ printf ("\n"); \ } while (0) diff --git a/tests/mul.dat b/tests/mul.dat index 9ed14bd..13ea1e6 100755 --- a/tests/mul.dat +++ b/tests/mul.dat @@ -1,6 +1,6 @@ # Data file for mpc_mul # -# Copyright (C) 2008, 2010, 2011 INRIA +# Copyright (C) 2008, 2010, 2011, 2012 INRIA # # This file is part of GNU MPC. # @@ -173,3 +173,6 @@ # improve code coverage: case where sign_x==0 in mpc_mul_karatsuba 0 0 2000 6 2000 8 2000 4 2000 2 2000 2 2000 1 N N 0 0 2000 0 2000 4 2000 2 2000 2 2000 1 2000 1 N N + ++ 0 2 1 2 0x2p-536870913 2 1 2 0x1p-536870913 2 1 2 0x1p-536870913 N N +0 - 2 0 2 1 2 0x1p-536870913 2 1 2 1 2 0x1p-536870913 N N diff --git a/tests/pow.dat b/tests/pow.dat index 15eab18..1105f59 100644 --- a/tests/pow.dat +++ b/tests/pow.dat @@ -454,3 +454,16 @@ - + 2 +0 2 -0 2 4 2 3 28 -744261116 2 +0 N N - - 2 +0 2 +0 2 4 2 -3 28 -744261116 2 +0 N N +# exact powers with non-integer exponent +0 0 2 1 2 1 2 0 2 2 2 0.5 2 0 N N +0 0 2 -2 2 2 2 0 2 2 2 1.5 2 0 N N +0 0 2 1 2 64 12 -4095 2 128 2 0.5 2 0 N N +0 0 3 5 2 3 2 16 4 30 2 0.5 2 0 N N +0 0 7 97 7 99 6 -392 14 19206 2 0.5 2 0 N N +0 0 6 63 6 61 5 248 18 7686 2 0.5 2 0 N N +0 0 6 63 6 61 24 -59013092 17 3812256 2 0.25 2 0 N N + +0 + 2 0 2 0x3p-6 2 -1 2 0 2 0.5 2 1 N N ++ + 2 6 2 1 41 -0x2ce019e6f1e 36 0x1878418ba20 2 0.0625 2 0 N N ++ + 4 11 2 1 111 -0x73558286726957f922819cbeffff 109 0x1c484a8b32dbf409e966a8c00000 2 0x1p-5 2 0 N N ++ + 5 21 2 1 282 -0x24ea91ddba938e750d999f1075444e15d6ca0fff6a19c8cbefe6260261fd57effffffff 278 0x390aa828a3d933391ab999b0b0aa71aafbfc7b127fe30c84d107634940ba8000000000 2 0x1p-6 2 0 N N diff --git a/tests/random.c b/tests/random.c index aa06355..0730fee 100644 --- a/tests/random.c +++ b/tests/random.c @@ -1,6 +1,6 @@ /* random.c -- Handle seed for random numbers. -// Copyright (C) 2008, 2009, 2010, 2011 INRIA +// Copyright (C) 2008, 2009, 2010, 2011, 2012 INRIA This file is part of GNU MPC. @@ -140,9 +140,9 @@ test_default_random (mpc_ptr z, mpfr_exp_t emin, mpfr_exp_t emax, zero_im_p = !zero_re_p; } if (zero_re_p) - mpfr_set_ui (mpc_realref (z), 0, GMP_RNDN); + mpfr_set_ui (mpc_realref (z), 0, MPFR_RNDN); if (zero_im_p) - mpfr_set_ui (mpc_imagref (z), 0, GMP_RNDN); + mpfr_set_ui (mpc_imagref (z), 0, MPFR_RNDN); } if (!mpfr_zero_p (mpc_realref (z))) mpfr_set_exp (mpc_realref (z), (mpfr_exp_t) gmp_urandomm_ui (rands, range) + emin); @@ -154,7 +154,7 @@ test_default_random (mpc_ptr z, mpfr_exp_t emin, mpfr_exp_t emax, negative_probability = 256; r = gmp_urandomb_ui (rands, 16); if ((r & 0xFF) < negative_probability) - mpfr_neg (mpc_realref (z), mpc_realref (z), GMP_RNDN); + mpfr_neg (mpc_realref (z), mpc_realref (z), MPFR_RNDN); if (((r>>8) & 0xFF) < negative_probability) - mpfr_neg (mpc_imagref (z), mpc_imagref (z), GMP_RNDN); + mpfr_neg (mpc_imagref (z), mpc_imagref (z), MPFR_RNDN); } diff --git a/tests/read_data.c b/tests/read_data.c index a9f3648..c1cf677 100644 --- a/tests/read_data.c +++ b/tests/read_data.c @@ -1,6 +1,6 @@ /* read_data,c -- Read data file and check function. -Copyright (C) 2008, 2009, 2010, 2011 INRIA +Copyright (C) 2008, 2009, 2010, 2011, 2012 INRIA This file is part of GNU MPC. @@ -41,7 +41,7 @@ int nextchar; : (inex) == -1 ? "-1" : "0" static const char *mpfr_rnd_mode [] = - { "GMP_RNDN", "GMP_RNDZ", "GMP_RNDU", "GMP_RNDD" }; + { "MPFR_RNDN", "MPFR_RNDZ", "MPFR_RNDU", "MPFR_RNDD" }; const char *rnd_mode[] = { "MPC_RNDNN", "MPC_RNDZN", "MPC_RNDUN", "MPC_RNDDN", @@ -238,16 +238,16 @@ read_mpfr_rounding_mode (FILE *fp, mpfr_rnd_t* rnd) switch (nextchar) { case 'n': case 'N': - *rnd = GMP_RNDN; + *rnd = MPFR_RNDN; break; case 'z': case 'Z': - *rnd = GMP_RNDZ; + *rnd = MPFR_RNDZ; break; case 'u': case 'U': - *rnd = GMP_RNDU; + *rnd = MPFR_RNDU; break; case 'd': case 'D': - *rnd = GMP_RNDD; + *rnd = MPFR_RNDD; break; default: printf ("Error: Unexpected rounding mode '%c' in file '%s' line %lu\n", @@ -271,7 +271,7 @@ read_mpc_rounding_mode (FILE *fp, mpc_rnd_t* rnd) mpfr_rnd_t re, im; read_mpfr_rounding_mode (fp, &re); read_mpfr_rounding_mode (fp, &im); - *rnd = RNDC (re, im); + *rnd = MPC_RND (re, im); } void @@ -382,7 +382,7 @@ read_mpfr_mantissa (FILE *fp, mpfr_ptr x) exit (1); } ungetc (nextchar, fp); - if (mpfr_inp_str (x, fp, 0, GMP_RNDN) == 0) { + if (mpfr_inp_str (x, fp, 0, MPFR_RNDN) == 0) { printf ("Error: Impossible to read mpfr mantissa " "in file '%s' line %lu\n", pathname, line_number); @@ -419,10 +419,10 @@ read_mpc (FILE *fp, mpc_ptr z, known_signs_t *ks) static void check_compatible (int inex, mpfr_t expected, mpfr_rnd_t rnd, const char *s) { - if ((rnd == GMP_RNDU && inex == -1) || - (rnd == GMP_RNDD && inex == +1) || - (rnd == GMP_RNDZ && !mpfr_signbit (expected) && inex == +1) || - (rnd == GMP_RNDZ && mpfr_signbit (expected) && inex == -1)) + if ((rnd == MPFR_RNDU && inex == -1) || + (rnd == MPFR_RNDD && inex == +1) || + (rnd == MPFR_RNDZ && !mpfr_signbit (expected) && inex == +1) || + (rnd == MPFR_RNDZ && mpfr_signbit (expected) && inex == -1)) { if (s != NULL) printf ("Incompatible ternary value '%c' (%s part) in file '%s' line %lu\n", @@ -594,56 +594,56 @@ set_mpfr_flags (int counter) static void check_mpfr_flags (int counter) { - int old, new; + int old, neu; old = (counter & 1) != 0; - new = mpfr_underflow_p () != 0; - if (old && (new == 0)) + neu = mpfr_underflow_p () != 0; + if (old && (neu == 0)) { printf ("Error, underflow flag has been modified from %d to %d\n", - old, new); + old, neu); exit (1); } old = (counter & 2) != 0; - new = mpfr_overflow_p () != 0; - if (old && (new == 0)) + neu = mpfr_overflow_p () != 0; + if (old && (neu == 0)) { printf ("Error, overflow flag has been modified from %d to %d\n", - old, new); + old, neu); exit (1); } #ifdef mpfr_divby0_p old = (counter & 4) != 0; - new = mpfr_divby0_p () != 0; - if (old && (new == 0)) + neu = mpfr_divby0_p () != 0; + if (old && (neu == 0)) { printf ("Error, divby0 flag has been modified from %d to %d\n", - old, new); + old, neu); exit (1); } #endif old = (counter & 8) != 0; - new = mpfr_nanflag_p () != 0; - if (old && (new == 0)) + neu = mpfr_nanflag_p () != 0; + if (old && (neu == 0)) { printf ("Error, nanflag flag has been modified from %d to %d\n", - old, new); + old, neu); exit (1); } old = (counter & 16) != 0; - new = mpfr_inexflag_p () != 0; - if (old && (new == 0)) + neu = mpfr_inexflag_p () != 0; + if (old && (neu == 0)) { printf ("Error, inexflag flag has been modified from %d to %d\n", - old, new); + old, neu); exit (1); } old = (counter & 32) != 0; - new = mpfr_erangeflag_p () != 0; - if (old && (new == 0)) + neu = mpfr_erangeflag_p () != 0; + if (old && (neu == 0)) { printf ("Error, erangeflag flag has been modified from %d to %d\n", - old, new); + old, neu); exit (1); } } @@ -657,7 +657,7 @@ data_check (mpc_function function, const char *file_name) int inex_re; mpfr_t x1, x2; - mpfr_rnd_t mpfr_rnd = GMP_RNDN; + mpfr_rnd_t mpfr_rnd = MPFR_RNDN; int sign_real; int inex_im; diff --git a/tests/sqrt.dat b/tests/sqrt.dat index 8a9e7ca..076f2af 100644 --- a/tests/sqrt.dat +++ b/tests/sqrt.dat @@ -123,6 +123,7 @@ - + 375 1 375 0xf.8a8aae3080b3dd665e316d262fd54c1ca22a83dc9acb92ef6p-202281177 375 1 375 0xf.8a8aae3080b3dd665e316d262fd54c1ca22a83dc9acb92ef6p-202281176 N N + + 375 0x1.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004 375 0xf.8a8aae3080b3dd665e316d262fd54c1ca22a83dc9acb92ef6p-202281177 375 1 375 0xf.8a8aae3080b3dd665e316d262fd54c1ca22a83dc9acb92ef6p-202281176 U U - - 375 1 375 0xf.8a8aae3080b3dd665e316d262fd54c1ca22a83dc9acb92ef5fffffffffffffffffffffffffffffffffffffffffffep-202281177 375 1 375 0xf.8a8aae3080b3dd665e316d262fd54c1ca22a83dc9acb92ef6p-202281176 D D +- + 375 1 375 -0xf.8a8aae3080b3dd665e316d262fd54c1ca22a83dc9acb92ef5fffffffffffffffffffffffffffffffffffffffffffep-202281177 375 1 375 -0xf.8a8aae3080b3dd665e316d262fd54c1ca22a83dc9acb92ef6p-202281176 D U - - 375 1 375 0xf.8a8aae3080b3dd665e316d262fd54c1ca22a83dc9acb92ef5fffffffffffffffffffffffffffffffffffffffffffep-202281177 375 1 375 0xf.8a8aae3080b3dd665e316d262fd54c1ca22a83dc9acb92ef6p-202281176 Z Z - - 375 1 375 -0xf.8a8aae3080b3dd665e316d262fd54c1ca22a83dc9acb92ef6p-202281177 375 1 375 -0xf.8a8aae3080b3dd665e316d262fd54c1ca22a83dc9acb92ef6p-202281176 N N + + 375 0x1.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004 375 -0xf.8a8aae3080b3dd665e316d262fd54c1ca22a83dc9acb92ef5fffffffffffffffffffffffffffffffffffffffffffep-202281177 375 1 375 -0xf.8a8aae3080b3dd665e316d262fd54c1ca22a83dc9acb92ef6p-202281176 U U diff --git a/tests/tadd.c b/tests/tadd.c index 1253b64..11a305b 100644 --- a/tests/tadd.c +++ b/tests/tadd.c @@ -1,6 +1,6 @@ /* tadd -- test file for mpc_add. -Copyright (C) 2008, 2010, 2011 INRIA +Copyright (C) 2008, 2010, 2011, 2012 INRIA This file is part of GNU MPC. @@ -37,7 +37,7 @@ check_ternary_value (void) mpc_set_prec (y, prec); mpc_set_ui (x, 1, MPC_RNDNN); - mpc_mul_2exp (x, x, (unsigned long int) prec, MPC_RNDNN); + mpc_mul_2ui (x, x, (unsigned long int) prec, MPC_RNDNN); mpc_set_ui (y, 1, MPC_RNDNN); if (mpc_add (z, x, y, MPC_RNDNN) == 0) diff --git a/tests/tadd_fr.c b/tests/tadd_fr.c index d5ed163..0f1a5cf 100644 --- a/tests/tadd_fr.c +++ b/tests/tadd_fr.c @@ -1,6 +1,6 @@ /* tadd_fr -- test file for mpc_add_fr. -Copyright (C) 2008, 2010 INRIA +Copyright (C) 2008, 2010, 2012 INRIA This file is part of GNU MPC. @@ -37,7 +37,7 @@ check_ternary_value (mpfr_prec_t prec_max, mpfr_prec_t step) mpfr_set_prec (f, prec); mpc_set_ui (z, 1, MPC_RNDNN); - mpfr_set_ui (f, 1, GMP_RNDN); + mpfr_set_ui (f, 1, MPFR_RNDN); if (mpc_add_fr (z, z, f, MPC_RNDNZ)) { printf ("Error in mpc_add_fr: 1+1 should be exact\n"); @@ -45,7 +45,7 @@ check_ternary_value (mpfr_prec_t prec_max, mpfr_prec_t step) } mpc_set_ui (z, 1, MPC_RNDNN); - mpc_mul_2exp (z, z, (unsigned long int) prec, MPC_RNDNN); + mpc_mul_2ui (z, z, (unsigned long int) prec, MPC_RNDNN); if (mpc_add_fr (z, z, f, MPC_RNDNN) == 0) { fprintf (stderr, "Error in mpc_add_fr: 2^prec+1 cannot be exact\n"); diff --git a/tests/tadd_si.c b/tests/tadd_si.c index 20fb39d..da12a7a 100644 --- a/tests/tadd_si.c +++ b/tests/tadd_si.c @@ -1,6 +1,6 @@ /* tadd_si -- test file for mpc_add_si. -Copyright (C) 2011 INRIA +Copyright (C) 2011, 2012 INRIA This file is part of GNU MPC. @@ -42,7 +42,7 @@ check_ternary_value (void) exit (1); } - mpc_mul_2exp (z, z, (unsigned long int) prec, MPC_RNDNN); + mpc_mul_2ui (z, z, (unsigned long int) prec, MPC_RNDNN); if (mpc_add_si (z, z, s, MPC_RNDNN) == 0) { printf ("Error in mpc_add_si: 2^(prec+1)-1 cannot be exact\n"); exit (1); diff --git a/tests/tadd_ui.c b/tests/tadd_ui.c index 362ebde..4f8efea 100644 --- a/tests/tadd_ui.c +++ b/tests/tadd_ui.c @@ -1,6 +1,6 @@ /* tadd_ui -- test file for mpc_add_ui. -Copyright (C) 2008, 2010 INRIA +Copyright (C) 2008, 2010, 2012 INRIA This file is part of GNU MPC. @@ -41,7 +41,7 @@ check_ternary_value (void) } mpc_set_ui (z, 1, MPC_RNDNN); - mpc_mul_2exp (z, z, (unsigned long int) prec, MPC_RNDNN); + mpc_mul_2ui (z, z, (unsigned long int) prec, MPC_RNDNN); if (mpc_add_ui (z, z, 1, MPC_RNDNN) == 0) { printf ("Error in mpc_add_ui: 2^prec+1 cannot be exact\n"); diff --git a/tests/tan.dat b/tests/tan.dat index d9ce811..ce4c097 100644 --- a/tests/tan.dat +++ b/tests/tan.dat @@ -125,6 +125,7 @@ # huge values + - 53 -0 53 -1 53 0x4580CBF242683p-3 53 -0x1B3E8A3660D279p-3 N N +- - 53 +0 53 -1 53 -0x4580CBF242683p-3 53 -0x1B3E8A3660D279p-3 N N + + 53 -0 53 +1 53 -0x1B3E8A3660D279p-3 53 0x4580CBF242683p-3 N N # some values taken from ttan.c diff --git a/tests/tatan.c b/tests/tatan.c index 8883588..ca93ec4 100644 --- a/tests/tatan.c +++ b/tests/tatan.c @@ -30,10 +30,10 @@ test_underflow (void) mpfr_set_emin (-10); mpc_init2 (z, 21); - mpfr_set_si (mpc_realref(z), -1, GMP_RNDZ); - mpfr_set_ui_2exp (mpc_imagref(z), 1, 20, GMP_RNDZ); - mpfr_add_ui (mpc_imagref(z), mpc_imagref(z), 1, GMP_RNDZ); - mpfr_div_2exp (mpc_imagref(z), mpc_imagref(z), 20, GMP_RNDZ); + mpfr_set_si (mpc_realref(z), -1, MPFR_RNDZ); + mpfr_set_ui_2exp (mpc_imagref(z), 1, 20, MPFR_RNDZ); + mpfr_add_ui (mpc_imagref(z), mpc_imagref(z), 1, MPFR_RNDZ); + mpfr_div_2exp (mpc_imagref(z), mpc_imagref(z), 20, MPFR_RNDZ); mpc_atan (z, z, MPC_RNDNN); if (mpfr_cmp_si_2exp (mpc_realref(z), -1066635, 20) != 0 || mpfr_cmp_si_2exp (mpc_imagref(z), 1687619, 22)) diff --git a/tests/tcos.c b/tests/tcos.c index 66a85ba..dafc01d 100644 --- a/tests/tcos.c +++ b/tests/tcos.c @@ -1,6 +1,6 @@ /* tcos -- test file for mpc_cos. -Copyright (C) 2008, 2009, 2011 INRIA +Copyright (C) 2008, 2009, 2011, 2012 INRIA This file is part of GNU MPC. @@ -30,13 +30,13 @@ bug20090105 (void) mpc_init2 (got, 324); mpfr_set_str (mpc_realref(op), "-3.f1813b1487372434fea4414a520f65a343a16d0ec1ffb" - "b2b880154db8d63377ce788fc4215c450300@1", 16, GMP_RNDN); + "b2b880154db8d63377ce788fc4215c450300@1", 16, MPFR_RNDN); mpfr_set_str (mpc_imagref(op), "-2.b7a0c80bcacf1ccbbac614bf53a58b672b1b503161bee" - "59a82e46a23570b652f7ba5f01ef766d1c50", 16,GMP_RNDN); + "59a82e46a23570b652f7ba5f01ef766d1c50", 16,MPFR_RNDN); mpfr_set_str (mpc_realref(expected), "7.57c5b08a2b11b660d906a354289b0724b9c4b237" - "95abe33424e8d9858e534bd5d776ddd18e34b0240", 16, GMP_RNDN); + "95abe33424e8d9858e534bd5d776ddd18e34b0240", 16, MPFR_RNDN); mpfr_set_str (mpc_imagref(expected), "-1.f41a389646d068e0263561cb3c5d1df763945ad" - "ed9339f2a98387a3c4f97dbfd8a08b7d0af2f11b46", 16,GMP_RNDN); + "ed9339f2a98387a3c4f97dbfd8a08b7d0af2f11b46", 16,MPFR_RNDN); mpc_cos (got, op, MPC_RNDNN); if (mpc_cmp (got, expected) != 0) diff --git a/tests/tcosh.c b/tests/tcosh.c index 57b5601..0d6a9da 100644 --- a/tests/tcosh.c +++ b/tests/tcosh.c @@ -1,6 +1,6 @@ /* test file for mpc_cosh. -Copyright (C) 2008, 2009, 2010, 2011 INRIA +Copyright (C) 2008, 2009, 2010, 2011, 2012 INRIA This file is part of GNU MPC. @@ -38,8 +38,8 @@ pure_real_argument (void) /* cosh(1 +i*0) = cosh(1) +i*0 */ mpc_set_ui_ui (z, 1, 0, MPC_RNDNN); - mpfr_cosh (mpc_realref (u), mpc_realref (z), GMP_RNDN); - mpfr_set_ui (mpc_imagref (u), 0, GMP_RNDN); + mpfr_cosh (mpc_realref (u), mpc_realref (z), MPFR_RNDN); + mpfr_set_ui (mpc_imagref (u), 0, MPFR_RNDN); mpc_cosh (cosh_z, z, MPC_RNDNN); if (mpc_cmp (cosh_z, u) != 0 || mpfr_signbit (mpc_imagref (cosh_z))) TEST_FAILED ("mpc_cosh", z, cosh_z, u, MPC_RNDNN); @@ -84,8 +84,8 @@ pure_imaginary_argument (void) /* cosh(+0 +i) = cos(1) + i*0 */ mpc_set_ui_ui (z, 0, 1, MPC_RNDNN); - mpfr_cos (mpc_realref (u), mpc_imagref (z), GMP_RNDN); - mpfr_set_ui (mpc_imagref (u), 0, GMP_RNDN); + mpfr_cos (mpc_realref (u), mpc_imagref (z), MPFR_RNDN); + mpfr_set_ui (mpc_imagref (u), 0, MPFR_RNDN); mpc_cosh (cosh_z, z, MPC_RNDNN); if (mpc_cmp (cosh_z, u) != 0 || mpfr_signbit (mpc_imagref (cosh_z))) TEST_FAILED ("mpc_cosh", z, cosh_z, u, MPC_RNDNN); diff --git a/tests/tdiv_2exp.c b/tests/tdiv_2si.c index 91b03af..5046201 100644 --- a/tests/tdiv_2exp.c +++ b/tests/tdiv_2si.c @@ -1,6 +1,6 @@ -/* tdiv_2exp -- test file for mpc_div_2exp. +/* tdiv_2si -- test file for mpc_div_2si. -Copyright (C) 2008 INRIA +Copyright (C) 2012 INRIA This file is part of GNU MPC. @@ -23,7 +23,7 @@ along with this program. If not, see http://www.gnu.org/licenses/ . int main (void) { - DECL_FUNC (CCU, f, mpc_div_2exp); + DECL_FUNC (CCS, f, mpc_div_2si); test_start (); diff --git a/tests/tdiv_2ui.c b/tests/tdiv_2ui.c new file mode 100644 index 0000000..6cc8f14 --- /dev/null +++ b/tests/tdiv_2ui.c @@ -0,0 +1,35 @@ +/* tdiv_2ui -- test file for mpc_div_2ui. + +Copyright (C) 2008, 2012 INRIA + +This file is part of GNU MPC. + +GNU MPC is free software; you can redistribute it and/or modify it under +the terms of the GNU Lesser General Public License as published by the +Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +GNU MPC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for +more details. + +You should have received a copy of the GNU Lesser General Public License +along with this program. If not, see http://www.gnu.org/licenses/ . +*/ + +#include "mpc-tests.h" + +int +main (void) +{ + DECL_FUNC (CCU, f, mpc_div_2ui); + + test_start (); + + tgeneric (f, 2, 1024, 7, -1); + + test_end (); + + return 0; +} diff --git a/tests/tfma.c b/tests/tfma.c index 02eed66..81bc167 100644 --- a/tests/tfma.c +++ b/tests/tfma.c @@ -62,7 +62,7 @@ static void check_random (void) { mpfr_prec_t prec; - mpfr_rnd_t rnd_re, rnd_im; + int rnd_re, rnd_im; mpc_t a, b, c; mpc_init2 (a, 1000); @@ -80,7 +80,7 @@ check_random (void) for (rnd_re = 0; rnd_re < 4; rnd_re ++) for (rnd_im = 0; rnd_im < 4; rnd_im ++) - cmpfma (a, b, c, RNDC(rnd_re, rnd_im)); + cmpfma (a, b, c, MPC_RND (rnd_re, rnd_im)); } mpc_clear (a); diff --git a/tests/tgeneric.c b/tests/tgeneric.c index 1ead958..cf56997 100644 --- a/tests/tgeneric.c +++ b/tests/tgeneric.c @@ -1,6 +1,6 @@ /* tgeneric.c -- File for generic tests. -Copyright (C) 2008, 2009, 2010, 2011 INRIA +Copyright (C) 2008, 2009, 2010, 2011, 2012 INRIA This file is part of GNU MPC. @@ -25,7 +25,7 @@ along with this program. If not, see http://www.gnu.org/licenses/ . #define MPFR_CAN_ROUND(b,err,prec,rnd) \ (mpfr_zero_p (b) || mpfr_inf_p (b) \ || mpfr_can_round (b, (long)mpfr_get_prec (b) - (err), (rnd), \ - GMP_RNDZ, (prec) + ((rnd)==GMP_RNDN))) + MPFR_RNDZ, (prec) + ((rnd)==MPFR_RNDN))) /* functions with one input, one output */ static void @@ -563,8 +563,8 @@ static void reuse_fc (mpc_function* function, mpc_ptr z, mpc_ptr x, mpfr_ptr expected) { mpc_set (x, z, MPC_RNDNN); /* exact */ - function->pointer.FC (expected, z, GMP_RNDN); - function->pointer.FC (mpc_realref (x), x, GMP_RNDN); + function->pointer.FC (expected, z, MPFR_RNDN); + function->pointer.FC (mpc_realref (x), x, MPFR_RNDN); if (!same_mpfr_value (mpc_realref (x), expected, 1)) { mpfr_t got; @@ -577,7 +577,7 @@ reuse_fc (mpc_function* function, mpc_ptr z, mpc_ptr x, mpfr_ptr expected) exit (1); } mpc_set (x, z, MPC_RNDNN); /* exact */ - function->pointer.FC (mpc_imagref (x), x, GMP_RNDN); + function->pointer.FC (mpc_imagref (x), x, MPFR_RNDN); if (!same_mpfr_value (mpc_imagref (x), expected, 1)) { mpfr_t got; @@ -856,7 +856,7 @@ reuse_cuuc (mpc_function* function, unsigned long ul1, unsigned long ul2, static mpfr_rnd_t first_rnd_mode (void) { - return GMP_RNDN; + return MPFR_RNDN; } static mpfr_rnd_t @@ -865,16 +865,16 @@ next_rnd_mode (mpfr_rnd_t curr) when curr is the last rounding mode */ { switch (curr) { - case GMP_RNDN: - return GMP_RNDZ; - case GMP_RNDZ: - return GMP_RNDU; - case GMP_RNDU: - return GMP_RNDD; + case MPFR_RNDN: + return MPFR_RNDZ; + case MPFR_RNDZ: + return MPFR_RNDU; + case MPFR_RNDU: + return MPFR_RNDD; default: /* return invalid guard value in mpfr_rnd_t */ #if MPFR_VERSION_MAJOR < 3 - return GMP_RNDNA; + return MPFR_RNDNA; #else return MPFR_RNDA; /* valid rounding type, but not (yet) used in mpc */ #endif @@ -885,8 +885,8 @@ static int is_valid_rnd_mode (mpfr_rnd_t curr) /* returns 1 if curr is a valid rounding mode, and 0otherwise */ { - if ( curr == GMP_RNDN || curr == GMP_RNDZ - || curr == GMP_RNDU || curr == GMP_RNDD) + if ( curr == MPFR_RNDN || curr == MPFR_RNDZ + || curr == MPFR_RNDU || curr == MPFR_RNDD) return 1; else return 0; @@ -1010,25 +1010,25 @@ tgeneric (mpc_function function, mpfr_prec_t prec_min, switch (special) { case 1: - mpfr_set_ui (mpc_realref (z1), 0, GMP_RNDN); + mpfr_set_ui (mpc_realref (z1), 0, MPFR_RNDN); break; case 2: mpfr_set_inf (mpc_realref (z1), +1); break; case 3: - mpfr_set_ui (mpc_imagref (z1), 0, GMP_RNDN); + mpfr_set_ui (mpc_imagref (z1), 0, MPFR_RNDN); break; case 4: mpfr_set_inf (mpc_imagref (z1), -1); break; case 5: - mpfr_set_ui (mpc_realref (z2), 0, GMP_RNDN); + mpfr_set_ui (mpc_realref (z2), 0, MPFR_RNDN); break; case 6: mpfr_set_inf (mpc_realref (z2), -1); break; case 7: - mpfr_set_ui (mpc_imagref (z2), 0, GMP_RNDN); + mpfr_set_ui (mpc_imagref (z2), 0, MPFR_RNDN); break; case 8: mpfr_set_inf (mpc_imagref (z2), +1); @@ -1045,25 +1045,25 @@ tgeneric (mpc_function function, mpfr_prec_t prec_min, switch (special) { case 1: - mpfr_set_ui (mpc_realref (z1), 0, GMP_RNDN); + mpfr_set_ui (mpc_realref (z1), 0, MPFR_RNDN); break; case 2: mpfr_set_inf (mpc_realref (z1), +1); break; case 3: - mpfr_set_ui (mpc_imagref (z1), 0, GMP_RNDN); + mpfr_set_ui (mpc_imagref (z1), 0, MPFR_RNDN); break; case 4: mpfr_set_inf (mpc_imagref (z1), -1); break; case 5: - mpfr_set_ui (mpc_realref (z2), 0, GMP_RNDN); + mpfr_set_ui (mpc_realref (z2), 0, MPFR_RNDN); break; case 6: mpfr_set_inf (mpc_realref (z2), -1); break; case 7: - mpfr_set_ui (mpc_imagref (z2), 0, GMP_RNDN); + mpfr_set_ui (mpc_imagref (z2), 0, MPFR_RNDN); break; case 8: mpfr_set_inf (mpc_imagref (z2), +1); @@ -1078,13 +1078,13 @@ tgeneric (mpc_function function, mpfr_prec_t prec_min, switch (special) { case 1: - mpfr_set_ui (mpc_realref (z1), 0, GMP_RNDN); + mpfr_set_ui (mpc_realref (z1), 0, MPFR_RNDN); break; case 2: mpfr_set_inf (mpc_realref (z1), +1); break; case 3: - mpfr_set_ui (mpc_imagref (z1), 0, GMP_RNDN); + mpfr_set_ui (mpc_imagref (z1), 0, MPFR_RNDN); break; case 4: mpfr_set_inf (mpc_imagref (z1), -1); @@ -1095,21 +1095,21 @@ tgeneric (mpc_function function, mpfr_prec_t prec_min, mpc_set_prec (z2, 128); do { test_default_random (z2, 0, 64, 128, zero_probability); - } while (!mpfr_fits_ulong_p (mpc_realref (z2), GMP_RNDN)); - ul1 = mpfr_get_ui (mpc_realref(z2), GMP_RNDN); + } while (!mpfr_fits_ulong_p (mpc_realref (z2), MPFR_RNDN)); + ul1 = mpfr_get_ui (mpc_realref(z2), MPFR_RNDN); mpc_set_prec (z2, prec); mpc_set_prec (z3, prec); mpc_set_prec (zzzz, 4*prec); switch (special) { case 1: - mpfr_set_ui (mpc_realref (z1), 0, GMP_RNDN); + mpfr_set_ui (mpc_realref (z1), 0, MPFR_RNDN); break; case 2: mpfr_set_inf (mpc_realref (z1), +1); break; case 3: - mpfr_set_ui (mpc_imagref (z1), 0, GMP_RNDN); + mpfr_set_ui (mpc_imagref (z1), 0, MPFR_RNDN); break; case 4: mpfr_set_inf (mpc_imagref (z1), -1); @@ -1123,23 +1123,23 @@ tgeneric (mpc_function function, mpfr_prec_t prec_min, mpc_set_prec (z2, 128); do { test_default_random (z2, 0, 64, 128, zero_probability); - } while (!mpfr_fits_ulong_p (mpc_realref (z2), GMP_RNDN) - ||!mpfr_fits_ulong_p (mpc_imagref (z2), GMP_RNDN)); - ul1 = mpfr_get_ui (mpc_realref(z2), GMP_RNDN); - ul2 = mpfr_get_ui (mpc_imagref(z2), GMP_RNDN); + } while (!mpfr_fits_ulong_p (mpc_realref (z2), MPFR_RNDN) + ||!mpfr_fits_ulong_p (mpc_imagref (z2), MPFR_RNDN)); + ul1 = mpfr_get_ui (mpc_realref(z2), MPFR_RNDN); + ul2 = mpfr_get_ui (mpc_imagref(z2), MPFR_RNDN); mpc_set_prec (z2, prec); mpc_set_prec (z3, prec); mpc_set_prec (zzzz, 4*prec); switch (special) { case 1: - mpfr_set_ui (mpc_realref (z1), 0, GMP_RNDN); + mpfr_set_ui (mpc_realref (z1), 0, MPFR_RNDN); break; case 2: mpfr_set_inf (mpc_realref (z1), +1); break; case 3: - mpfr_set_ui (mpc_imagref (z1), 0, GMP_RNDN); + mpfr_set_ui (mpc_imagref (z1), 0, MPFR_RNDN); break; case 4: mpfr_set_inf (mpc_imagref (z1), -1); @@ -1156,21 +1156,21 @@ tgeneric (mpc_function function, mpfr_prec_t prec_min, mpc_set_prec (z2, 128); do { test_default_random (z2, 0, 64, 128, zero_probability); - } while (!mpfr_fits_slong_p (mpc_realref (z2), GMP_RNDN)); - lo = mpfr_get_si (mpc_realref(z2), GMP_RNDN); + } while (!mpfr_fits_slong_p (mpc_realref (z2), MPFR_RNDN)); + lo = mpfr_get_si (mpc_realref(z2), MPFR_RNDN); mpc_set_prec (z2, prec); mpc_set_prec (z3, prec); mpc_set_prec (zzzz, 4*prec); switch (special) { case 1: - mpfr_set_ui (mpc_realref (z1), 0, GMP_RNDN); + mpfr_set_ui (mpc_realref (z1), 0, MPFR_RNDN); break; case 2: mpfr_set_inf (mpc_realref (z1), +1); break; case 3: - mpfr_set_ui (mpc_imagref (z1), 0, GMP_RNDN); + mpfr_set_ui (mpc_imagref (z1), 0, MPFR_RNDN); break; case 4: mpfr_set_inf (mpc_imagref (z1), -1); @@ -1184,21 +1184,21 @@ tgeneric (mpc_function function, mpfr_prec_t prec_min, mpc_set_prec (z2, 128); do { test_default_random (z2, 0, 64, 128, zero_probability); - } while (!mpfr_fits_slong_p (mpc_realref (z2), GMP_RNDN)); - i = (int)mpfr_get_si (mpc_realref(z2), GMP_RNDN); + } while (!mpfr_fits_slong_p (mpc_realref (z2), MPFR_RNDN)); + i = (int)mpfr_get_si (mpc_realref(z2), MPFR_RNDN); mpc_set_prec (z2, prec); mpc_set_prec (z3, prec); mpc_set_prec (zzzz, 4*prec); switch (special) { case 1: - mpfr_set_ui (mpc_realref (z1), 0, GMP_RNDN); + mpfr_set_ui (mpc_realref (z1), 0, MPFR_RNDN); break; case 2: mpfr_set_inf (mpc_realref (z1), +1); break; case 3: - mpfr_set_ui (mpc_imagref (z1), 0, GMP_RNDN); + mpfr_set_ui (mpc_imagref (z1), 0, MPFR_RNDN); break; case 4: mpfr_set_inf (mpc_imagref (z1), -1); @@ -1210,7 +1210,7 @@ tgeneric (mpc_function function, mpfr_prec_t prec_min, break; case CCF: case CFC: mpfr_set_prec (x1, prec); - mpfr_set (x1, mpc_realref (z1), GMP_RNDN); + mpfr_set (x1, mpc_realref (z1), MPFR_RNDN); test_default_random (z1, exp_min, exp_max, 128, zero_probability); mpc_set_prec (z2, prec); mpc_set_prec (z3, prec); @@ -1218,19 +1218,19 @@ tgeneric (mpc_function function, mpfr_prec_t prec_min, switch (special) { case 1: - mpfr_set_ui (mpc_realref (z1), 0, GMP_RNDN); + mpfr_set_ui (mpc_realref (z1), 0, MPFR_RNDN); break; case 2: mpfr_set_inf (mpc_realref (z1), +1); break; case 3: - mpfr_set_ui (mpc_imagref (z1), 0, GMP_RNDN); + mpfr_set_ui (mpc_imagref (z1), 0, MPFR_RNDN); break; case 4: mpfr_set_inf (mpc_imagref (z1), -1); break; case 5: - mpfr_set_ui (x1, 0, GMP_RNDN); + mpfr_set_ui (x1, 0, MPFR_RNDN); break; case 6: mpfr_set_inf (x1, +1); @@ -1247,13 +1247,13 @@ tgeneric (mpc_function function, mpfr_prec_t prec_min, switch (special) { case 1: - mpfr_set_ui (mpc_realref (z1), 0, GMP_RNDN); + mpfr_set_ui (mpc_realref (z1), 0, MPFR_RNDN); break; case 2: mpfr_set_inf (mpc_realref (z1), +1); break; case 3: - mpfr_set_ui (mpc_imagref (z1), 0, GMP_RNDN); + mpfr_set_ui (mpc_imagref (z1), 0, MPFR_RNDN); break; case 4: mpfr_set_inf (mpc_imagref (z1), -1); @@ -1268,13 +1268,13 @@ tgeneric (mpc_function function, mpfr_prec_t prec_min, switch (special) { case 1: - mpfr_set_ui (mpc_realref (z1), 0, GMP_RNDN); + mpfr_set_ui (mpc_realref (z1), 0, MPFR_RNDN); break; case 2: mpfr_set_inf (mpc_realref (z1), +1); break; case 3: - mpfr_set_ui (mpc_imagref (z1), 0, GMP_RNDN); + mpfr_set_ui (mpc_imagref (z1), 0, MPFR_RNDN); break; case 4: mpfr_set_inf (mpc_imagref (z1), -1); @@ -1288,13 +1288,13 @@ tgeneric (mpc_function function, mpfr_prec_t prec_min, case C_CC: for (rnd_im = first_rnd_mode (); is_valid_rnd_mode (rnd_im); rnd_im = next_rnd_mode (rnd_im)) tgeneric_c_cc (&function, z1, z2, z3, zzzz, z4, - RNDC (rnd_re, rnd_im)); + MPC_RND (rnd_re, rnd_im)); reuse_c_cc (&function, z1, z2, z3, z4); break; case CCCC: for (rnd_im = first_rnd_mode (); is_valid_rnd_mode (rnd_im); rnd_im = next_rnd_mode (rnd_im)) tgeneric_cccc (&function, z1, z2, z3, z4, zzzz, z5, - RNDC (rnd_re, rnd_im)); + MPC_RND (rnd_re, rnd_im)); reuse_cccc (&function, z1, z2, z3, z4, z5); break; case FC: @@ -1304,7 +1304,7 @@ tgeneric (mpc_function function, mpfr_prec_t prec_min, case CC: for (rnd_im = first_rnd_mode (); is_valid_rnd_mode (rnd_im); rnd_im = next_rnd_mode (rnd_im)) tgeneric_cc (&function, z1, z2, zzzz, z3, - RNDC (rnd_re, rnd_im)); + MPC_RND (rnd_re, rnd_im)); reuse_cc (&function, z1, z2, z3); break; case CC_C: @@ -1312,49 +1312,49 @@ tgeneric (mpc_function function, mpfr_prec_t prec_min, for (rnd2_re = first_rnd_mode (); is_valid_rnd_mode (rnd2_re); rnd2_re = next_rnd_mode (rnd2_re)) for (rnd2_im = first_rnd_mode (); is_valid_rnd_mode (rnd2_im); rnd2_im = next_rnd_mode (rnd2_im)) tgeneric_cc_c (&function, z1, z2, z3, zzzz, zzzz2, z4, z5, - RNDC (rnd_re, rnd_im), RNDC (rnd2_re, rnd2_im)); + MPC_RND (rnd_re, rnd_im), MPC_RND (rnd2_re, rnd2_im)); reuse_cc_c (&function, z1, z2, z3, z4, z5); break; case CFC: for (rnd_im = first_rnd_mode (); is_valid_rnd_mode (rnd_im); rnd_im = next_rnd_mode (rnd_im)) tgeneric_cfc (&function, x1, z1, z2, zzzz, z3, - RNDC (rnd_re, rnd_im)); + MPC_RND (rnd_re, rnd_im)); reuse_cfc (&function, z1, x1, z2, z3); break; case CCF: for (rnd_im = first_rnd_mode (); is_valid_rnd_mode (rnd_im); rnd_im = next_rnd_mode (rnd_im)) tgeneric_ccf (&function, z1, x1, z2, zzzz, z3, - RNDC (rnd_re, rnd_im)); + MPC_RND (rnd_re, rnd_im)); reuse_ccf (&function, z1, x1, z2, z3); break; case CCU: for (rnd_im = first_rnd_mode (); is_valid_rnd_mode (rnd_im); rnd_im = next_rnd_mode (rnd_im)) tgeneric_ccu (&function, z1, ul1, z2, zzzz, z3, - RNDC (rnd_re, rnd_im)); + MPC_RND (rnd_re, rnd_im)); reuse_ccu (&function, z1, ul1, z2, z3); break; case CUC: for (rnd_im = first_rnd_mode (); is_valid_rnd_mode (rnd_im); rnd_im = next_rnd_mode (rnd_im)) tgeneric_cuc (&function, ul1, z1, z2, zzzz, z3, - RNDC (rnd_re, rnd_im)); + MPC_RND (rnd_re, rnd_im)); reuse_cuc (&function, ul1, z1, z2, z3); break; case CCS: for (rnd_im = first_rnd_mode (); is_valid_rnd_mode (rnd_im); rnd_im = next_rnd_mode (rnd_im)) tgeneric_ccs (&function, z1, lo, z2, zzzz, z3, - RNDC (rnd_re, rnd_im)); + MPC_RND (rnd_re, rnd_im)); reuse_ccs (&function, z1, lo, z2, z3); break; case CCI: for (rnd_im = first_rnd_mode (); is_valid_rnd_mode (rnd_im); rnd_im = next_rnd_mode (rnd_im)) tgeneric_cci (&function, z1, i, z2, zzzz, z3, - RNDC (rnd_re, rnd_im)); + MPC_RND (rnd_re, rnd_im)); reuse_cci (&function, z1, i, z2, z3); break; case CUUC: for (rnd_im = first_rnd_mode (); is_valid_rnd_mode (rnd_im); rnd_im = next_rnd_mode (rnd_im)) tgeneric_cuuc (&function, ul1, ul2, z1, z2, zzzz, z3, - RNDC (rnd_re, rnd_im)); + MPC_RND (rnd_re, rnd_im)); reuse_cuuc (&function, ul1, ul2, z1, z2, z3); break; default: diff --git a/tests/tmul.c b/tests/tmul.c index d83fca0..225cf0e 100644 --- a/tests/tmul.c +++ b/tests/tmul.c @@ -1,6 +1,6 @@ /* tmul -- test file for mpc_mul. -Copyright (C) 2002, 2005, 2008, 2009, 2010, 2011 INRIA +Copyright (C) 2002, 2005, 2008, 2009, 2010, 2011, 2012 INRIA This file is part of GNU MPC. @@ -84,7 +84,7 @@ static void check_regular (void) { mpc_t x, y; - mpc_rnd_t rnd_re, rnd_im; + int rnd_re, rnd_im; mpfr_prec_t prec; testmul (247, -65, -223, 416, 8, 24); @@ -102,15 +102,15 @@ check_regular (void) imaginary part */ mpc_set_prec (x, 7); mpc_set_prec (y, 7); - mpfr_set_str (mpc_realref (x), "0xB4p+733", 16, GMP_RNDN); - mpfr_set_str (mpc_imagref (x), "0x90p+244", 16, GMP_RNDN); - mpfr_set_str (mpc_realref (y), "0xECp-146", 16, GMP_RNDN); - mpfr_set_str (mpc_imagref (y), "0xACp-471", 16, GMP_RNDN); + mpfr_set_str (mpc_realref (x), "0xB4p+733", 16, MPFR_RNDN); + mpfr_set_str (mpc_imagref (x), "0x90p+244", 16, MPFR_RNDN); + mpfr_set_str (mpc_realref (y), "0xECp-146", 16, MPFR_RNDN); + mpfr_set_str (mpc_imagref (y), "0xACp-471", 16, MPFR_RNDN); cmpmul (x, y, MPC_RNDNN); - mpfr_set_str (mpc_realref (x), "0xB4p+733", 16, GMP_RNDN); - mpfr_set_str (mpc_imagref (x), "0x90p+244", 16, GMP_RNDN); - mpfr_set_str (mpc_realref (y), "0xACp-471", 16, GMP_RNDN); - mpfr_set_str (mpc_imagref (y), "-0xECp-146", 16, GMP_RNDN); + mpfr_set_str (mpc_realref (x), "0xB4p+733", 16, MPFR_RNDN); + mpfr_set_str (mpc_imagref (x), "0x90p+244", 16, MPFR_RNDN); + mpfr_set_str (mpc_realref (y), "0xACp-471", 16, MPFR_RNDN); + mpfr_set_str (mpc_imagref (y), "-0xECp-146", 16, MPFR_RNDN); cmpmul (x, y, MPC_RNDNN); for (prec = 2; prec < 1000; prec = (mpfr_prec_t) (prec * 1.1 + 1)) @@ -123,7 +123,7 @@ check_regular (void) for (rnd_re = 0; rnd_re < 4; rnd_re ++) for (rnd_im = 0; rnd_im < 4; rnd_im ++) - cmpmul (x, y, RNDC(rnd_re, rnd_im)); + cmpmul (x, y, MPC_RND (rnd_re, rnd_im)); } mpc_clear (x); diff --git a/tests/tmul_2exp.c b/tests/tmul_2si.c index 0653899..bf86f18 100644 --- a/tests/tmul_2exp.c +++ b/tests/tmul_2si.c @@ -1,6 +1,6 @@ -/* tmul_2exp -- test file for mpc_mul_2exp. +/* tmul_2si -- test file for mpc_mul_2si. -Copyright (C) 2008 INRIA +Copyright (C) 2012 INRIA This file is part of GNU MPC. @@ -23,7 +23,7 @@ along with this program. If not, see http://www.gnu.org/licenses/ . int main (void) { - DECL_FUNC (CCU, f, mpc_mul_2exp); + DECL_FUNC (CCS, f, mpc_mul_2si); test_start (); diff --git a/tests/tmul_2ui.c b/tests/tmul_2ui.c new file mode 100644 index 0000000..97073db --- /dev/null +++ b/tests/tmul_2ui.c @@ -0,0 +1,35 @@ +/* tmul_2ui -- test file for mpc_mul_2ui. + +Copyright (C) 2008, 2012 INRIA + +This file is part of GNU MPC. + +GNU MPC is free software; you can redistribute it and/or modify it under +the terms of the GNU Lesser General Public License as published by the +Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +GNU MPC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for +more details. + +You should have received a copy of the GNU Lesser General Public License +along with this program. If not, see http://www.gnu.org/licenses/ . +*/ + +#include "mpc-tests.h" + +int +main (void) +{ + DECL_FUNC (CCU, f, mpc_mul_2ui); + + test_start (); + + tgeneric (f, 2, 1024, 7, -1); + + test_end (); + + return 0; +} diff --git a/tests/tmul_i.c b/tests/tmul_i.c index 3cde4ac..863ed5f 100644 --- a/tests/tmul_i.c +++ b/tests/tmul_i.c @@ -1,6 +1,6 @@ /* tmul_i -- test file for mpc_mul_i. -Copyright (C) 2008, 2009, 2010, 2011 INRIA +Copyright (C) 2008, 2009, 2010, 2011, 2012 INRIA This file is part of GNU MPC. @@ -36,10 +36,10 @@ check_different_precisions(void) mpfr_set_prec (mpc_imagref (expected), 32); mpfr_set_prec (mpc_imagref (got), 32); - mpfr_set_str (mpc_realref (z), "0x100000000fp-32", 16, GMP_RNDN); - mpfr_set_str (mpc_imagref (z), "-1", 2, GMP_RNDN); - mpfr_set_str (mpc_realref (expected), "+1", 2, GMP_RNDN); - mpfr_set_str (mpc_imagref (expected), "0x100000000fp-32", 16, GMP_RNDN); + mpfr_set_str (mpc_realref (z), "0x100000000fp-32", 16, MPFR_RNDN); + mpfr_set_str (mpc_imagref (z), "-1", 2, MPFR_RNDN); + mpfr_set_str (mpc_realref (expected), "+1", 2, MPFR_RNDN); + mpfr_set_str (mpc_imagref (expected), "0x100000000fp-32", 16, MPFR_RNDN); mpc_set (got, z, MPC_RNDNN); res = mpc_mul_i (got, got, +1, MPC_RNDNN); diff --git a/tests/tnorm.c b/tests/tnorm.c index 3f4dccd..1dba939 100644 --- a/tests/tnorm.c +++ b/tests/tnorm.c @@ -1,6 +1,6 @@ /* tnorm -- test file for mpc_norm. -Copyright (C) 2008, 2011 INRIA +Copyright (C) 2008, 2011, 2012 INRIA This file is part of GNU MPC. @@ -30,11 +30,11 @@ test_underflow (void) mpfr_set_emin (-1); /* smallest positive number is 0.5*2^emin = 0.25 */ mpc_init2 (z, 10); - mpfr_set_ui_2exp (mpc_realref (z), 1023, -11, GMP_RNDN); /* exact */ - mpfr_set_ui_2exp (mpc_imagref (z), 1023, -11, GMP_RNDN); /* exact */ + mpfr_set_ui_2exp (mpc_realref (z), 1023, -11, MPFR_RNDN); /* exact */ + mpfr_set_ui_2exp (mpc_imagref (z), 1023, -11, MPFR_RNDN); /* exact */ mpfr_init2 (f, 10); - inex = mpc_norm (f, z, GMP_RNDZ); /* should give 511/1024 */ + inex = mpc_norm (f, z, MPFR_RNDZ); /* should give 511/1024 */ if (inex >= 0) { printf ("Error in underflow case (1)\n"); @@ -47,12 +47,12 @@ test_underflow (void) printf ("got "); mpfr_dump (f); printf ("expected "); - mpfr_set_ui_2exp (f, 511, -10, GMP_RNDZ); + mpfr_set_ui_2exp (f, 511, -10, MPFR_RNDZ); mpfr_dump (f); exit (1); } - inex = mpc_norm (f, z, GMP_RNDN); /* should give 511/1024 */ + inex = mpc_norm (f, z, MPFR_RNDN); /* should give 511/1024 */ if (inex >= 0) { printf ("Error in underflow case (2)\n"); @@ -65,12 +65,12 @@ test_underflow (void) printf ("got "); mpfr_dump (f); printf ("expected "); - mpfr_set_ui_2exp (f, 511, -10, GMP_RNDZ); + mpfr_set_ui_2exp (f, 511, -10, MPFR_RNDZ); mpfr_dump (f); exit (1); } - inex = mpc_norm (f, z, GMP_RNDU); /* should give 1023/2048 */ + inex = mpc_norm (f, z, MPFR_RNDU); /* should give 1023/2048 */ if (inex <= 0) { printf ("Error in underflow case (3)\n"); @@ -83,7 +83,7 @@ test_underflow (void) printf ("got "); mpfr_dump (f); printf ("expected "); - mpfr_set_ui_2exp (f, 1023, -11, GMP_RNDZ); + mpfr_set_ui_2exp (f, 1023, -11, MPFR_RNDZ); mpfr_dump (f); exit (1); } diff --git a/tests/tpow.c b/tests/tpow.c index 3592209..31ac1ca 100644 --- a/tests/tpow.c +++ b/tests/tpow.c @@ -1,6 +1,6 @@ /* tpow -- test file for mpc_pow. -Copyright (C) 2009, 2011 INRIA +Copyright (C) 2009, 2011, 2012 INRIA This file is part of GNU MPC. @@ -34,8 +34,8 @@ reuse_bug (void) mpc_init2 (y, prec); mpc_init2 (z, prec); - mpfr_set_ui (mpc_realref (x), 0ul, GMP_RNDN); - mpfr_set_ui_2exp (mpc_imagref (x), 3ul, -2, GMP_RNDN); + mpfr_set_ui (mpc_realref (x), 0ul, MPFR_RNDN); + mpfr_set_ui_2exp (mpc_imagref (x), 3ul, -2, MPFR_RNDN); mpc_set_ui (y, 8ul, MPC_RNDNN); mpc_pow (z, x, y, MPC_RNDNN); diff --git a/tests/tpow_fr.c b/tests/tpow_fr.c index 2b0dc29..99274af 100644 --- a/tests/tpow_fr.c +++ b/tests/tpow_fr.c @@ -1,6 +1,6 @@ /* tpow_fr -- test file for mpc_pow_fr. -Copyright (C) 2009, 2011 INRIA +Copyright (C) 2009, 2011, 2012 INRIA This file is part of GNU MPC. @@ -30,9 +30,9 @@ test_reuse (void) mpfr_init2 (y, 2); mpc_init2 (z, 2); mpc_set_si_si (z, 0, -1, MPC_RNDNN); - mpfr_neg (mpc_realref (z), mpc_realref (z), GMP_RNDN); - mpc_div_2exp (z, z, 4, MPC_RNDNN); - mpfr_set_ui (y, 512, GMP_RNDN); + mpfr_neg (mpc_realref (z), mpc_realref (z), MPFR_RNDN); + mpc_div_2ui (z, z, 4, MPC_RNDNN); + mpfr_set_ui (y, 512, MPFR_RNDN); inex = mpc_pow_fr (z, z, y, MPC_RNDNN); if (MPC_INEX_RE(inex) != 0 || MPC_INEX_IM(inex) != 0 || mpfr_cmp_ui_2exp (mpc_realref(z), 1, -2048) != 0 || diff --git a/tests/tpow_ui.c b/tests/tpow_ui.c index 4e8cd31..1c7cc6b 100644 --- a/tests/tpow_ui.c +++ b/tests/tpow_ui.c @@ -1,6 +1,6 @@ /* tpow_ui -- test file for mpc_pow_ui. -Copyright (C) 2009, 2010 INRIA +Copyright (C) 2009, 2010, 2012 INRIA This file is part of GNU MPC. @@ -97,9 +97,9 @@ main (int argc, char *argv[]) MPC_ASSERT (k >= 0); mpc_init2 (z, p); mpc_init2 (res, p); - mpfr_const_pi (mpc_realref (z), GMP_RNDN); - mpfr_div_2exp (mpc_realref (z), mpc_realref (z), 2, GMP_RNDN); - mpfr_const_log2 (mpc_imagref (z), GMP_RNDN); + mpfr_const_pi (mpc_realref (z), MPFR_RNDN); + mpfr_div_2exp (mpc_realref (z), mpc_realref (z), 2, MPFR_RNDN); + mpfr_const_log2 (mpc_imagref (z), MPFR_RNDN); while (k--) mpc_pow_ui (res, z, (unsigned long int) n, MPC_RNDNN); mpc_clear (z); diff --git a/tests/treimref.c b/tests/treimref.c index 230d34c..9d3c75c 100644 --- a/tests/treimref.c +++ b/tests/treimref.c @@ -1,6 +1,6 @@ /* treimref -- test file for mpc_realref and mpc_imagref. -Copyright (C) 2009 INRIA +Copyright (C) 2009, 2012 INRIA This file is part of GNU MPC. @@ -30,14 +30,14 @@ main (void) mpc_init2 (z, 6); mpc_set_ui_ui (z, 17, 42, MPC_RNDNN); - mpfr_set_ui (mpc_realref (z), 18, GMP_RNDN); - if (mpfr_get_ui (mpc_realref (z), GMP_RNDN) != 18) + mpfr_set_ui (mpc_realref (z), 18, MPFR_RNDN); + if (mpfr_get_ui (mpc_realref (z), MPFR_RNDN) != 18) { fprintf (stderr, "Error in mpfr_set_ui/mpc_realref\n"); exit (1); } - mpfr_set_ui (mpc_imagref (z), 43, GMP_RNDN); - if (mpfr_get_ui (mpc_imagref (z), GMP_RNDN) != 43) + mpfr_set_ui (mpc_imagref (z), 43, MPFR_RNDN); + if (mpfr_get_ui (mpc_imagref (z), MPFR_RNDN) != 43) { fprintf (stderr, "Error in mpfr_set_ui/mpc_imagref\n"); exit (1); diff --git a/tests/tset.c b/tests/tset.c index 0049436..27ea0b3 100644 --- a/tests/tset.c +++ b/tests/tset.c @@ -1,6 +1,6 @@ /* tset -- Test file for mpc_set_x and mpc_set_x_x functions. -Copyright (C) 2009, 2010, 2011 INRIA +Copyright (C) 2009, 2010, 2011, 2012 INRIA This file is part of GNU MPC. @@ -92,7 +92,7 @@ check_set (void) lo = -prec; - mpfr_set_d (fr, 1.23456789, GMP_RNDN); + mpfr_set_d (fr, 1.23456789, MPFR_RNDN); mpc_set_d (z, 1.23456789, MPC_RNDNN); if (mpfr_cmp (mpc_realref(z), fr) != 0 || mpfr_cmp_si (mpc_imagref(z), 0) != 0) @@ -117,7 +117,7 @@ check_set (void) if (mpfr_cmp_si (mpc_realref(z), lo) != 0 || mpfr_cmp_ui (mpc_imagref(z), 0) != 0) PRINT_ERROR ("mpc_set_si", prec, z); - mpfr_set_ld (fr, 1.23456789L, GMP_RNDN); + mpfr_set_ld (fr, 1.23456789L, MPFR_RNDN); mpc_set_ld_ld (z, 1.23456789L, 1.23456789L, MPC_RNDNN); if (mpfr_cmp (mpc_realref(z), fr) != 0 || mpfr_cmp (mpc_imagref(z), fr) != 0) @@ -141,10 +141,10 @@ check_set (void) PRINT_ERROR ("mpc_set_ld", prec, z); mpc_set_prec (x, prec); - mpfr_set_ui(fr, 1, GMP_RNDN); - mpfr_div_ui(fr, fr, 3, GMP_RNDN); - mpfr_set(mpc_realref(x), fr, GMP_RNDN); - mpfr_set(mpc_imagref(x), fr, GMP_RNDN); + mpfr_set_ui(fr, 1, MPFR_RNDN); + mpfr_div_ui(fr, fr, 3, MPFR_RNDN); + mpfr_set(mpc_realref(x), fr, MPFR_RNDN); + mpfr_set(mpc_imagref(x), fr, MPFR_RNDN); mpc_set (z, x, MPC_RNDNN); mpfr_clear_flags (); /* mpc_cmp set erange flag when an operand is a @@ -170,7 +170,7 @@ check_set (void) || mpfr_erangeflag_p()) PRINT_ERROR ("mpc_set_fr", prec, z); - mpfr_set_z (fr, mpz, GMP_RNDN); + mpfr_set_z (fr, mpz, MPFR_RNDN); mpc_set_z_z (z, mpz, mpz, MPC_RNDNN); mpfr_clear_flags (); if (mpfr_cmp (mpc_realref(z), fr) != 0 @@ -192,7 +192,7 @@ check_set (void) || mpfr_erangeflag_p()) PRINT_ERROR ("mpc_set_z", prec, z); - mpfr_set_q (fr, mpq, GMP_RNDN); + mpfr_set_q (fr, mpq, MPFR_RNDN); mpc_set_q_q (z, mpq, mpq, MPC_RNDNN); mpfr_clear_flags (); if (mpfr_cmp (mpc_realref(z), fr) != 0 @@ -221,7 +221,7 @@ check_set (void) || mpfr_erangeflag_p()) PRINT_ERROR ("mpc_set_q", prec, z); - mpfr_set_f (fr, mpf, GMP_RNDN); + mpfr_set_f (fr, mpf, MPFR_RNDN); mpc_set_f_f (z, mpf, mpf, MPC_RNDNN); mpfr_clear_flags (); if (mpfr_cmp (mpc_realref(z), fr) != 0 @@ -277,13 +277,13 @@ check_set (void) im = 2 * im * im + 4 * im + 1; /* gives 2^(2n-1)-1 from 2^(n-1)-1 */ mpc_set_sj (z, im, MPC_RNDNN); - if (mpfr_get_sj (mpc_realref(z), GMP_RNDN) != im || + if (mpfr_get_sj (mpc_realref(z), MPFR_RNDN) != im || mpfr_cmp_ui (mpc_imagref(z), 0) != 0) PRINT_ERROR ("mpc_set_sj (2)", im, z); mpc_set_sj_sj (z, im, im, MPC_RNDNN); - if (mpfr_get_sj (mpc_realref(z), GMP_RNDN) != im || - mpfr_get_sj (mpc_imagref(z), GMP_RNDN) != im) + if (mpfr_get_sj (mpc_realref(z), MPFR_RNDN) != im || + mpfr_get_sj (mpc_imagref(z), MPFR_RNDN) != im) PRINT_ERROR ("mpc_set_sj_sj (2)", im, z); } #endif /* _MPC_H_HAVE_INTMAX_T */ @@ -408,7 +408,7 @@ check_set_str (mpfr_exp_t exp_max) /* the real part has a zero exponent in base ten (fixed in r439) */ mpc_set_prec (expected, 37); mpc_set_prec (got, 37); - mpc_set_str (expected, "921FC04EDp-35 ", 16, GMP_RNDN); + mpc_set_str (expected, "921FC04EDp-35 ", 16, MPFR_RNDN); str = mpc_get_str (10, 0, expected, MPC_RNDNN); if (mpc_set_str (got, str, 10, MPC_RNDNN) == -1 || mpc_cmp (got, expected) != 0) diff --git a/tests/tsqr.c b/tests/tsqr.c index 02fea7e..2ec2099 100644 --- a/tests/tsqr.c +++ b/tests/tsqr.c @@ -1,6 +1,6 @@ /* tsqr -- test file for mpc_sqr. -Copyright (C) 2002, 2005, 2008, 2010, 2011 INRIA +Copyright (C) 2002, 2005, 2008, 2010, 2011, 2012 INRIA This file is part of GNU MPC. @@ -148,9 +148,9 @@ reuse_bug (void) /* reuse bug found by Paul Zimmermann 20081021 */ mpc_init2 (z1, 2); /* RE (z1^2) overflows, IM(z^2) = -0 */ - mpfr_set_str (mpc_realref (z1), "0.11", 2, GMP_RNDN); - mpfr_mul_2si (mpc_realref (z1), mpc_realref (z1), mpfr_get_emax (), GMP_RNDN); - mpfr_set_ui (mpc_imagref (z1), 0, GMP_RNDN); + mpfr_set_str (mpc_realref (z1), "0.11", 2, MPFR_RNDN); + mpfr_mul_2si (mpc_realref (z1), mpc_realref (z1), mpfr_get_emax (), MPFR_RNDN); + mpfr_set_ui (mpc_imagref (z1), 0, MPFR_RNDN); mpc_conj (z1, z1, MPC_RNDNN); mpc_sqr (z1, z1, MPC_RNDNN); if (!mpfr_inf_p (mpc_realref (z1)) || mpfr_signbit (mpc_realref (z1)) diff --git a/tests/ttan.c b/tests/ttan.c index f1d826a..c7c672c 100644 --- a/tests/ttan.c +++ b/tests/ttan.c @@ -1,6 +1,6 @@ /* ttan -- test file for mpc_tan. -Copyright (C) 2008, 2011 INRIA +Copyright (C) 2008, 2011, 2012 INRIA This file is part of GNU MPC. @@ -38,8 +38,8 @@ pure_real_argument (void) /* tan(1 +i*0) = tan(1) +i*0 */ mpc_set_ui_ui (z, 1, 0, MPC_RNDNN); - mpfr_set_ui (x, 1, GMP_RNDN); - mpfr_tan (tan_x, x, GMP_RNDN); + mpfr_set_ui (x, 1, MPFR_RNDN); + mpfr_tan (tan_x, x, MPFR_RNDN); mpc_tan (tan_z, z, MPC_RNDNN); if (mpfr_cmp (mpc_realref (tan_z), tan_x) != 0 || !mpfr_zero_p (mpc_imagref (tan_z)) || mpfr_signbit (mpc_imagref (tan_z))) @@ -59,11 +59,11 @@ pure_real_argument (void) } /* tan(Pi/2 +i*0) = +Inf +i*0 */ - mpfr_const_pi (x, GMP_RNDN); - mpfr_div_2ui (x, x, 1, GMP_RNDN); - mpfr_set (mpc_realref (z), x, GMP_RNDN); - mpfr_set_ui (mpc_imagref (z), 0, GMP_RNDN); - mpfr_tan (tan_x, x, GMP_RNDN); + mpfr_const_pi (x, MPFR_RNDN); + mpfr_div_2ui (x, x, 1, MPFR_RNDN); + mpfr_set (mpc_realref (z), x, MPFR_RNDN); + mpfr_set_ui (mpc_imagref (z), 0, MPFR_RNDN); + mpfr_tan (tan_x, x, MPFR_RNDN); mpc_tan (tan_z, z, MPC_RNDNN); if (mpfr_cmp (mpc_realref (tan_z), tan_x) != 0 || !mpfr_zero_p (mpc_imagref (tan_z)) || mpfr_signbit (mpc_imagref (tan_z))) @@ -83,9 +83,9 @@ pure_real_argument (void) } /* tan(-Pi/2 +i*0) = -Inf +i*0 */ - mpfr_neg (x, x, GMP_RNDN); + mpfr_neg (x, x, MPFR_RNDN); mpc_neg (z, z, MPC_RNDNN); - mpfr_tan (tan_x, x, GMP_RNDN); + mpfr_tan (tan_x, x, MPFR_RNDN); mpc_tan (tan_z, z, MPC_RNDNN); if (mpfr_cmp (mpc_realref (tan_z), tan_x) != 0 || !mpfr_zero_p (mpc_imagref (tan_z)) || mpfr_signbit (mpc_imagref (tan_z))) @@ -128,8 +128,8 @@ pure_imaginary_argument (void) /* tan(0 +i) = +0 +i*tanh(1) */ mpc_set_ui_ui (z, 0, 1, MPC_RNDNN); - mpfr_set_ui (y, 1, GMP_RNDN); - mpfr_tanh (tanh_y, y, GMP_RNDN); + mpfr_set_ui (y, 1, MPFR_RNDN); + mpfr_tanh (tanh_y, y, MPFR_RNDN); mpc_tan (tan_z, z, MPC_RNDNN); if (mpfr_cmp (mpc_imagref (tan_z), tanh_y) != 0 || !mpfr_zero_p (mpc_realref (tan_z)) || mpfr_signbit (mpc_realref (tan_z))) @@ -137,15 +137,15 @@ pure_imaginary_argument (void) mpc_t c99; mpc_init2 (c99, prec); - mpfr_set_ui (mpc_realref (c99), 0, GMP_RNDN); - mpfr_set (mpc_imagref (c99), tanh_y, GMP_RNDN); + mpfr_set_ui (mpc_realref (c99), 0, MPFR_RNDN); + mpfr_set (mpc_imagref (c99), tanh_y, MPFR_RNDN); TEST_FAILED ("mpc_tan", z, tan_z, c99, MPC_RNDNN); } /* tan(0 -i) = +0 +i*tanh(-1) */ mpc_conj (z, z, MPC_RNDNN); - mpfr_neg (tanh_y, tanh_y, GMP_RNDN); + mpfr_neg (tanh_y, tanh_y, MPFR_RNDN); mpc_tan (tan_z, z, MPC_RNDNN); if (mpfr_cmp (mpc_imagref (tan_z), tanh_y) != 0 || !mpfr_zero_p (mpc_realref (tan_z)) || mpfr_signbit (mpc_realref (tan_z))) @@ -153,15 +153,15 @@ pure_imaginary_argument (void) mpc_t c99; mpc_init2 (c99, prec); - mpfr_set_ui (mpc_realref (c99), 0, GMP_RNDN); - mpfr_set (mpc_imagref (c99), tanh_y, GMP_RNDN); + mpfr_set_ui (mpc_realref (c99), 0, MPFR_RNDN); + mpfr_set (mpc_imagref (c99), tanh_y, MPFR_RNDN); TEST_FAILED ("mpc_tan", z, tan_z, c99, MPC_RNDNN); } /* tan(-0 +i) = -0 +i*tanh(1) */ mpc_neg (z, z, MPC_RNDNN); - mpfr_neg (tanh_y, tanh_y, GMP_RNDN); + mpfr_neg (tanh_y, tanh_y, MPFR_RNDN); mpc_tan (tan_z, z, MPC_RNDNN); if (mpfr_cmp (mpc_imagref (tan_z), tanh_y) != 0 || !mpfr_zero_p (mpc_realref (tan_z)) || !mpfr_signbit (mpc_realref (tan_z))) @@ -169,15 +169,15 @@ pure_imaginary_argument (void) mpc_t c99; mpc_init2 (c99, prec); - mpfr_set_ui (mpc_realref (c99), 0, GMP_RNDN); - mpfr_set (mpc_imagref (c99), tanh_y, GMP_RNDN); + mpfr_set_ui (mpc_realref (c99), 0, MPFR_RNDN); + mpfr_set (mpc_imagref (c99), tanh_y, MPFR_RNDN); TEST_FAILED ("mpc_tan", z, tan_z, c99, MPC_RNDNN); } /* tan(-0 -i) = -0 +i*tanh(-1) */ mpc_conj (z, z, MPC_RNDNN); - mpfr_neg (tanh_y, tanh_y, GMP_RNDN); + mpfr_neg (tanh_y, tanh_y, MPFR_RNDN); mpc_tan (tan_z, z, MPC_RNDNN); if (mpfr_cmp (mpc_imagref (tan_z), tanh_y) != 0 || !mpfr_zero_p (mpc_realref (tan_z)) || !mpfr_signbit (mpc_realref (tan_z))) @@ -185,8 +185,8 @@ pure_imaginary_argument (void) mpc_t c99; mpc_init2 (c99, prec); - mpfr_set_ui (mpc_realref (c99), 0, GMP_RNDN); - mpfr_set (mpc_imagref (c99), tanh_y, GMP_RNDN); + mpfr_set_ui (mpc_realref (c99), 0, MPFR_RNDN); + mpfr_set (mpc_imagref (c99), tanh_y, MPFR_RNDN); TEST_FAILED ("mpc_tan", z, tan_z, c99, MPC_RNDNN); } diff --git a/tests/tui_div.c b/tests/tui_div.c index c109189..40c740a 100644 --- a/tests/tui_div.c +++ b/tests/tui_div.c @@ -1,6 +1,6 @@ /* tui_div -- test file for mpc_ui_div. -Copyright (C) 2008, 2011 INRIA +Copyright (C) 2008, 2011, 2012 INRIA This file is part of GNU MPC. @@ -41,8 +41,8 @@ special (void) } /* 0/(-1-0*I) should give (-0, +0) */ - mpfr_set_str (mpc_realref(a), "-1", 10, GMP_RNDN); - mpfr_set_str (mpc_imagref(a), "-0", 10, GMP_RNDN); + mpfr_set_str (mpc_realref(a), "-1", 10, MPFR_RNDN); + mpfr_set_str (mpc_imagref(a), "-0", 10, MPFR_RNDN); mpc_ui_div (b, 0, a, MPC_RNDNN); if ((mpc_cmp_si_si (b, 0, 0) != 0) || (MPFR_SIGN (mpc_realref(b)) > 0) || (MPFR_SIGN (mpc_imagref(b)) < 0)) |