diff options
author | zimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4> | 2003-10-14 12:13:37 +0000 |
---|---|---|
committer | zimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4> | 2003-10-14 12:13:37 +0000 |
commit | b666e8ed316c9843582161aaee40aa0605a53df3 (patch) | |
tree | 2f7b5be249c75c4d217c60ef58b5fafe277f98cb /tests/terf.c | |
parent | b87636c5e4fa91836dd2bca51e6c60b5b23524e6 (diff) | |
download | mpfr-b666e8ed316c9843582161aaee40aa0605a53df3.tar.gz |
now uses #include "tgeneric.c" everywhere
(and modified test_generic to check also the inexact flag)
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@2496 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests/terf.c')
-rw-r--r-- | tests/terf.c | 61 |
1 files changed, 3 insertions, 58 deletions
diff --git a/tests/terf.c b/tests/terf.c index 7f6bf7fea..a159864ec 100644 --- a/tests/terf.c +++ b/tests/terf.c @@ -29,63 +29,8 @@ MA 02111-1307, USA. */ #include "mpfr-impl.h" #include "mpfr-test.h" -static void -test_generic (void) -{ - unsigned int prec, err, yprec, n, p0 = 2, p1 = 100, N = 10; - mp_rnd_t rnd; - mpfr_t x, y, z, t; - - mpfr_init2 (x, 2); - mpfr_init2 (y, 2); - mpfr_init2 (z, 2); - mpfr_init2 (t, 2); - - for (prec = p0; prec <= p1; prec++) - { - mpfr_set_prec (x, prec); - mpfr_set_prec (z, prec); - mpfr_set_prec (t, prec); - yprec = prec + 10; - - for (n=0; n<N; n++) - { - mpfr_random (x); - mpfr_mul_2exp (x, x, randlimb () % 4, GMP_RNDN); - rnd = randlimb () % 4; - mpfr_set_prec (y, yprec); - mpfr_erf (y, x, rnd); - err = (rnd == GMP_RNDN) ? yprec + 1 : yprec; - if (mpfr_can_round (y, err, rnd, rnd, prec)) - { - mpfr_set (t, y, rnd); - mpfr_erf (z, x, rnd); - if (mpfr_cmp (t, z)) - { - printf ("results differ for x="); - mpfr_out_str (stdout, 2, prec, x, GMP_RNDN); - printf (" prec=%u rnd_mode=%s\n", prec, - mpfr_print_rnd_mode (rnd)); - printf (" got "); - mpfr_out_str (stdout, 2, prec, z, GMP_RNDN); - puts (""); - printf (" expected "); - mpfr_out_str (stdout, 2, prec, t, GMP_RNDN); - puts (""); - printf (" approximation was "); - mpfr_print_binary (y); - puts (""); - exit (1); - } - } - } - } - - mpfr_clear (x); - mpfr_clear (y); - mpfr_clear (z); - mpfr_clear (t); -} +#define TEST_FUNCTION mpfr_erf +#include "tgeneric.c" int main (int argc, char *argv[]) @@ -217,7 +162,7 @@ main (int argc, char *argv[]) mpfr_clear (x); mpfr_clear (y); - test_generic (); + test_generic (2, 100, 10); tests_end_mpfr (); return 0; |