diff options
-rw-r--r-- | src/mpc-impl.h | 17 | ||||
-rw-r--r-- | tests/mpc-tests.h | 41 |
2 files changed, 40 insertions, 18 deletions
diff --git a/src/mpc-impl.h b/src/mpc-impl.h index 89370e4..4d8aa58 100644 --- a/src/mpc-impl.h +++ b/src/mpc-impl.h @@ -122,23 +122,6 @@ __MPC_DECLSPEC int mpfr_regular_p __MPC_PROTO ((mpfr_srcptr)); /* Consider as NaN all other numbers containing at least one NaN */ -#define MPC_OUT(x) \ -do { \ - printf (#x "[%lu,%lu]=", (unsigned long int) MPC_PREC_RE (x), \ - (unsigned long int) MPC_PREC_IM (x)); \ - mpc_out_str (stdout, 2, 0, x, MPC_RNDNN); \ - printf ("\n"); \ -} while (0) - -#define MPFR_OUT(x) \ -do { \ - printf (#x "[%lu]=", (unsigned long int) mpfr_get_prec (x)); \ - mpfr_out_str (stdout, 2, 0, x, GMP_RNDN); \ - printf ("\n"); \ -} while (0) - - - /* * ASSERT macros */ diff --git a/tests/mpc-tests.h b/tests/mpc-tests.h index c0f7c46..664aa1b 100644 --- a/tests/mpc-tests.h +++ b/tests/mpc-tests.h @@ -21,10 +21,49 @@ along with this program. If not, see http://www.gnu.org/licenses/ . #ifndef __MPC_TESTS_H #define __MPC_TESTS_H +#include "config.h" #include <stdio.h> #include <ctype.h> +#include <stdlib.h> +#include "mpc.h" + +/* pieces copied from mpc-impl.h */ +#define MPC_PREC_RE(x) (mpfr_get_prec(mpc_realref(x))) +#define MPC_PREC_IM(x) (mpfr_get_prec(mpc_imagref(x))) +#define MPC_MAX_PREC(x) MPC_MAX(MPC_PREC_RE(x), MPC_PREC_IM(x)) +#define MPC_MAX(h,i) ((h) > (i) ? (h) : (i)) + +#define MPC_OUT(x) \ +do { \ + printf (#x "[%lu,%lu]=", (unsigned long int) MPC_PREC_RE (x), \ + (unsigned long int) MPC_PREC_IM (x)); \ + mpc_out_str (stdout, 2, 0, x, MPC_RNDNN); \ + printf ("\n"); \ +} while (0) + +#define MPFR_OUT(x) \ +do { \ + printf (#x "[%lu]=", (unsigned long int) mpfr_get_prec (x)); \ + mpfr_out_str (stdout, 2, 0, x, GMP_RNDN); \ + printf ("\n"); \ +} while (0) + +#define MPC_ASSERT(expr) \ + do { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: MPC assertion failed: %s\n", \ + __FILE__, __LINE__, #expr); \ + abort(); \ + } \ + } while (0) + +__MPC_DECLSPEC int mpc_mul_naive __MPC_PROTO ((mpc_ptr, mpc_srcptr, mpc_srcptr, mpc_rnd_t)); +__MPC_DECLSPEC int mpc_mul_karatsuba __MPC_PROTO ((mpc_ptr, mpc_srcptr, mpc_srcptr, mpc_rnd_t)); + + +/* end pieces copied from mpc-impl.h */ -#include "mpc-impl.h" #define MPC_INEX_STR(inex) \ (inex) == 0 ? "(0, 0)" \ |