diff options
author | enge <enge@211d60ee-9f03-0410-a15a-8952a2c7a4e4> | 2011-09-01 18:58:30 +0000 |
---|---|---|
committer | enge <enge@211d60ee-9f03-0410-a15a-8952a2c7a4e4> | 2011-09-01 18:58:30 +0000 |
commit | c99f17f4fb8f05d49ab428cea31faae3aead882d (patch) | |
tree | 62feb628a1c4888ade6f75364ab0d5bb1b97fed2 /tests/tdiv.c | |
parent | 4cbb8daab4917d6edc7da0ed175e1bd29f351ca5 (diff) | |
download | mpc-c99f17f4fb8f05d49ab428cea31faae3aead882d.tar.gz |
tdiv.c, div.dat: moved tests to data file
exposes a sign bug in mpc_div
read_data.c: corrected undocumented assumption on mpfr_signbit
git-svn-id: svn://scm.gforge.inria.fr/svn/mpc/trunk@1064 211d60ee-9f03-0410-a15a-8952a2c7a4e4
Diffstat (limited to 'tests/tdiv.c')
-rw-r--r-- | tests/tdiv.c | 91 |
1 files changed, 0 insertions, 91 deletions
diff --git a/tests/tdiv.c b/tests/tdiv.c index 7a5e563..3b8340f 100644 --- a/tests/tdiv.c +++ b/tests/tdiv.c @@ -21,95 +21,6 @@ along with this program. If not, see http://www.gnu.org/licenses/ . #include <stdlib.h> #include "mpc-tests.h" -static void -check_regular (void) -{ - mpc_t b, c, q; - int inex; - - mpc_init2 (b, 10); - mpc_init2 (c, 10); - mpc_init2 (q, 10); - - /* inexact result */ - mpc_set_ui_ui (b, 973, 964, MPC_RNDNN); - mpc_set_ui_ui (c, 725, 745, MPC_RNDNN); - inex = mpc_div (q, b, c, MPC_RNDZZ); - mpc_set_si_si (b, 43136, -787, MPC_RNDNN); - mpc_div_2exp (b, b, 15, MPC_RNDNN); - if (mpc_cmp (q, b) || MPC_INEX_RE (inex) == 0 || MPC_INEX_IM (inex) == 0) - { - printf ("mpc_div failed for (973+I*964)/(725+I*745)\n"); - exit (1); - } - - /* exact result */ - mpc_set_si_si (b, -837, 637, MPC_RNDNN); - mpc_set_si_si (c, 63, -5, MPC_RNDNN); - inex = mpc_div (q, b, c, MPC_RNDZN); - mpc_set_si_si (b, -14, 9, MPC_RNDNN); - if (mpc_cmp (q, b) || inex != 0) - { - printf ("mpc_div failed for (-837+I*637)/(63-I*5)\n"); - exit (1); - } - - mpc_set_prec (b, 2); - mpc_set_prec (c, 2); - mpc_set_prec (q, 2); - - /* exact result */ - mpc_set_ui_ui (b, 4, 3, MPC_RNDNN); - mpc_set_ui_ui (c, 1, 2, MPC_RNDNN); - inex = mpc_div (q, b, c, MPC_RNDNN); - mpc_set_si_si (b, 2, -1, MPC_RNDNN); - if (mpc_cmp (q, b) || inex != 0) - { - printf ("mpc_div failed for (4+I*3)/(1+I*2)\n"); - exit (1); - } - - /* pure real dividend BUG-20080923 */ - mpc_set_prec (b, 4); - mpc_set_prec (c, 4); - mpc_set_prec (q, 4); - - mpc_set_si_si (b, -3, 0, MPC_RNDNN); - mpc_div_2exp (b, b, 206, MPC_RNDNN); - mpc_set_si_si (c, -1, -5, MPC_RNDNN); - mpfr_div_2ui (MPC_RE (c), MPC_RE (c), 733, GMP_RNDN); - mpfr_div_2ui (MPC_IM (c), MPC_IM (c), 1750, GMP_RNDN); - inex = mpc_div (q, b, c, MPC_RNDNZ); - mpc_set_si_si (b, 3, -7, MPC_RNDNN); - mpfr_mul_2ui (MPC_RE (b), MPC_RE (b), 527, GMP_RNDN); - mpfr_div_2ui (MPC_IM (b), MPC_IM (b), 489, GMP_RNDN); - - if (mpc_cmp (q, b)) - { - printf ("mpc_div failed for -3p-206/(-1p-733 -I* 5p-1750)\n"); - exit (1); - } - - /* pure real divisor */ - mpc_set_prec (b, 4); - mpc_set_prec (c, 4); - mpc_set_prec (q, 4); - mpc_set_si_si (b, 15, 14, MPC_RNDNN); - mpc_set_si_si (c, 11, 0, MPC_RNDNN); - inex = mpc_div (q, b, c, MPC_RNDNN); /* should be 11/8 + 5/4*I */ - mpc_set_si_si (b, 11, 10, MPC_RNDNN); - mpc_div_ui (b, b, 8, MPC_RNDNN); - if (mpc_cmp (q, b) || inex != MPC_INEX(1, -1)) - { - printf ("mpc_div failed for (15+14*I)/11\n"); - exit (1); - } - - mpc_clear (b); - mpc_clear (c); - mpc_clear (q); -} - int main (void) { @@ -117,8 +28,6 @@ main (void) test_start (); - check_regular (); - data_check (f, "div.dat"); tgeneric (f, 2, 1024, 7, 4096); |