diff options
Diffstat (limited to 'tests/tlgamma.c')
-rw-r--r-- | tests/tlgamma.c | 37 |
1 files changed, 17 insertions, 20 deletions
diff --git a/tests/tlgamma.c b/tests/tlgamma.c index 126443973..94604493b 100644 --- a/tests/tlgamma.c +++ b/tests/tlgamma.c @@ -25,9 +25,6 @@ MA 02110-1301, USA. */ #include "mpfr-test.h" -/* check that x and y are equal, assuming x is not NaN */ -#define MPFR_EQUAL(x,y) (!mpfr_nan_p (y) && mpfr_cmp (x, y) == 0) - static int mpfr_lgamma_nosign (mpfr_ptr y, mpfr_srcptr x, mp_rnd_t rnd) { @@ -145,7 +142,7 @@ special (void) sign = -17; mpfr_lgamma (y, &sign, x, GMP_RNDN); mpfr_set_str (x, CHECK_Y1, 10, GMP_RNDN); - if (MPFR_EQUAL (y, x) == 0 || sign != 1) + if (mpfr_equal_p (y, x) == 0 || sign != 1) { printf ("mpfr_lgamma("CHECK_X1") is wrong:\n" "expected "); @@ -161,7 +158,7 @@ special (void) sign = -17; mpfr_lgamma (y, &sign, x, GMP_RNDN); mpfr_set_str (x, CHECK_Y2, 10, GMP_RNDN); - if (MPFR_EQUAL (y, x) == 0 || sign != 1) + if (mpfr_equal_p (y, x) == 0 || sign != 1) { printf ("mpfr_lgamma("CHECK_X2") is wrong:\n" "expected "); @@ -178,7 +175,7 @@ special (void) mpfr_lgamma (y, &sign, x, GMP_RNDU); mpfr_set_prec (x, 175); mpfr_set_str_binary (x, "0.1010001100011101101011001101110010100001000001000001110011000001101100001111001001000101011011100100010101011110100111110101010100010011010010000101010111001100011000101111E7"); - if (MPFR_EQUAL (x, y) == 0 || sign != 1) + if (mpfr_equal_p (x, y) == 0 || sign != 1) { printf ("Error in mpfr_lgamma (1)\n"); exit (1); @@ -191,7 +188,7 @@ special (void) mpfr_lgamma (x, &sign, y, GMP_RNDZ); mpfr_set_prec (y, 21); mpfr_set_str_binary (y, "0.111000101000001100101E9"); - if (MPFR_EQUAL (x, y) == 0 || sign != 1) + if (mpfr_equal_p (x, y) == 0 || sign != 1) { printf ("Error in mpfr_lgamma (120)\n"); printf ("Expected "); mpfr_print_binary (y); puts (""); @@ -206,7 +203,7 @@ special (void) inex = mpfr_lgamma (y, &sign, x, GMP_RNDN); mpfr_set_prec (x, 206); mpfr_set_str_binary (x, "0.10000111011000000011100010101001100110001110000111100011000100100110110010001011011110101001111011110110000001010100111011010000000011100110110101100111000111010011110010000100010111101010001101000110101001E13"); - if (MPFR_EQUAL (x, y) == 0 || sign != 1) + if (mpfr_equal_p (x, y) == 0 || sign != 1) { printf ("Error in mpfr_lgamma (768)\n"); exit (1); @@ -223,7 +220,7 @@ special (void) sign = -17; mpfr_lgamma (y, &sign, x, GMP_RNDN); mpfr_set_str_binary (x, "0.1100E6"); - if (MPFR_EQUAL (x, y) == 0 || sign != 1) + if (mpfr_equal_p (x, y) == 0 || sign != 1) { printf ("Error for lgamma(0.1100E-66)\n"); printf ("Expected "); @@ -242,7 +239,7 @@ special (void) mpfr_lgamma (y, &sign, x, GMP_RNDN); mpfr_set_prec (x, 32); mpfr_set_str_binary (x, "-0.10001000111011111011000010100010E207"); - if (MPFR_EQUAL (x, y) == 0 || sign != 1) + if (mpfr_equal_p (x, y) == 0 || sign != 1) { printf ("Error for lgamma(-2^199+0.5)\n"); printf ("Got "); @@ -261,7 +258,7 @@ special (void) mpfr_lgamma (y, &sign, x, GMP_RNDN); mpfr_set_prec (x, 32); mpfr_set_str_binary (x, "-0.10001000111011111011000010100010E207"); - if (MPFR_EQUAL (x, y) == 0 || sign != -1) + if (mpfr_equal_p (x, y) == 0 || sign != -1) { printf ("Error for lgamma(-2^199-0.5)\n"); printf ("Got "); @@ -277,7 +274,7 @@ special (void) mpfr_set_str_binary (x, "-0.1101111000E-3"); inex = mpfr_lgamma (y, &sign, x, GMP_RNDN); mpfr_set_str_binary (x, "10.01001011"); - if (MPFR_EQUAL (x, y) == 0 || sign != -1 || inex >= 0) + if (mpfr_equal_p (x, y) == 0 || sign != -1 || inex >= 0) { printf ("Error for lgamma(-0.1101111000E-3)\n"); printf ("Got "); @@ -294,7 +291,7 @@ special (void) inex = mpfr_lgamma (y, &sign, x, GMP_RNDN); mpfr_set_prec (x, 28); mpfr_set_str_binary (x, "0.100001110110101011011010011E8"); - MPFR_ASSERTN (MPFR_EQUAL (x, y) && inex < 0); + MPFR_ASSERTN (mpfr_equal_p (x, y) && inex < 0); /* values reported by Kaveh Ghazi on 14 Jul 2007, where mpfr_lgamma() takes forever */ @@ -317,38 +314,38 @@ special (void) mpfr_set_str_binary (x, VAL1); mpfr_lgamma (y, &sign, x, GMP_RNDN); mpfr_set_str_binary (x, OUT1); - MPFR_ASSERTN(sign == -1 && MPFR_EQUAL(x, y)); + MPFR_ASSERTN(sign == -1 && mpfr_equal_p(x, y)); mpfr_set_str_binary (x, VAL2); mpfr_lgamma (y, &sign, x, GMP_RNDN); mpfr_set_str_binary (x, OUT2); - MPFR_ASSERTN(sign == -1 && MPFR_EQUAL (x, y)); + MPFR_ASSERTN(sign == -1 && mpfr_equal_p (x, y)); mpfr_set_str_binary (x, VAL3); mpfr_lgamma (y, &sign, x, GMP_RNDN); mpfr_set_str_binary (x, OUT3); - MPFR_ASSERTN(sign == -1 && MPFR_EQUAL (x, y)); + MPFR_ASSERTN(sign == -1 && mpfr_equal_p (x, y)); mpfr_set_str_binary (x, VAL4); mpfr_lgamma (y, &sign, x, GMP_RNDN); mpfr_set_str_binary (x, OUT4); - MPFR_ASSERTN(sign == -1 && MPFR_EQUAL (x, y)); + MPFR_ASSERTN(sign == -1 && mpfr_equal_p (x, y)); mpfr_set_str_binary (x, VAL5); mpfr_lgamma (y, &sign, x, GMP_RNDN); mpfr_set_str_binary (x, OUT5); - MPFR_ASSERTN(sign == -1 && MPFR_EQUAL (x, y)); + MPFR_ASSERTN(sign == -1 && mpfr_equal_p (x, y)); mpfr_set_str_binary (x, VAL6); mpfr_lgamma (y, &sign, x, GMP_RNDN); mpfr_set_str_binary (x, OUT6); - MPFR_ASSERTN(sign == -1 && MPFR_EQUAL (x, y)); + MPFR_ASSERTN(sign == -1 && mpfr_equal_p (x, y)); /* further test from Kaveh Ghazi */ mpfr_set_str_binary (x, "-0.10011010101001010010001110010111010111011101010111001E-53"); mpfr_lgamma (y, &sign, x, GMP_RNDN); mpfr_set_str_binary (x, "100101.00111101101010000000101010111010001111001101111"); - MPFR_ASSERTN(sign == -1 && MPFR_EQUAL (x, y)); + MPFR_ASSERTN(sign == -1 && mpfr_equal_p (x, y)); mpfr_clear (x); mpfr_clear (y); |