summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2004-02-12 12:54:48 +0000
committerzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2004-02-12 12:54:48 +0000
commit5d8fcc6938422553d0f4661ec601cac408062590 (patch)
tree472a926e4b8b169ae029d460b46bd070d4290d5d
parent75b314a7573ede83dce44a5da59c12e6dfdfeb0c (diff)
downloadmpfr-5d8fcc6938422553d0f4661ec601cac408062590.tar.gz
improved coverage test
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@2684 280ebfd0-de03-0410-8827-d642c229c3f4
-rw-r--r--erf.c15
-rw-r--r--tests/terf.c12
2 files changed, 17 insertions, 10 deletions
diff --git a/erf.c b/erf.c
index 5dd33f5f4..ba3a1690b 100644
--- a/erf.c
+++ b/erf.c
@@ -52,10 +52,11 @@ mpfr_erf (mpfr_ptr y, mpfr_srcptr x, mp_rnd_t rnd_mode)
}
else if (MPFR_IS_INF(x)) /* erf(+inf) = +1, erf(-inf) = -1 */
return mpfr_set_si (y, MPFR_FROM_SIGN_TO_INT(sign_x), GMP_RNDN);
- else if (MPFR_IS_ZERO(x)) /* erf(+0) = +0, erf(-0) = -0 */
- return mpfr_set (y, x, GMP_RNDN); /* should keep the sign of x */
- else
- MPFR_ASSERTN(0);
+ else /* erf(+0) = +0, erf(-0) = -0 */
+ {
+ MPFR_ASSERTD(MPFR_IS_ZERO(x));
+ return mpfr_set (y, x, GMP_RNDN); /* should keep the sign of x */
+ }
}
/* now x is neither NaN, Inf nor 0 */
@@ -193,12 +194,6 @@ mpfr_erf_0 (mpfr_ptr res, mpfr_srcptr x, mp_rnd_t rnd_mode)
ok = mpfr_can_round (s, m - log2tauk, GMP_RNDN, GMP_RNDZ,
n + (rnd_mode == GMP_RNDN));
-
- if (ok == 0)
- {
- if (m < n + log2tauk)
- m = n + log2tauk;
- }
}
while (ok == 0);
diff --git a/tests/terf.c b/tests/terf.c
index 133328f88..eea4e011a 100644
--- a/tests/terf.c
+++ b/tests/terf.c
@@ -113,6 +113,18 @@ special (void)
exit (1);
}
+ mpfr_set_str (x, "-6.6", 10, GMP_RNDN);
+ mpfr_erf (x, x, GMP_RNDN);
+ if (mpfr_cmp_si (x, -1))
+ {
+ printf ("mpfr_erf failed for x=-6.6, rnd=GMP_RNDN\n");
+ printf ("expected -1\n");
+ printf ("got ");
+ mpfr_out_str (stdout, 2, 0, x, GMP_RNDN);
+ printf ("\n");
+ exit (1);
+ }
+
mpfr_set_str (x, "6.6", 10, GMP_RNDN);
mpfr_erf (x, x, GMP_RNDZ);
mpfr_set_str_binary (y, "0.11111111111111111111111111111111111111111111111111111");