summaryrefslogtreecommitdiff
path: root/tests/terf.c
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2003-10-17 13:34:46 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2003-10-17 13:34:46 +0000
commit346d2e5b7e45184dc886e953e7eacac5589c53c5 (patch)
tree43ab2a142cc7c48937cfc2ddc7743346a262756b /tests/terf.c
parent0673bcf31ade59fbc69119ab5bed479fc25bedf9 (diff)
downloadmpfr-346d2e5b7e45184dc886e953e7eacac5589c53c5.tar.gz
Merged the mpfr-2-0-2-branch changes to the trunk.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@2511 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests/terf.c')
-rw-r--r--tests/terf.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/terf.c b/tests/terf.c
index a159864ec..64c1cca72 100644
--- a/tests/terf.c
+++ b/tests/terf.c
@@ -36,6 +36,7 @@ int
main (int argc, char *argv[])
{
mpfr_t x, y;
+ int inex;
tests_start_mpfr ();
@@ -159,6 +160,44 @@ main (int argc, char *argv[])
exit (1);
}
+ mpfr_set_prec (x, 8);
+ mpfr_set_prec (y, 8);
+ mpfr_set_ui (x, 50, GMP_RNDN);
+ inex = mpfr_erf (y, x, GMP_RNDN);
+ if (mpfr_cmp_ui (y, 1))
+ {
+ printf ("mpfr_erf failed for x=50, rnd=GMP_RNDN\n");
+ printf ("expected 1, got ");
+ mpfr_out_str (stdout, 2, 0, y, GMP_RNDN);
+ printf ("\n");
+ exit (1);
+ }
+ if (inex <= 0)
+ {
+ printf ("mpfr_erf failed for x=50, rnd=GMP_RNDN: wrong ternary value\n"
+ "expected positive, got %d\n", inex);
+ exit (1);
+ }
+ inex = mpfr_erf (x, x, GMP_RNDZ);
+ mpfr_nextbelow (y);
+ if (mpfr_cmp (x, y))
+ {
+ printf ("mpfr_erf failed for x=50, rnd=GMP_RNDZ\n");
+ printf ("expected ");
+ mpfr_out_str (stdout, 2, 0, y, GMP_RNDN);
+ printf ("\n");
+ printf ("got ");
+ mpfr_out_str (stdout, 2, 0, x, GMP_RNDN);
+ printf ("\n");
+ exit (1);
+ }
+ if (inex >= 0)
+ {
+ printf ("mpfr_erf failed for x=50, rnd=GMP_RNDN: wrong ternary value\n"
+ "expected negative, got %d\n", inex);
+ exit (1);
+ }
+
mpfr_clear (x);
mpfr_clear (y);