diff options
author | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2017-05-16 13:41:49 +0000 |
---|---|---|
committer | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2017-05-16 13:41:49 +0000 |
commit | c2ee257991034693f4c81b3b797a5a7986eb63e5 (patch) | |
tree | f23bd67eaf3e6d3c01664e22082383bd08df340f | |
parent | bd733d9d1ccc1bc07b54b6fd624755a8187a84cc (diff) | |
download | mpfr-c2ee257991034693f4c81b3b797a5a7986eb63e5.tar.gz |
[tests/*.c] Renamed "ERROR" macro (macro name reserved by ISO C
when <errno.h> is included) to "PRINT_ERROR", and made the macro
more robust.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@11481 280ebfd0-de03-0410-8827-d642c229c3f4
-rw-r--r-- | tests/tcmpabs.c | 30 | ||||
-rw-r--r-- | tests/texceptions.c | 44 | ||||
-rw-r--r-- | tests/tpow_z.c | 41 | ||||
-rw-r--r-- | tests/tset_si.c | 31 | ||||
-rw-r--r-- | tests/tset_sj.c | 27 |
5 files changed, 88 insertions, 85 deletions
diff --git a/tests/tcmpabs.c b/tests/tcmpabs.c index b35cccd36..61cbe1fc1 100644 --- a/tests/tcmpabs.c +++ b/tests/tcmpabs.c @@ -22,7 +22,7 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., #include "mpfr-test.h" -#define ERROR(s) do { printf(s); exit(1); } while (0) +#define PRINT_ERROR(s) do { printf ("%s", s); exit (1); } while (0) int main (void) @@ -39,67 +39,67 @@ main (void) MPFR_SET_NAN (xx); MPFR_SET_NAN (yy); if (mpfr_cmpabs (xx, yy) != 0) - ERROR ("mpfr_cmpabs (NAN,NAN) returns non-zero\n"); + PRINT_ERROR ("mpfr_cmpabs (NAN,NAN) returns non-zero\n"); if (!mpfr_erangeflag_p ()) - ERROR ("mpfr_cmpabs (NAN,NAN) doesn't set erange flag\n"); + PRINT_ERROR ("mpfr_cmpabs (NAN,NAN) doesn't set erange flag\n"); mpfr_set_str_binary (xx, "0.10E0"); mpfr_set_str_binary (yy, "-0.10E0"); if (mpfr_cmpabs (xx, yy) != 0) - ERROR ("mpfr_cmpabs (xx, yy) returns non-zero for prec=2\n"); + PRINT_ERROR ("mpfr_cmpabs (xx, yy) returns non-zero for prec=2\n"); mpfr_set_prec (xx, 65); mpfr_set_prec (yy, 65); mpfr_set_str_binary (xx, "-0.10011010101000110101010000000011001001001110001011101011111011101E623"); mpfr_set_str_binary (yy, "0.10011010101000110101010000000011001001001110001011101011111011100E623"); if (mpfr_cmpabs (xx, yy) <= 0) - ERROR ("Error (1) in mpfr_cmpabs\n"); + PRINT_ERROR ("Error (1) in mpfr_cmpabs\n"); mpfr_set_str_binary (xx, "-0.10100010001110110111000010001000010011111101000100011101000011100"); mpfr_set_str_binary (yy, "-0.10100010001110110111000010001000010011111101000100011101000011011"); if (mpfr_cmpabs (xx, yy) <= 0) - ERROR ("Error (2) in mpfr_cmpabs\n"); + PRINT_ERROR ("Error (2) in mpfr_cmpabs\n"); mpfr_set_prec (xx, 160); mpfr_set_prec (yy, 160); mpfr_set_str_binary (xx, "0.1E1"); mpfr_set_str_binary (yy, "-0.1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111100000110001110100"); if (mpfr_cmpabs (xx, yy) <= 0) - ERROR ("Error (3) in mpfr_cmpabs\n"); + PRINT_ERROR ("Error (3) in mpfr_cmpabs\n"); mpfr_set_prec(xx, 53); mpfr_set_prec(yy, 200); mpfr_set_ui (xx, 1, (mpfr_rnd_t) 0); mpfr_set_ui (yy, 1, (mpfr_rnd_t) 0); if (mpfr_cmpabs(xx, yy) != 0) - ERROR ("Error in mpfr_cmpabs: 1.0 != 1.0\n"); + PRINT_ERROR ("Error in mpfr_cmpabs: 1.0 != 1.0\n"); mpfr_set_prec (yy, 31); mpfr_set_str (xx, "-1.0000000002", 10, (mpfr_rnd_t) 0); mpfr_set_ui (yy, 1, (mpfr_rnd_t) 0); if (!(mpfr_cmpabs(xx,yy)>0)) - ERROR ("Error in mpfr_cmpabs: not 1.0000000002 > 1.0\n"); + PRINT_ERROR ("Error in mpfr_cmpabs: not 1.0000000002 > 1.0\n"); mpfr_set_prec(yy, 53); mpfr_set_ui(xx, 0, MPFR_RNDN); mpfr_set_str (yy, "-0.1", 10, MPFR_RNDN); if (mpfr_cmpabs(xx, yy) >= 0) - ERROR ("Error in mpfr_cmpabs(0.0, 0.1)\n"); + PRINT_ERROR ("Error in mpfr_cmpabs(0.0, 0.1)\n"); mpfr_set_inf (xx, -1); mpfr_set_str (yy, "23489745.0329", 10, MPFR_RNDN); if (mpfr_cmpabs(xx, yy) <= 0) - ERROR ("Error in mpfr_cmp(-Inf, 23489745.0329)\n"); + PRINT_ERROR ("Error in mpfr_cmp(-Inf, 23489745.0329)\n"); mpfr_set_inf (xx, 1); mpfr_set_inf (yy, -1); if (mpfr_cmpabs(xx, yy) != 0) - ERROR ("Error in mpfr_cmpabs(Inf, -Inf)\n"); + PRINT_ERROR ("Error in mpfr_cmpabs(Inf, -Inf)\n"); mpfr_set_inf (yy, -1); mpfr_set_str (xx, "2346.09234", 10, MPFR_RNDN); if (mpfr_cmpabs (xx, yy) >= 0) - ERROR ("Error in mpfr_cmpabs(-Inf, 2346.09234)\n"); + PRINT_ERROR ("Error in mpfr_cmpabs(-Inf, 2346.09234)\n"); mpfr_set_prec (xx, 2); mpfr_set_prec (yy, 128); @@ -108,10 +108,10 @@ main (void) "0.100000000000000000000000000000000000000000000000" "00000000000000000000000000000000000000000000001E10"); if (mpfr_cmpabs (xx, yy) >= 0) - ERROR ("Error in mpfr_cmpabs(10.235, 2346.09234)\n"); + PRINT_ERROR ("Error in mpfr_cmpabs(10.235, 2346.09234)\n"); mpfr_swap (xx, yy); if (mpfr_cmpabs(xx, yy) <= 0) - ERROR ("Error in mpfr_cmpabs(2346.09234, 10.235)\n"); + PRINT_ERROR ("Error in mpfr_cmpabs(2346.09234, 10.235)\n"); mpfr_swap (xx, yy); /* Check for NAN */ diff --git a/tests/texceptions.c b/tests/texceptions.c index a02585445..cb66274ad 100644 --- a/tests/texceptions.c +++ b/tests/texceptions.c @@ -22,7 +22,7 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., #include "mpfr-test.h" -#define ERROR(s) do { printf(s"\n"); exit(1); } while(0) +#define PRINT_ERROR(s) do { printf ("%s\n", s); exit (1); } while (0) /* Test powerof2 */ static void @@ -52,15 +52,15 @@ check_default_rnd (void) { printf ("%s %s\n", mpfr_print_rnd_mode ((mpfr_rnd_t) r), mpfr_print_rnd_mode (t)); - ERROR("ERROR in setting / getting default rounding mode (1)"); + PRINT_ERROR("ERROR in setting / getting default rounding mode (1)"); } } mpfr_set_default_rounding_mode ((mpfr_rnd_t) MPFR_RND_MAX); if (mpfr_get_default_rounding_mode() != MPFR_RNDA) - ERROR("ERROR in setting / getting default rounding mode (2)"); + PRINT_ERROR("ERROR in setting / getting default rounding mode (2)"); mpfr_set_default_rounding_mode((mpfr_rnd_t) -1); if (mpfr_get_default_rounding_mode() != MPFR_RNDA) - ERROR("ERROR in setting / getting default rounding mode (3)"); + PRINT_ERROR("ERROR in setting / getting default rounding mode (3)"); } static void @@ -73,27 +73,27 @@ check_emin_emax (void) /* Check the functions not the macros ! */ if ((mpfr_set_emin)(MPFR_EMIN_MIN) != 0) - ERROR("set_emin failed!"); + PRINT_ERROR("set_emin failed!"); if ((mpfr_get_emin)() != MPFR_EMIN_MIN) - ERROR("get_emin FAILED!"); + PRINT_ERROR("get_emin FAILED!"); if ((mpfr_set_emin)(MPFR_EMIN_MIN-1) == 0) - ERROR("set_emin failed! (2)"); + PRINT_ERROR("set_emin failed! (2)"); if ((mpfr_set_emax)(MPFR_EMAX_MAX) != 0) - ERROR("set_emax failed!"); + PRINT_ERROR("set_emax failed!"); if ((mpfr_get_emax)() != MPFR_EMAX_MAX) - ERROR("get_emax FAILED!"); + PRINT_ERROR("get_emax FAILED!"); if ((mpfr_set_emax)(MPFR_EMAX_MAX+1) == 0) - ERROR("set_emax failed! (2)"); + PRINT_ERROR("set_emax failed! (2)"); if ((mpfr_get_emin_min) () != MPFR_EMIN_MIN) - ERROR ("get_emin_min"); + PRINT_ERROR ("get_emin_min"); if ((mpfr_get_emin_max) () != MPFR_EMIN_MAX) - ERROR ("get_emin_max"); + PRINT_ERROR ("get_emin_max"); if ((mpfr_get_emax_min) () != MPFR_EMAX_MIN) - ERROR ("get_emax_min"); + PRINT_ERROR ("get_emax_min"); if ((mpfr_get_emax_max) () != MPFR_EMAX_MAX) - ERROR ("get_emax_max"); + PRINT_ERROR ("get_emax_max"); set_emin (old_emin); set_emax (old_emax); @@ -106,7 +106,7 @@ check_set_get_prec (void) mpfr_init2 (x, 17); if (mpfr_get_prec (x) != 17 || (mpfr_get_prec)(x) != 17) - ERROR ("mpfr_get_prec"); + PRINT_ERROR ("mpfr_get_prec"); mpfr_clear (x); } @@ -115,10 +115,10 @@ mpfr_set_double_range (void) { mpfr_set_default_prec (54); if (mpfr_get_default_prec () != 54) - ERROR ("get_default_prec failed (1)"); + PRINT_ERROR ("get_default_prec failed (1)"); mpfr_set_default_prec (53); if ((mpfr_get_default_prec) () != 53) - ERROR ("get_default_prec failed (2)"); + PRINT_ERROR ("get_default_prec failed (2)"); /* in double precision format, the unbiased exponent is between 0 and 2047, where 0 is used for subnormal numbers, and 2047 for special @@ -154,32 +154,32 @@ check_flags (void) (mpfr_clear_overflow)(); mpfr_mul_2exp (x, x, 1024, MPFR_RNDN); if (!(mpfr_overflow_p)()) - ERROR("ERROR: No overflow detected!\n"); + PRINT_ERROR("ERROR: No overflow detected!\n"); (mpfr_clear_underflow)(); mpfr_set_ui (x, 1, MPFR_RNDN); mpfr_div_2exp (x, x, 1025, MPFR_RNDN); if (!(mpfr_underflow_p)()) - ERROR("ERROR: No underflow detected!\n"); + PRINT_ERROR("ERROR: No underflow detected!\n"); (mpfr_clear_nanflag)(); MPFR_SET_NAN(x); mpfr_add (x, x, x, MPFR_RNDN); if (!(mpfr_nanflag_p)()) - ERROR("ERROR: No NaN flag!\n"); + PRINT_ERROR("ERROR: No NaN flag!\n"); (mpfr_clear_inexflag)(); mpfr_set_ui(x, 2, MPFR_RNDN); mpfr_cos(x, x, MPFR_RNDN); if (!(mpfr_inexflag_p)()) - ERROR("ERROR: No inexact flag!\n"); + PRINT_ERROR("ERROR: No inexact flag!\n"); (mpfr_clear_erangeflag) (); mpfr_set_ui (x, 1, MPFR_RNDN); mpfr_mul_2exp (x, x, 1024, MPFR_RNDN); mpfr_get_ui (x, MPFR_RNDN); if (!(mpfr_erangeflag_p)()) - ERROR ("ERROR: No erange flag!\n"); + PRINT_ERROR ("ERROR: No erange flag!\n"); mpfr_clear (x); set_emin (old_emin); diff --git a/tests/tpow_z.c b/tests/tpow_z.c index 36af69d1e..0bfaae2f8 100644 --- a/tests/tpow_z.c +++ b/tests/tpow_z.c @@ -25,7 +25,8 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., #include "mpfr-test.h" -#define ERROR(str) do { printf ("Error for " str "\n"); exit (1); } while (0) +#define PRINT_ERROR(str) \ + do { printf ("Error for %s\n", str); exit (1); } while (0) static void check_special (void) @@ -43,93 +44,93 @@ check_special (void) mpz_set_ui (z, 0); res = mpfr_pow_z (y, x, z, MPFR_RNDN); if (res != 0 || mpfr_cmp_ui (y, 1) != 0) - ERROR ("23^0"); + PRINT_ERROR ("23^0"); mpfr_set_nan (x); res = mpfr_pow_z (y, x, z, MPFR_RNDN); if (res != 0 || mpfr_nan_p (y) || mpfr_cmp_si (y, 1) != 0) - ERROR ("NAN^0"); + PRINT_ERROR ("NAN^0"); mpfr_set_inf (x, 1); res = mpfr_pow_z (y, x, z, MPFR_RNDN); if (res != 0 || mpfr_cmp_ui (y, 1) != 0) - ERROR ("INF^0"); + PRINT_ERROR ("INF^0"); /* sINF^N = INF if s==1 or n even if N > 0*/ mpz_set_ui (z, 42); mpfr_set_inf (x, 1); res = mpfr_pow_z (y, x, z, MPFR_RNDN); if (res != 0 || mpfr_inf_p (y) == 0 || mpfr_sgn (y) <= 0) - ERROR ("INF^42"); + PRINT_ERROR ("INF^42"); mpfr_set_inf (x, -1); res = mpfr_pow_z (y, x, z, MPFR_RNDN); if (res != 0 || mpfr_inf_p (y) == 0 || mpfr_sgn (y) <= 0) - ERROR ("-INF^42"); + PRINT_ERROR ("-INF^42"); mpz_set_ui (z, 17); mpfr_set_inf (x, 1); res = mpfr_pow_z (y, x, z, MPFR_RNDN); if (res != 0 || mpfr_inf_p (y) == 0 || mpfr_sgn (y) <= 0) - ERROR ("INF^17"); + PRINT_ERROR ("INF^17"); mpfr_set_inf (x, -1); res = mpfr_pow_z (y, x, z, MPFR_RNDN); if (res != 0 || mpfr_inf_p (y) == 0 || mpfr_sgn (y) >= 0) - ERROR ("-INF^17"); + PRINT_ERROR ("-INF^17"); mpz_set_si (z, -42); mpfr_set_inf (x, 1); res = mpfr_pow_z (y, x, z, MPFR_RNDN); if (res != 0 || mpfr_zero_p (y) == 0 || MPFR_IS_NEG (y)) - ERROR ("INF^-42"); + PRINT_ERROR ("INF^-42"); mpfr_set_inf (x, -1); res = mpfr_pow_z (y, x, z, MPFR_RNDN); if (res != 0 || mpfr_zero_p (y) == 0 || MPFR_IS_NEG (y)) - ERROR ("-INF^-42"); + PRINT_ERROR ("-INF^-42"); mpz_set_si (z, -17); mpfr_set_inf (x, 1); res = mpfr_pow_z (y, x, z, MPFR_RNDN); if (res != 0 || mpfr_zero_p (y) == 0 || MPFR_IS_NEG (y)) - ERROR ("INF^-17"); + PRINT_ERROR ("INF^-17"); mpfr_set_inf (x, -1); res = mpfr_pow_z (y, x, z, MPFR_RNDN); if (res != 0 || mpfr_zero_p (y) == 0 || MPFR_IS_POS (y)) - ERROR ("-INF^-17"); + PRINT_ERROR ("-INF^-17"); /* s0^N = +0 if s==+ or n even if N > 0*/ mpz_set_ui (z, 42); MPFR_SET_ZERO (x); MPFR_SET_POS (x); res = mpfr_pow_z (y, x, z, MPFR_RNDN); if (res != 0 || mpfr_zero_p (y) == 0 || MPFR_IS_NEG (y)) - ERROR ("+0^42"); + PRINT_ERROR ("+0^42"); MPFR_SET_NEG (x); res = mpfr_pow_z (y, x, z, MPFR_RNDN); if (res != 0 || mpfr_zero_p (y) == 0 || MPFR_IS_NEG (y)) - ERROR ("-0^42"); + PRINT_ERROR ("-0^42"); mpz_set_ui (z, 17); MPFR_SET_POS (x); res = mpfr_pow_z (y, x, z, MPFR_RNDN); if (res != 0 || mpfr_zero_p (y) == 0 || MPFR_IS_NEG (y)) - ERROR ("+0^17"); + PRINT_ERROR ("+0^17"); MPFR_SET_NEG (x); res = mpfr_pow_z (y, x, z, MPFR_RNDN); if (res != 0 || mpfr_zero_p (y) == 0 || MPFR_IS_POS (y)) - ERROR ("-0^17"); + PRINT_ERROR ("-0^17"); mpz_set_si (z, -42); MPFR_SET_ZERO (x); MPFR_SET_POS (x); res = mpfr_pow_z (y, x, z, MPFR_RNDN); if (res != 0 || mpfr_inf_p (y) == 0 || MPFR_IS_NEG (y)) - ERROR ("+0^-42"); + PRINT_ERROR ("+0^-42"); MPFR_SET_NEG (x); res = mpfr_pow_z (y, x, z, MPFR_RNDN); if (res != 0 || mpfr_inf_p (y) == 0 || MPFR_IS_NEG (y)) - ERROR ("-0^-42"); + PRINT_ERROR ("-0^-42"); mpz_set_si (z, -17); MPFR_SET_POS (x); res = mpfr_pow_z (y, x, z, MPFR_RNDN); if (res != 0 || mpfr_inf_p (y) == 0 || MPFR_IS_NEG (y)) - ERROR ("+0^-17"); + PRINT_ERROR ("+0^-17"); MPFR_SET_NEG (x); res = mpfr_pow_z (y, x, z, MPFR_RNDN); if (res != 0 || mpfr_inf_p (y) == 0 || MPFR_IS_POS (y)) - ERROR ("-0^-17"); + PRINT_ERROR ("-0^-17"); mpz_clear (z); mpfr_clear (y); diff --git a/tests/tset_si.c b/tests/tset_si.c index d4c1b7d7b..3178589e4 100644 --- a/tests/tset_si.c +++ b/tests/tset_si.c @@ -22,7 +22,8 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., #include "mpfr-test.h" -#define ERROR(str) do { printf ("Error for " str "\n"); exit (1); } while (0) +#define PRINT_ERROR(str) \ + do { printf ("Error for %s\n", str); exit (1); } while (0) static void test_2exp (void) @@ -34,57 +35,57 @@ test_2exp (void) mpfr_set_ui_2exp (x, 1, 0, MPFR_RNDN); if (mpfr_cmp_ui (x, 1) != 0) - ERROR ("(1U,0)"); + PRINT_ERROR ("(1U,0)"); mpfr_set_ui_2exp (x, 1024, -10, MPFR_RNDN); if (mpfr_cmp_ui(x, 1) != 0) - ERROR ("(1024U,-10)"); + PRINT_ERROR ("(1024U,-10)"); mpfr_set_ui_2exp (x, 1024, 10, MPFR_RNDN); if (mpfr_cmp_ui (x, 1024 * 1024) != 0) - ERROR ("(1024U,+10)"); + PRINT_ERROR ("(1024U,+10)"); mpfr_set_si_2exp (x, -1024L * 1024L, -10, MPFR_RNDN); if (mpfr_cmp_si (x, -1024) != 0) - ERROR ("(1M,-10)"); + PRINT_ERROR ("(1M,-10)"); mpfr_set_ui_2exp (x, 0x92345678, 16, MPFR_RNDN); if (mpfr_cmp_str (x, "92345678@4", 16, MPFR_RNDN) != 0) - ERROR ("(x92345678U,+16)"); + PRINT_ERROR ("(x92345678U,+16)"); mpfr_set_si_2exp (x, -0x1ABCDEF0, -256, MPFR_RNDN); if (mpfr_cmp_str (x, "-1ABCDEF0@-64", 16, MPFR_RNDN) != 0) - ERROR ("(-x1ABCDEF0,-256)"); + PRINT_ERROR ("(-x1ABCDEF0,-256)"); mpfr_set_prec (x, 2); res = mpfr_set_si_2exp (x, 7, 10, MPFR_RNDU); if (mpfr_cmp_ui (x, 1<<13) != 0 || res <= 0) - ERROR ("Prec 2 + si_2exp"); + PRINT_ERROR ("Prec 2 + si_2exp"); res = mpfr_set_ui_2exp (x, 7, 10, MPFR_RNDU); if (mpfr_cmp_ui (x, 1<<13) != 0 || res <= 0) - ERROR ("Prec 2 + ui_2exp"); + PRINT_ERROR ("Prec 2 + ui_2exp"); mpfr_clear_flags (); mpfr_set_ui_2exp (x, 17, MPFR_EMAX_MAX, MPFR_RNDN); if (!mpfr_inf_p (x) || MPFR_IS_NEG (x)) - ERROR ("mpfr_set_ui_2exp and overflow (bad result)"); + PRINT_ERROR ("mpfr_set_ui_2exp and overflow (bad result)"); if (!mpfr_overflow_p ()) - ERROR ("mpfr_set_ui_2exp and overflow (overflow flag not set)"); + PRINT_ERROR ("mpfr_set_ui_2exp and overflow (overflow flag not set)"); mpfr_clear_flags (); mpfr_set_si_2exp (x, 17, MPFR_EMAX_MAX, MPFR_RNDN); if (!mpfr_inf_p (x) || MPFR_IS_NEG (x)) - ERROR ("mpfr_set_si_2exp (pos) and overflow (bad result)"); + PRINT_ERROR ("mpfr_set_si_2exp (pos) and overflow (bad result)"); if (!mpfr_overflow_p ()) - ERROR ("mpfr_set_si_2exp (pos) and overflow (overflow flag not set)"); + PRINT_ERROR ("mpfr_set_si_2exp (pos) and overflow (overflow flag not set)"); mpfr_clear_flags (); mpfr_set_si_2exp (x, -17, MPFR_EMAX_MAX, MPFR_RNDN); if (!mpfr_inf_p (x) || MPFR_IS_POS (x)) - ERROR ("mpfr_set_si_2exp (neg) and overflow (bad result)"); + PRINT_ERROR ("mpfr_set_si_2exp (neg) and overflow (bad result)"); if (!mpfr_overflow_p ()) - ERROR ("mpfr_set_si_2exp (neg) and overflow (overflow flag not set)"); + PRINT_ERROR ("mpfr_set_si_2exp (neg) and overflow (overflow flag not set)"); mpfr_clear (x); } diff --git a/tests/tset_sj.c b/tests/tset_sj.c index 4c8940c32..9435f0fca 100644 --- a/tests/tset_sj.c +++ b/tests/tset_sj.c @@ -39,7 +39,8 @@ main (void) #else -#define ERROR(str) do { printf ("Error for " str "\n"); exit (1); } while (0) +#define PRINT_ERROR(str) \ + do { printf ("Error for %s\n", str); exit (1); } while (0) static int inexact_sign (int x) @@ -88,14 +89,14 @@ check_set_uj (mpfr_prec_t pmin, mpfr_prec_t pmax, int N) mpfr_set_prec (x, sizeof(uintmax_t)*CHAR_BIT); inex1 = mpfr_set_uj (x, MPFR_UINTMAX_MAX, MPFR_RNDN); if (inex1 != 0 || mpfr_sgn(x) <= 0) - ERROR ("inexact / UINTMAX_MAX"); + PRINT_ERROR ("inexact / UINTMAX_MAX"); inex1 = mpfr_add_ui (x, x, 1, MPFR_RNDN); if (inex1 != 0 || !mpfr_powerof2_raw (x) || MPFR_EXP (x) != sizeof(uintmax_t) * CHAR_BIT + 1) - ERROR ("power of 2"); + PRINT_ERROR ("power of 2"); mpfr_set_uj (x, 0, MPFR_RNDN); if (!MPFR_IS_ZERO (x)) - ERROR ("Setting 0"); + PRINT_ERROR ("Setting 0"); mpfr_clears (x, y, (mpfr_ptr) 0); } @@ -110,30 +111,30 @@ check_set_uj_2exp (void) inex = mpfr_set_uj_2exp (x, 1, 0, MPFR_RNDN); if (inex || mpfr_cmp_ui(x, 1)) - ERROR ("(1U,0)"); + PRINT_ERROR ("(1U,0)"); inex = mpfr_set_uj_2exp (x, 1024, -10, MPFR_RNDN); if (inex || mpfr_cmp_ui(x, 1)) - ERROR ("(1024U,-10)"); + PRINT_ERROR ("(1024U,-10)"); inex = mpfr_set_uj_2exp (x, 1024, 10, MPFR_RNDN); if (inex || mpfr_cmp_ui(x, 1024L * 1024L)) - ERROR ("(1024U,+10)"); + PRINT_ERROR ("(1024U,+10)"); inex = mpfr_set_uj_2exp (x, MPFR_UINTMAX_MAX, 1000, MPFR_RNDN); inex |= mpfr_div_2ui (x, x, 1000, MPFR_RNDN); inex |= mpfr_add_ui (x, x, 1, MPFR_RNDN); if (inex || !mpfr_powerof2_raw (x) || MPFR_EXP (x) != sizeof(uintmax_t) * CHAR_BIT + 1) - ERROR ("(UINTMAX_MAX)"); + PRINT_ERROR ("(UINTMAX_MAX)"); inex = mpfr_set_uj_2exp (x, MPFR_UINTMAX_MAX, MPFR_EMAX_MAX-10, MPFR_RNDN); if (inex == 0 || !mpfr_inf_p (x)) - ERROR ("Overflow"); + PRINT_ERROR ("Overflow"); inex = mpfr_set_uj_2exp (x, MPFR_UINTMAX_MAX, MPFR_EMIN_MIN-1000, MPFR_RNDN); if (inex == 0 || !MPFR_IS_ZERO (x)) - ERROR ("Underflow"); + PRINT_ERROR ("Underflow"); mpfr_clear (x); } @@ -150,11 +151,11 @@ check_set_sj (void) inex |= mpfr_add_si (x, x, -1, MPFR_RNDN); if (inex || mpfr_sgn (x) >=0 || !mpfr_powerof2_raw (x) || MPFR_EXP (x) != sizeof(intmax_t) * CHAR_BIT) - ERROR ("set_sj (-INTMAX_MAX)"); + PRINT_ERROR ("set_sj (-INTMAX_MAX)"); inex = mpfr_set_sj (x, 1742, MPFR_RNDN); if (inex || mpfr_cmp_ui (x, 1742)) - ERROR ("set_sj (1742)"); + PRINT_ERROR ("set_sj (1742)"); mpfr_clear (x); } @@ -170,7 +171,7 @@ check_set_sj_2exp (void) inex = mpfr_set_sj_2exp (x, MPFR_INTMAX_MIN, 1000, MPFR_RNDN); if (inex || mpfr_sgn (x) >=0 || !mpfr_powerof2_raw (x) || MPFR_EXP (x) != sizeof(intmax_t) * CHAR_BIT + 1000) - ERROR ("set_sj_2exp (INTMAX_MIN)"); + PRINT_ERROR ("set_sj_2exp (INTMAX_MIN)"); mpfr_clear (x); } |