summaryrefslogtreecommitdiff
path: root/tests/tgamma_inc.c
diff options
context:
space:
mode:
authorzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2016-02-09 14:06:42 +0000
committerzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2016-02-09 14:06:42 +0000
commit8f7c3b40c05d58b726558ea4a18e462d2739dc2b (patch)
tree4a85294c3431dd3a274eeda902663bae9ae21880 /tests/tgamma_inc.c
parent7606e4dbd06d2d7bcd95b1a99cb03a4fe810aeca (diff)
downloadmpfr-8f7c3b40c05d58b726558ea4a18e462d2739dc2b.tar.gz
fixed the call to mpfr_eint() in gamma_inc, added some tests for gamma_inc
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@10011 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests/tgamma_inc.c')
-rw-r--r--tests/tgamma_inc.c38
1 files changed, 37 insertions, 1 deletions
diff --git a/tests/tgamma_inc.c b/tests/tgamma_inc.c
index 00d4432b4..45d5527fc 100644
--- a/tests/tgamma_inc.c
+++ b/tests/tgamma_inc.c
@@ -26,6 +26,8 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
#define TWO_ARGS
#define TEST_RANDOM_POS2 0 /* the 2nd argument is never negative */
#define TGENERIC_NOWARNING 1
+#define TEST_RANDOM_EMAX 32
+#define TEST_RANDOM_EMIN -32
#include "tgeneric.c"
/* do k random tests at precision p */
@@ -66,6 +68,38 @@ test_random (mpfr_prec_t p, int k)
mpfr_clear (t);
}
+static void
+specials (void)
+{
+ mpfr_t a, x;
+
+ mpfr_init2 (a, 2);
+ mpfr_init2 (x, 2);
+
+ /* check gamma_inc(0,1) = 0.219383934395520 */
+ mpfr_set_ui (a, 0, MPFR_RNDN);
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_gamma_inc (a, a, x, MPFR_RNDN);
+ if (mpfr_cmp_ui_2exp (a, 1, -2))
+ {
+ printf ("Error for gamma_inc(0,1)\n");
+ printf ("expected 0.25\n");
+ printf ("got ");
+ mpfr_out_str (stdout, 10, 0, a, MPFR_RNDN);
+ printf ("\n");
+ exit (1);
+ }
+
+ mpfr_set_prec (a, 1);
+ mpfr_set_prec (x, 1);
+ mpfr_set_ui_2exp (a, 1, 32, MPFR_RNDN);
+ mpfr_set_ui_2exp (x, 1, -32, MPFR_RNDN);
+ mpfr_gamma_inc (a, a, x, MPFR_RNDN);
+
+ mpfr_clear (a);
+ mpfr_clear (x);
+}
+
int
main (int argc, char *argv[])
{
@@ -89,10 +123,12 @@ main (int argc, char *argv[])
return 0;
}
+ specials ();
+
for (p = MPFR_PREC_MIN; p < 100; p++)
test_random (p, 10);
- /* FIXME: once the case gamma_inc (0, x) is implemented, we can activate
+ /* FIXME: once the case gamma_inc (-n, x) is implemented, we can activate
the generic tests below */
// test_generic (MPFR_PREC_MIN, 100, 100);