summaryrefslogtreecommitdiff
path: root/tests/tmul.c
diff options
context:
space:
mode:
authorAndreas Enge <andreas.enge@inria.fr>2012-06-26 15:32:47 +0000
committerAndreas Enge <andreas.enge@inria.fr>2012-06-26 15:32:47 +0000
commitf2a7ff458318b4c3d64389e8fba858832ac505ee (patch)
tree044058c0616949f9e5ec33fbc90e9e043c6f65c1 /tests/tmul.c
parenta75d8173859b141b46d60a80f29f4973edf46b34 (diff)
downloadmpc-git-f2a7ff458318b4c3d64389e8fba858832ac505ee.tar.gz
tmul.c: shortened test output using more recent macros
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/mpc/trunk@1169 211d60ee-9f03-0410-a15a-8952a2c7a4e4
Diffstat (limited to 'tests/tmul.c')
-rw-r--r--tests/tmul.c54
1 files changed, 19 insertions, 35 deletions
diff --git a/tests/tmul.c b/tests/tmul.c
index 0f184cd..d83fca0 100644
--- a/tests/tmul.c
+++ b/tests/tmul.c
@@ -33,48 +33,32 @@ cmpmul (mpc_srcptr x, mpc_srcptr y, mpc_rnd_t rnd)
/* all have the same precision, and we use this precision also for the */
/* result. */
{
- mpc_t z, t;
- int inexact_z, inexact_t;
+ mpc_t z, t;
+ int inex_z, inex_t;
- mpc_init2 (z, MPC_MAX_PREC (x));
- mpc_init2 (t, MPC_MAX_PREC (x));
+ mpc_init2 (z, MPC_MAX_PREC (x));
+ mpc_init2 (t, MPC_MAX_PREC (x));
- inexact_z = mpc_mul_naive (z, x, y, rnd);
- inexact_t = mpc_mul_karatsuba (t, x, y, rnd);
+ inex_z = mpc_mul_naive (z, x, y, rnd);
+ inex_t = mpc_mul_karatsuba (t, x, y, rnd);
- if (mpc_cmp (z, t))
- {
- fprintf (stderr, "mul and mul2 differ for rnd=(%s,%s)\nx=",
- mpfr_print_rnd_mode(MPC_RND_RE(rnd)),
- mpfr_print_rnd_mode(MPC_RND_IM(rnd)));
- mpc_out_str (stderr, 2, 0, x, MPC_RNDNN);
- fprintf (stderr, "\ny=");
- mpc_out_str (stderr, 2, 0, y, MPC_RNDNN);
- fprintf (stderr, "\nmpc_mul_naive gives ");
- mpc_out_str (stderr, 2, 0, z, MPC_RNDNN);
- fprintf (stderr, "\nmpc_mul_karatsuba gives ");
- mpc_out_str (stderr, 2, 0, t, MPC_RNDNN);
- fprintf (stderr, "\n");
- exit (1);
- }
- if (inexact_z != inexact_t)
- {
- fprintf (stderr, "The return values of mul and mul2 differ for rnd=(%s,%s) \nx=",
+ if (mpc_cmp (z, t) != 0 || inex_z != inex_t) {
+ fprintf (stderr, "mul_naive and mul_karatsuba differ for rnd=(%s,%s)\n",
mpfr_print_rnd_mode(MPC_RND_RE(rnd)),
mpfr_print_rnd_mode(MPC_RND_IM(rnd)));
- mpc_out_str (stderr, 2, 0, x, MPC_RNDNN);
- fprintf (stderr, "\nand y=");
- mpc_out_str (stderr, 2, 0, y, MPC_RNDNN);
- fprintf (stderr, "\nand x*y=");
- mpc_out_str (stderr, 2, 0, z, MPC_RNDNN);
- fprintf (stderr, "\nmpc_mul_naive gives %i", inexact_z);
- fprintf (stderr, "\nmpc_mul_karatsuba gives %i", inexact_t);
- fprintf (stderr, "\n");
+ MPC_OUT (x);
+ MPC_OUT (y);
+ MPC_OUT (z);
+ MPC_OUT (t);
+ if (inex_z != inex_t) {
+ fprintf (stderr, "inex_re (z): %s\n", MPC_INEX_STR (inex_z));
+ fprintf (stderr, "inex_re (t): %s\n", MPC_INEX_STR (inex_t));
+ }
exit (1);
- }
+ }
- mpc_clear (z);
- mpc_clear (t);
+ mpc_clear (z);
+ mpc_clear (t);
}