diff options
Diffstat (limited to 'tests/read_data.c')
-rw-r--r-- | tests/read_data.c | 696 |
1 files changed, 1 insertions, 695 deletions
diff --git a/tests/read_data.c b/tests/read_data.c index 9447408..039c5a5 100644 --- a/tests/read_data.c +++ b/tests/read_data.c @@ -40,10 +40,7 @@ int nextchar; : (inex) == +1 ? "+1" \ : (inex) == -1 ? "-1" : "0" -static const char *mpfr_rnd_mode [] = - { "MPFR_RNDN", "MPFR_RNDZ", "MPFR_RNDU", "MPFR_RNDD" }; - -const char *rnd_mode[] = +const char *mpc_rnd_mode[] = { "MPC_RNDNN", "MPC_RNDZN", "MPC_RNDUN", "MPC_RNDDN", "undefined", "undefined", "undefined", "undefined", "undefined", "undefined", "undefined", "undefined", "undefined", "undefined", @@ -138,7 +135,6 @@ skip_whitespace_comments (FILE *fp) } } - size_t read_string (FILE *fp, char **buffer_ptr, size_t buffer_length, const char *name) { @@ -298,54 +294,6 @@ read_int (FILE *fp, int *nread, const char *name) skip_whitespace_comments (fp); } -static void -read_uint (FILE *fp, unsigned long int *ui) -{ - int n = 0; - - if (nextchar == EOF) - { - printf ("Error: Unexpected EOF when reading uint " - "in file '%s' line %lu\n", - pathname, line_number); - exit (1); - } - ungetc (nextchar, fp); - n = fscanf (fp, "%lu", ui); - if (ferror (fp) || n == 0 || n == EOF) - { - printf ("Error: Cannot read uint in file '%s' line %lu\n", - pathname, line_number); - exit (1); - } - nextchar = getc (fp); - skip_whitespace_comments (fp); -} - -static void -read_sint (FILE *fp, long int *si) -{ - int n = 0; - - if (nextchar == EOF) - { - printf ("Error: Unexpected EOF when reading sint " - "in file '%s' line %lu\n", - pathname, line_number); - exit (1); - } - ungetc (nextchar, fp); - n = fscanf (fp, "%li", si); - if (ferror (fp) || n == 0 || n == EOF) - { - printf ("Error: Cannot read sint in file '%s' line %lu\n", - pathname, line_number); - exit (1); - } - nextchar = getc (fp); - skip_whitespace_comments (fp); -} - mpfr_prec_t read_mpfr_prec (FILE *fp) { @@ -415,645 +363,3 @@ read_mpc (FILE *fp, mpc_ptr z, known_signs_t *ks) read_mpfr (fp, mpc_realref (z), ks == NULL ? NULL : &ks->re); read_mpfr (fp, mpc_imagref (z), ks == NULL ? NULL : &ks->im); } - -static void -check_compatible (int inex, mpfr_t expected, mpfr_rnd_t rnd, const char *s) -{ - if ((rnd == MPFR_RNDU && inex == -1) || - (rnd == MPFR_RNDD && inex == +1) || - (rnd == MPFR_RNDZ && !mpfr_signbit (expected) && inex == +1) || - (rnd == MPFR_RNDZ && mpfr_signbit (expected) && inex == -1)) - { - if (s != NULL) - printf ("Incompatible ternary value '%c' (%s part) in file '%s' line %lu\n", - (inex == 1) ? '+' : '-', s, pathname, test_line_number); - else - printf ("Incompatible ternary value '%c' in file '%s' line %lu\n", - (inex == 1) ? '+' : '-', pathname, test_line_number); - } -} - -/* read lines of data */ -static void -read_cc (FILE *fp, int *inex_re, int *inex_im, mpc_ptr expected, - known_signs_t *signs, mpc_ptr op, mpc_rnd_t *rnd) -{ - test_line_number = line_number; - read_ternary (fp, inex_re); - read_ternary (fp, inex_im); - read_mpc (fp, expected, signs); - read_mpc (fp, op, NULL); - read_mpc_rounding_mode (fp, rnd); - check_compatible (*inex_re, mpc_realref(expected), MPC_RND_RE(*rnd), "real"); - check_compatible (*inex_im, mpc_imagref(expected), MPC_RND_IM(*rnd), "imag"); -} - -static void -read_fc (FILE *fp, int *inex, mpfr_ptr expected, int *sign, mpc_ptr op, - mpfr_rnd_t *rnd) -{ - test_line_number = line_number; - read_ternary (fp, inex); - read_mpfr (fp, expected, sign); - read_mpc (fp, op, NULL); - read_mpfr_rounding_mode (fp, rnd); - check_compatible (*inex, expected, *rnd, NULL); -} - -static void -read_ccc (FILE *fp, int *inex_re, int *inex_im, mpc_ptr expected, - known_signs_t *signs, mpc_ptr op1, mpc_ptr op2, mpc_rnd_t *rnd) -{ - test_line_number = line_number; - read_ternary (fp, inex_re); - read_ternary (fp, inex_im); - read_mpc (fp, expected, signs); - read_mpc (fp, op1, NULL); - read_mpc (fp, op2, NULL); - read_mpc_rounding_mode (fp, rnd); - check_compatible (*inex_re, mpc_realref(expected), MPC_RND_RE(*rnd), "real"); - check_compatible (*inex_im, mpc_imagref(expected), MPC_RND_IM(*rnd), "imag"); -} - -/* read lines of data for function with three mpc_t inputs and one mpc_t - output like mpc_fma */ -static void -read_cccc (FILE *fp, int *inex_re, int *inex_im, mpc_ptr expected, - known_signs_t *signs, mpc_ptr op1, mpc_ptr op2, mpc_ptr op3, - mpc_rnd_t *rnd) -{ - test_line_number = line_number; - read_ternary (fp, inex_re); - read_ternary (fp, inex_im); - read_mpc (fp, expected, signs); - read_mpc (fp, op1, NULL); - read_mpc (fp, op2, NULL); - read_mpc (fp, op3, NULL); - read_mpc_rounding_mode (fp, rnd); - check_compatible (*inex_re, mpc_realref(expected), MPC_RND_RE(*rnd), "real"); - check_compatible (*inex_im, mpc_imagref(expected), MPC_RND_IM(*rnd), "imag"); -} - -static void -read_cfc (FILE *fp, int *inex_re, int *inex_im, mpc_ptr expected, - known_signs_t *signs, mpfr_ptr op1, mpc_ptr op2, mpc_rnd_t *rnd) -{ - test_line_number = line_number; - read_ternary (fp, inex_re); - read_ternary (fp, inex_im); - read_mpc (fp, expected, signs); - read_mpfr (fp, op1, NULL); - read_mpc (fp, op2, NULL); - read_mpc_rounding_mode (fp, rnd); - check_compatible (*inex_re, mpc_realref(expected), MPC_RND_RE(*rnd), "real"); - check_compatible (*inex_im, mpc_imagref(expected), MPC_RND_IM(*rnd), "imag"); -} - -static void -read_ccf (FILE *fp, int *inex_re, int *inex_im, mpc_ptr expected, - known_signs_t *signs, mpc_ptr op1, mpfr_ptr op2, mpc_rnd_t *rnd) -{ - test_line_number = line_number; - read_ternary (fp, inex_re); - read_ternary (fp, inex_im); - read_mpc (fp, expected, signs); - read_mpc (fp, op1, NULL); - read_mpfr (fp, op2, NULL); - read_mpc_rounding_mode (fp, rnd); - check_compatible (*inex_re, mpc_realref(expected), MPC_RND_RE(*rnd), "real"); - check_compatible (*inex_im, mpc_imagref(expected), MPC_RND_IM(*rnd), "imag"); -} - -static void -read_ccu (FILE *fp, int *inex_re, int *inex_im, mpc_ptr expected, - known_signs_t *signs, mpc_ptr op1, unsigned long int *op2, mpc_rnd_t *rnd) -{ - test_line_number = line_number; - read_ternary (fp, inex_re); - read_ternary (fp, inex_im); - read_mpc (fp, expected, signs); - read_mpc (fp, op1, NULL); - read_uint (fp, op2); - read_mpc_rounding_mode (fp, rnd); - check_compatible (*inex_re, mpc_realref(expected), MPC_RND_RE(*rnd), "real"); - check_compatible (*inex_im, mpc_imagref(expected), MPC_RND_IM(*rnd), "imag"); -} - -static void -read_ccs (FILE *fp, int *inex_re, int *inex_im, mpc_ptr expected, - known_signs_t *signs, mpc_ptr op1, long int *op2, mpc_rnd_t *rnd) -{ - test_line_number = line_number; - read_ternary (fp, inex_re); - read_ternary (fp, inex_im); - read_mpc (fp, expected, signs); - read_mpc (fp, op1, NULL); - read_sint (fp, op2); - read_mpc_rounding_mode (fp, rnd); - check_compatible (*inex_re, mpc_realref(expected), MPC_RND_RE(*rnd), "real"); - check_compatible (*inex_im, mpc_imagref(expected), MPC_RND_IM(*rnd), "imag"); -} - -/* set MPFR flags to random values */ -static void -set_mpfr_flags (int counter) -{ - if (counter & 1) - mpfr_set_underflow (); - else - mpfr_clear_underflow (); - if (counter & 2) - mpfr_set_overflow (); - else - mpfr_clear_overflow (); - /* the divide-by-0 flag was added in MPFR 3.1.0 */ -#ifdef mpfr_set_divby0 - if (counter & 4) - mpfr_set_divby0 (); - else - mpfr_clear_divby0 (); -#endif - if (counter & 8) - mpfr_set_nanflag (); - else - mpfr_clear_nanflag (); - if (counter & 16) - mpfr_set_inexflag (); - else - mpfr_clear_inexflag (); - if (counter & 32) - mpfr_set_erangeflag (); - else - mpfr_clear_erangeflag (); -} - -/* Check MPFR flags: we allow that some flags are set internally by MPC, - for example if MPC does internal computations (using MPFR) which yield - an overflow, even if the final MPC result fits in the exponent range. - However we don't allow MPC to *clear* the MPFR flags */ -static void -check_mpfr_flags (int counter) -{ - int old, neu; - - old = (counter & 1) != 0; - neu = mpfr_underflow_p () != 0; - if (old && (neu == 0)) - { - printf ("Error, underflow flag has been modified from %d to %d\n", - old, neu); - exit (1); - } - old = (counter & 2) != 0; - neu = mpfr_overflow_p () != 0; - if (old && (neu == 0)) - { - printf ("Error, overflow flag has been modified from %d to %d\n", - old, neu); - exit (1); - } -#ifdef mpfr_divby0_p - old = (counter & 4) != 0; - neu = mpfr_divby0_p () != 0; - if (old && (neu == 0)) - { - printf ("Error, divby0 flag has been modified from %d to %d\n", - old, neu); - exit (1); - } -#endif - old = (counter & 8) != 0; - neu = mpfr_nanflag_p () != 0; - if (old && (neu == 0)) - { - printf ("Error, nanflag flag has been modified from %d to %d\n", - old, neu); - exit (1); - } - old = (counter & 16) != 0; - neu = mpfr_inexflag_p () != 0; - if (old && (neu == 0)) - { - printf ("Error, inexflag flag has been modified from %d to %d\n", - old, neu); - exit (1); - } - old = (counter & 32) != 0; - neu = mpfr_erangeflag_p () != 0; - if (old && (neu == 0)) - { - printf ("Error, erangeflag flag has been modified from %d to %d\n", - old, neu); - exit (1); - } -} - -/* data_check (function, data_file_name) checks function results against - precomputed data in a file.*/ -void -data_check (mpc_function function, const char *file_name) -{ - FILE *fp; - - int inex_re; - mpfr_t x1, x2; - mpfr_rnd_t mpfr_rnd = MPFR_RNDN; - int sign_real; - - int inex_im; - mpc_t z1, z2, z3, z4, z5; - mpc_rnd_t rnd = MPC_RNDNN; - - unsigned long int ui; - long int si; - - known_signs_t signs; - int inex = 0; - - static int rand_counter = 0; - - fp = open_data_file (file_name); - - /* 1. init needed variables */ - mpc_init2 (z1, 2); - switch (function.type) - { - case FC: - mpfr_init (x1); - mpfr_init (x2); - break; - case CC: case CCU: case CCS: - mpc_init2 (z2, 2); - mpc_init2 (z3, 2); - break; - case C_CC: - mpc_init2 (z2, 2); - mpc_init2 (z3, 2); - mpc_init2 (z4, 2); - break; - case CCCC: - mpc_init2 (z2, 2); - mpc_init2 (z3, 2); - mpc_init2 (z4, 2); - mpc_init2 (z5, 2); - break; - case CFC: case CCF: - mpfr_init (x1); - mpc_init2 (z2, 2); - mpc_init2 (z3, 2); - break; - default: - ; - } - - /* 2. read data file */ - line_number = 1; - nextchar = getc (fp); - skip_whitespace_comments (fp); - while (nextchar != EOF) { - set_mpfr_flags (rand_counter); - - /* for each kind of function prototype: */ - /* 3.1 read a line of data: expected result, parameters, rounding mode */ - /* 3.2 compute function at the same precision as the expected result */ - /* 3.3 compare this result with the expected one */ - switch (function.type) - { - case FC: /* example mpc_norm */ - read_fc (fp, &inex_re, x1, &sign_real, z1, &mpfr_rnd); - mpfr_set_prec (x2, mpfr_get_prec (x1)); - inex = function.pointer.FC (x2, z1, mpfr_rnd); - if ((inex_re != TERNARY_NOT_CHECKED && inex_re != inex) - || !same_mpfr_value (x1, x2, sign_real)) - { - mpfr_t got, expected; - mpc_t op; - op[0] = z1[0]; - got[0] = x2[0]; - expected[0] = x1[0]; - printf ("%s(op) failed (%s:%lu)\nwith rounding mode %s\n", - function.name, file_name, test_line_number, - mpfr_rnd_mode[mpfr_rnd]); - if (inex_re != TERNARY_NOT_CHECKED && inex_re != inex) - printf("ternary value: got %s, expected %s\n", - MPFR_INEX_STR (inex), MPFR_INEX_STR (inex_re)); - MPC_OUT (op); - printf (" "); - MPFR_OUT (got); - MPFR_OUT (expected); - - exit (1); - } - break; - - case CC: /* example mpc_log */ - read_cc (fp, &inex_re, &inex_im, z1, &signs, z2, &rnd); - mpfr_set_prec (mpc_realref (z3), MPC_PREC_RE (z1)); - mpfr_set_prec (mpc_imagref (z3), MPC_PREC_IM (z1)); - inex = function.pointer.CC (z3, z2, rnd); - if (!MPC_INEX_CMP (inex_re, inex_im, inex) - || !same_mpc_value (z3, z1, signs)) - { - mpc_t op, got, expected; /* display sensible variable names */ - op[0] = z2[0]; - expected[0]= z1[0]; - got[0] = z3[0]; - printf ("%s(op) failed (line %lu)\nwith rounding mode %s\n", - function.name, test_line_number, rnd_mode[rnd]); - if (!MPC_INEX_CMP (inex_re, inex_im, inex)) - printf("ternary value: got %s, expected (%s, %s)\n", - MPC_INEX_STR (inex), - MPFR_INEX_STR (inex_re), MPFR_INEX_STR (inex_im)); - MPC_OUT (op); - printf (" "); - MPC_OUT (got); - MPC_OUT (expected); - - exit (1); - } - break; - - case C_CC: /* example mpc_mul */ - read_ccc (fp, &inex_re, &inex_im, z1, &signs, z2, z3, &rnd); - mpfr_set_prec (mpc_realref(z4), MPC_PREC_RE (z1)); - mpfr_set_prec (mpc_imagref(z4), MPC_PREC_IM (z1)); - inex = function.pointer.C_CC (z4, z2, z3, rnd); - if (!MPC_INEX_CMP (inex_re, inex_im, inex) - || !same_mpc_value (z4, z1, signs)) - { - /* display sensible variable names */ - mpc_t op1, op2, got, expected; - op1[0] = z2[0]; - op2[0] = z3[0]; - expected[0]= z1[0]; - got[0] = z4[0]; - printf ("%s(op) failed (line %lu)\nwith rounding mode %s\n", - function.name, test_line_number, rnd_mode[rnd]); - if (!MPC_INEX_CMP (inex_re, inex_im, inex)) - printf("ternary value: got %s, expected (%s, %s)\n", - MPC_INEX_STR (inex), - MPFR_INEX_STR (inex_re), MPFR_INEX_STR (inex_im)); - MPC_OUT (op1); - MPC_OUT (op2); - printf (" "); - MPC_OUT (got); - MPC_OUT (expected); - - exit (1); - } - if (function.properties & FUNC_PROP_SYMETRIC) - { - inex = function.pointer.C_CC (z4, z3, z2, rnd); - if (!MPC_INEX_CMP (inex_re, inex_im, inex) - || !same_mpc_value (z4, z1, signs)) - { - /* display sensible variable names */ - mpc_t op1, op2, got, expected; - op1[0] = z3[0]; - op2[0] = z2[0]; - expected[0]= z1[0]; - got[0] = z4[0]; - printf ("%s(op) failed (line %lu/symetric test)\n" - "with rounding mode %s\n", - function.name, test_line_number, rnd_mode[rnd]); - if (!MPC_INEX_CMP (inex_re, inex_im, inex)) - printf("ternary value: got %s, expected (%s, %s)\n", - MPC_INEX_STR (inex), - MPFR_INEX_STR (inex_re), MPFR_INEX_STR (inex_im)); - MPC_OUT (op1); - MPC_OUT (op2); - printf (" "); - MPC_OUT (got); - MPC_OUT (expected); - - exit (1); - } - } - break; - - case CCCC: /* example mpc_fma */ - read_cccc (fp, &inex_re, &inex_im, z1, &signs, z2, z3, z4, &rnd); - /* z1 is the expected value, z2, z3, z4 are the inputs, and z5 is - the computed value */ - mpfr_set_prec (mpc_realref(z5), MPC_PREC_RE (z1)); - mpfr_set_prec (mpc_imagref(z5), MPC_PREC_IM (z1)); - inex = function.pointer.CCCC (z5, z2, z3, z4, rnd); - if (!MPC_INEX_CMP (inex_re, inex_im, inex) - || !same_mpc_value (z5, z1, signs)) - { - /* display sensible variable names */ - mpc_t op1, op2, op3, got, expected; - op1[0] = z2[0]; - op2[0] = z3[0]; - op3[0] = z4[0]; - expected[0]= z1[0]; - got[0] = z5[0]; - printf ("%s(op) failed (line %lu)\nwith rounding mode %s\n", - function.name, test_line_number, rnd_mode[rnd]); - if (!MPC_INEX_CMP (inex_re, inex_im, inex)) - printf("ternary value: got %s, expected (%s, %s)\n", - MPC_INEX_STR (inex), - MPFR_INEX_STR (inex_re), MPFR_INEX_STR (inex_im)); - MPC_OUT (op1); - MPC_OUT (op2); - MPC_OUT (op3); - printf (" "); - MPC_OUT (got); - MPC_OUT (expected); - - exit (1); - } - if (function.properties & FUNC_PROP_SYMETRIC) - { - inex = function.pointer.CCCC (z5, z3, z2, z4, rnd); - if (!MPC_INEX_CMP (inex_re, inex_im, inex) - || !same_mpc_value (z5, z1, signs)) - { - /* display sensible variable names */ - mpc_t op1, op2, op3, got, expected; - op1[0] = z3[0]; - op2[0] = z2[0]; - op3[0] = z4[0]; - expected[0]= z1[0]; - got[0] = z5[0]; - printf ("%s(op) failed (line %lu/symetric test)\n" - "with rounding mode %s\n", - function.name, test_line_number, rnd_mode[rnd]); - if (!MPC_INEX_CMP (inex_re, inex_im, inex)) - printf("ternary value: got %s, expected (%s, %s)\n", - MPC_INEX_STR (inex), - MPFR_INEX_STR (inex_re), MPFR_INEX_STR (inex_im)); - MPC_OUT (op1); - MPC_OUT (op2); - MPC_OUT (op3); - printf (" "); - MPC_OUT (got); - MPC_OUT (expected); - - exit (1); - } - } - break; - - case CFC: /* example mpc_fr_div */ - read_cfc (fp, &inex_re, &inex_im, z1, &signs, x1, z2, &rnd); - mpfr_set_prec (mpc_realref(z3), MPC_PREC_RE (z1)); - mpfr_set_prec (mpc_imagref(z3), MPC_PREC_IM (z1)); - inex = function.pointer.CFC (z3, x1, z2, rnd); - if (!MPC_INEX_CMP (inex_re, inex_im, inex) - || !same_mpc_value (z3, z1, signs)) - { - /* display sensible variable names */ - mpc_t op2, got, expected; - mpfr_t op1; - op1[0] = x1[0]; - op2[0] = z2[0]; - expected[0]= z1[0]; - got[0] = z3[0]; - printf ("%s(op) failed (line %lu)\nwith rounding mode %s\n", - function.name, test_line_number, rnd_mode[rnd]); - if (!MPC_INEX_CMP (inex_re, inex_im, inex)) - printf("ternary value: got %s, expected (%s, %s)\n", - MPC_INEX_STR (inex), - MPFR_INEX_STR (inex_re), MPFR_INEX_STR (inex_im)); - MPFR_OUT (op1); - MPC_OUT (op2); - printf (" "); - MPC_OUT (got); - MPC_OUT (expected); - - exit (1); - } - break; - - case CCF: /* example mpc_mul_fr */ - read_ccf (fp, &inex_re, &inex_im, z1, &signs, z2, x1, &rnd); - mpfr_set_prec (mpc_realref(z3), MPC_PREC_RE (z1)); - mpfr_set_prec (mpc_imagref(z3), MPC_PREC_IM (z1)); - inex = function.pointer.CCF (z3, z2, x1, rnd); - if (!MPC_INEX_CMP (inex_re, inex_im, inex) - || !same_mpc_value (z3, z1, signs)) - { - /* display sensible variable names */ - mpc_t op1, got, expected; - mpfr_t op2; - op1[0] = z2[0]; - op2[0] = x1[0]; - expected[0]= z1[0]; - got[0] = z3[0]; - printf ("%s(op) failed (line %lu)\nwith rounding mode %s\n", - function.name, test_line_number, rnd_mode[rnd]); - if (!MPC_INEX_CMP (inex_re, inex_im, inex)) - printf("ternary value: got %s, expected (%s, %s)\n", - MPC_INEX_STR (inex), - MPFR_INEX_STR (inex_re), MPFR_INEX_STR (inex_im)); - MPC_OUT (op1); - MPFR_OUT (op2); - printf (" "); - MPC_OUT (got); - MPC_OUT (expected); - - exit (1); - } - break; - - case CCU: /* example mpc_pow_ui */ - read_ccu (fp, &inex_re, &inex_im, z1, &signs, z2, &ui, &rnd); - mpfr_set_prec (mpc_realref(z3), MPC_PREC_RE (z1)); - mpfr_set_prec (mpc_imagref(z3), MPC_PREC_IM (z1)); - inex = function.pointer.CCU (z3, z2, ui, rnd); - if (!MPC_INEX_CMP (inex_re, inex_im, inex) - || !same_mpc_value (z3, z1, signs)) - { - /* display sensible variable names */ - mpc_t op1, got, expected; - op1[0] = z2[0]; - expected[0]= z1[0]; - got[0] = z3[0]; - printf ("%s(op) failed (line %lu)\nwith rounding mode %s\n", - function.name, test_line_number, rnd_mode[rnd]); - if (!MPC_INEX_CMP (inex_re, inex_im, inex)) - printf("ternary value: got %s, expected (%s, %s)\n", - MPC_INEX_STR (inex), - MPFR_INEX_STR (inex_re), MPFR_INEX_STR (inex_im)); - MPC_OUT (op1); - printf ("op2 %lu\n ", ui); - MPC_OUT (got); - MPC_OUT (expected); - - exit (1); - } - break; - - case CCS: /* example mpc_pow_si */ - read_ccs (fp, &inex_re, &inex_im, z1, &signs, z2, &si, &rnd); - mpfr_set_prec (mpc_realref(z3), MPC_PREC_RE (z1)); - mpfr_set_prec (mpc_imagref(z3), MPC_PREC_IM (z1)); - inex = function.pointer.CCS (z3, z2, si, rnd); - if (!MPC_INEX_CMP (inex_re, inex_im, inex) - || !same_mpc_value (z3, z1, signs)) - { - /* display sensible variable names */ - mpc_t op1, got, expected; - op1[0] = z2[0]; - expected[0]= z1[0]; - got[0] = z3[0]; - printf ("%s(op) failed (line %lu)\nwith rounding mode %s\n", - function.name, test_line_number, rnd_mode[rnd]); - if (!MPC_INEX_CMP (inex_re, inex_im, inex)) - printf("ternary value: got %s, expected (%s, %s)\n", - MPC_INEX_STR (inex), - MPFR_INEX_STR (inex_re), MPFR_INEX_STR (inex_im)); - MPC_OUT (op1); - printf ("op2 %li\n ", si); - MPC_OUT (got); - MPC_OUT (expected); - - exit (1); - } - break; - - default: - printf ("Unhandled function prototype %i in 'data_check'\n", function.type); - exit (1); - } - - /* check MPFR flags were not modified */ - check_mpfr_flags (rand_counter); - rand_counter ++; - } - - /* 3. Clear used variables */ - mpc_clear (z1); - switch (function.type) - { - case FC: - mpfr_clear (x1); - mpfr_clear (x2); - break; - case CC: case CCU: case CCS: - mpc_clear (z2); - mpc_clear (z3); - break; - case C_CC: - mpc_clear (z2); - mpc_clear (z3); - mpc_clear (z4); - break; - case CCCC: - mpc_clear (z2); - mpc_clear (z3); - mpc_clear (z4); - mpc_clear (z5); - break; - case CFC: case CCF: - mpfr_clear (x1); - mpc_clear (z2); - mpc_clear (z3); - break; - default: - ; - } - - close_data_file (fp); -} |