summaryrefslogtreecommitdiff
path: root/tests/tlgamma.c
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2007-06-11 13:40:14 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2007-06-11 13:40:14 +0000
commit06de973cc25b5f9575c057a5612f132de15f87ee (patch)
tree0e1715f2f6a769e913eb32c0aea4fc235b582c69 /tests/tlgamma.c
parentf8161b98184bf86d411f37aa8a793da6f8723b58 (diff)
downloadmpfr-06de973cc25b5f9575c057a5612f132de15f87ee.tar.gz
tests/tlgamma.c: re-enabled sign checking.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@4537 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests/tlgamma.c')
-rw-r--r--tests/tlgamma.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/tests/tlgamma.c b/tests/tlgamma.c
index 5ceaa080e..f13e35f1b 100644
--- a/tests/tlgamma.c
+++ b/tests/tlgamma.c
@@ -32,7 +32,19 @@ 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);
+ {
+ MPFR_ASSERTN (sign == 1 || sign == -1);
+ if (sign == -1 && (rnd == GMP_RNDN || rnd == GMP_RNDZ))
+ {
+ mpfr_neg (y, y, GMP_RNDN);
+ inex = -inex;
+ /* This is a way to check with the generic tests, that the value
+ returned in the sign variable is consistent, but warning! The
+ tested function depends on the rounding mode: it is
+ * lgamma(x) = log(|Gamma(x)|) in GMP_RNDD and GMP_RNDU;
+ * lgamma(x) * sign(Gamma(x)) in GMP_RNDN and GMP_RNDZ. */
+ }
+ }
return inex;
}