diff options
author | thevenyp <thevenyp@211d60ee-9f03-0410-a15a-8952a2c7a4e4> | 2008-04-10 08:19:24 +0000 |
---|---|---|
committer | thevenyp <thevenyp@211d60ee-9f03-0410-a15a-8952a2c7a4e4> | 2008-04-10 08:19:24 +0000 |
commit | 0c8ffbce13813797dd93e6460cb6419bb5ad0346 (patch) | |
tree | 020273a125911c9a60cf3afbc526608c8aacb313 /tests/tsqr.c | |
parent | b4d54b4e2252e80de74c5c06562c05866ea538f5 (diff) | |
download | mpc-0c8ffbce13813797dd93e6460cb6419bb5ad0346.tar.gz |
Cosmetic changes: no tab, no trailing white spaces, and new indentation.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpc/trunk@93 211d60ee-9f03-0410-a15a-8952a2c7a4e4
Diffstat (limited to 'tests/tsqr.c')
-rw-r--r-- | tests/tsqr.c | 114 |
1 files changed, 57 insertions, 57 deletions
diff --git a/tests/tsqr.c b/tests/tsqr.c index 470680e..e80d903 100644 --- a/tests/tsqr.c +++ b/tests/tsqr.c @@ -44,18 +44,18 @@ void cmpsqr (mpc_srcptr x, mpc_rnd_t rnd) /* algorithm might still be wrong, though, since there are two */ /* consecutive roundings. */ { - mpc_t z, t, u; - int inexact_z, inexact_t; + mpc_t z, t, u; + int inexact_z, inexact_t; - mpc_init2 (z, MPC_MAX_PREC (x)); - mpc_init2 (t, MPC_MAX_PREC (x)); - mpc_init2 (u, 4 * MPC_MAX_PREC (x)); + mpc_init2 (z, MPC_MAX_PREC (x)); + mpc_init2 (t, MPC_MAX_PREC (x)); + mpc_init2 (u, 4 * MPC_MAX_PREC (x)); - inexact_z = mpc_sqr (z, x, rnd); - inexact_t = mpc_mul (t, x, x, rnd); + inexact_z = mpc_sqr (z, x, rnd); + inexact_t = mpc_mul (t, x, x, rnd); - if (mpc_cmp (z, t)) - { + if (mpc_cmp (z, t)) + { fprintf (stderr, "sqr and mul differ for rnd=(%s,%s) \nx=", mpfr_print_rnd_mode(MPC_RND_RE(rnd)), mpfr_print_rnd_mode(MPC_RND_IM(rnd))); @@ -66,25 +66,25 @@ void cmpsqr (mpc_srcptr x, mpc_rnd_t rnd) 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 sqr and mul 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, "\nx^2="); - mpc_out_str (stderr, 2, 0, z, MPC_RNDNN); - fprintf (stderr, "\nmpc_sqr gives %i", inexact_z); - fprintf (stderr, "\nmpc_mul gives %i", inexact_t); - fprintf (stderr, "\n"); - exit (1); - } - - mpc_set (t, x, MPC_RNDNN); - inexact_t = mpc_sqr (t, t, rnd); - if (mpc_cmp (z, t)) - { + } + if (inexact_z != inexact_t) + { + fprintf (stderr, "The return values of sqr and mul 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, "\nx^2="); + mpc_out_str (stderr, 2, 0, z, MPC_RNDNN); + fprintf (stderr, "\nmpc_sqr gives %i", inexact_z); + fprintf (stderr, "\nmpc_mul gives %i", inexact_t); + fprintf (stderr, "\n"); + exit (1); + } + + mpc_set (t, x, MPC_RNDNN); + inexact_t = mpc_sqr (t, t, rnd); + if (mpc_cmp (z, t)) + { fprintf (stderr, "sqr and sqr in place differ for rnd=(%s,%s) \nx=", mpfr_print_rnd_mode(MPC_RND_RE(rnd)), mpfr_print_rnd_mode(MPC_RND_IM(rnd))); @@ -95,25 +95,25 @@ void cmpsqr (mpc_srcptr x, mpc_rnd_t rnd) 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 sqr and sqr in place 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, "\nx^2="); - mpc_out_str (stderr, 2, 0, z, MPC_RNDNN); - fprintf (stderr, "\nmpc_sqr gives %i", inexact_z); - fprintf (stderr, "\nmpc_sqr in place gives %i", inexact_t); - fprintf (stderr, "\n"); - exit (1); - } - - mpc_sqr (u, x, rnd); - mpc_set (t, u, rnd); - if (mpc_cmp (z, t)) - { + } + if (inexact_z != inexact_t) + { + fprintf (stderr, "The return values of sqr and sqr in place 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, "\nx^2="); + mpc_out_str (stderr, 2, 0, z, MPC_RNDNN); + fprintf (stderr, "\nmpc_sqr gives %i", inexact_z); + fprintf (stderr, "\nmpc_sqr in place gives %i", inexact_t); + fprintf (stderr, "\n"); + exit (1); + } + + mpc_sqr (u, x, rnd); + mpc_set (t, u, rnd); + if (mpc_cmp (z, t)) + { fprintf (stderr, "rounding in sqr might be incorrect for rnd=(%s,%s) \nx=", mpfr_print_rnd_mode(MPC_RND_RE(rnd)), mpfr_print_rnd_mode(MPC_RND_IM(rnd))); @@ -126,7 +126,7 @@ void cmpsqr (mpc_srcptr x, mpc_rnd_t rnd) mpc_out_str (stderr, 2, 0, t, MPC_RNDNN); fprintf (stderr, "\n"); exit (1); - } + } mpc_clear (z); mpc_clear (t); @@ -201,18 +201,18 @@ main() mpc_init (x); for (prec = 2; prec < 1000; prec++) - { - mpc_set_prec (x, prec); + { + mpc_set_prec (x, prec); - for (i = 0; i < 1000/prec; i++) - { - mpc_random (x); + for (i = 0; i < 1000/prec; i++) + { + mpc_random (x); - for (rnd_re = 0; rnd_re < 4; rnd_re ++) - for (rnd_im = 0; rnd_im < 4; rnd_im ++) + for (rnd_re = 0; rnd_re < 4; rnd_re ++) + for (rnd_im = 0; rnd_im < 4; rnd_im ++) cmpsqr (x, RNDC(rnd_re, rnd_im)); - } - } + } + } mpc_clear (x); |