diff options
author | thevenyp <thevenyp@211d60ee-9f03-0410-a15a-8952a2c7a4e4> | 2008-05-26 12:21:02 +0000 |
---|---|---|
committer | thevenyp <thevenyp@211d60ee-9f03-0410-a15a-8952a2c7a4e4> | 2008-05-26 12:21:02 +0000 |
commit | 6daf052b644c8fa78e5291eec466b13006d41eeb (patch) | |
tree | 999d84a3caa30d6b1f0afc7c634ef6ce6443287c /tests/tadd.c | |
parent | 1c1cac9dc968494fecc1483a87cea6be01c71bd7 (diff) | |
download | mpc-6daf052b644c8fa78e5291eec466b13006d41eeb.tar.gz |
test.c: Remove tests on arithmetic operations with two mpc_t.
tadd.c: Move ternary value tests from test.c.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpc/trunk@141 211d60ee-9f03-0410-a15a-8952a2c7a4e4
Diffstat (limited to 'tests/tadd.c')
-rw-r--r-- | tests/tadd.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/tadd.c b/tests/tadd.c index ccba956..9c3f3b8 100644 --- a/tests/tadd.c +++ b/tests/tadd.c @@ -26,9 +26,41 @@ MA 02111-1307, USA. */ #define TWOARGS #include "tgeneric.c" +static void +check_ternary_value () +{ + mpc_t x, y, z; + mp_prec_t prec; + + mpc_init (x); + mpc_init (y); + mpc_init2 (z, 2); + + for (prec = 2; prec <= 1000; prec++) + { + mpc_set_prec (x, prec); + mpc_set_prec (y, prec); + + mpc_set_ui (x, 1, MPC_RNDNN); + mpc_mul_2exp (x, x, prec, MPC_RNDNN); + mpc_set_ui (y, 1, MPC_RNDNN); + + if (mpc_add (z, x, y, MPC_RNDNN) == 0) + { + fprintf (stderr, "Error in mpc_add: 2^(-prec)+1 cannot be exact\n"); + exit (1); + } + } + + mpc_clear (x); + mpc_clear (y); + mpc_clear (z); +} + int main() { + check_ternary_value(); tgeneric (); return 0; |