summaryrefslogtreecommitdiff
path: root/tests/tlgamma.c
diff options
context:
space:
mode:
authorzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2007-06-11 09:30:08 +0000
committerzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2007-06-11 09:30:08 +0000
commitf8161b98184bf86d411f37aa8a793da6f8723b58 (patch)
tree1c83aaa5abeada55582c39db37aba2ffd29a1682 /tests/tlgamma.c
parent5160a6c3bec8db586565ea1cbd3d860892f56f62 (diff)
downloadmpfr-f8161b98184bf86d411f37aa8a793da6f8723b58.tar.gz
fixed problem with mpfr_lgamma for tiny negative input (and fixed use of
generic test) git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@4536 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests/tlgamma.c')
-rw-r--r--tests/tlgamma.c27
1 files changed, 21 insertions, 6 deletions
diff --git a/tests/tlgamma.c b/tests/tlgamma.c
index c09459f8a..5ceaa080e 100644
--- a/tests/tlgamma.c
+++ b/tests/tlgamma.c
@@ -32,12 +32,7 @@ mpfr_lgamma_nosign (mpfr_ptr y, mpfr_srcptr x, mp_rnd_t rnd)
inex = mpfr_lgamma (y, &sign, x, rnd);
if (!MPFR_IS_SINGULAR (y))
- {
- MPFR_ASSERTN (sign == 1 || sign == -1);
- if (sign == -1 && (rnd == GMP_RNDN || rnd == GMP_RNDZ))
- mpfr_neg (y, y, GMP_RNDN);
- /* This is a way to check that the sign is consistent. */
- }
+ MPFR_ASSERTN (sign == 1 || sign == -1);
return inex;
}
@@ -216,6 +211,10 @@ special (void)
if (MPFR_IS_NAN (y) || mpfr_cmp (x, y) || sign != 1)
{
printf ("Error for lgamma(0.1100E-66)\n");
+ printf ("Expected ");
+ mpfr_dump (x);
+ printf ("Got ");
+ mpfr_dump (y);
exit (1);
}
@@ -258,6 +257,22 @@ special (void)
exit (1);
}
+ mpfr_set_prec (x, 10);
+ mpfr_set_prec (y, 10);
+ 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_IS_NAN (y) || mpfr_cmp (x, y) || sign != -1 || inex >= 0)
+ {
+ printf ("Error for lgamma(-0.1101111000E-3)\n");
+ printf ("Got ");
+ mpfr_dump (y);
+ printf ("instead of ");
+ mpfr_dump (x);
+ printf ("with sign %d instead of -1 (inex=%d).\n", sign, inex);
+ exit (1);
+ }
+
mpfr_clear (x);
mpfr_clear (y);
}