summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/terf.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/tests/terf.c b/tests/terf.c
index ed6056175..7736ec866 100644
--- a/tests/terf.c
+++ b/tests/terf.c
@@ -414,18 +414,44 @@ static void
large_arg (void)
{
mpfr_t x, y;
+ unsigned int flags;
mpfr_init2 (x, 88);
mpfr_init2 (y, 98);
mpfr_set_si_2exp (x, -1, 173, MPFR_RNDN);
+ mpfr_clear_flags ();
mpfr_erfc (y, x, MPFR_RNDN);
+ flags = __gmpfr_flags;
if (mpfr_cmp_ui (y, 2) != 0)
{
printf ("mpfr_erfc failed for large x (1)\n");
exit (1);
}
+ if (flags != MPFR_FLAGS_INEXACT)
+ {
+ printf ("mpfr_erfc sets incorrect flags for large x (1)\n");
+ printf ("Expected %u, got %u\n",
+ (unsigned int) MPFR_FLAGS_INEXACT, flags);
+ exit (1);
+ }
+ mpfr_set_si_2exp (x, -1, mpfr_get_emax () - 3, MPFR_RNDN);
+ mpfr_clear_flags ();
+ mpfr_erfc (y, x, MPFR_RNDN);
+ flags = __gmpfr_flags;
+ if (mpfr_cmp_ui (y, 2) != 0)
+ {
+ printf ("mpfr_erfc failed for large x (1b)\n");
+ exit (1);
+ }
+ if (flags != MPFR_FLAGS_INEXACT)
+ {
+ printf ("mpfr_erfc sets incorrect flags for large x (1b)\n");
+ printf ("Expected %u, got %u\n",
+ (unsigned int) MPFR_FLAGS_INEXACT, flags);
+ exit (1);
+ }
mpfr_set_prec (x, 33);
mpfr_set_prec (y, 43);
@@ -462,7 +488,9 @@ large_arg (void)
mpfr_set_prec (x, 2);
mpfr_set_prec (y, 21);
mpfr_set_str_binary (x, "-1.0e3");
+ mpfr_clear_flags ();
mpfr_erfc (y, x, MPFR_RNDZ);
+ flags = __gmpfr_flags;
mpfr_set_prec (x, 21);
mpfr_set_str_binary (x, "1.11111111111111111111");
if (mpfr_cmp (x, y) != 0)
@@ -470,11 +498,20 @@ large_arg (void)
printf ("mpfr_erfc failed for large x (4)\n");
exit (1);
}
+ if (flags != MPFR_FLAGS_INEXACT)
+ {
+ printf ("mpfr_erfc sets incorrect flags for large x (4)\n");
+ printf ("Expected %u, got %u\n",
+ (unsigned int) MPFR_FLAGS_INEXACT, flags);
+ exit (1);
+ }
mpfr_set_prec (x, 2);
mpfr_set_prec (y, 31);
mpfr_set_str_binary (x, "-1.0e3");
+ mpfr_clear_flags ();
mpfr_erfc (y, x, MPFR_RNDZ);
+ flags = __gmpfr_flags;
mpfr_set_prec (x, 31);
mpfr_set_str_binary (x, "1.111111111111111111111111111111");
if (mpfr_cmp (x, y) != 0)
@@ -484,6 +521,13 @@ large_arg (void)
printf ("got "); mpfr_dump (y);
exit (1);
}
+ if (flags != MPFR_FLAGS_INEXACT)
+ {
+ printf ("mpfr_erfc sets incorrect flags for large x (5)\n");
+ printf ("Expected %u, got %u\n",
+ (unsigned int) MPFR_FLAGS_INEXACT, flags);
+ exit (1);
+ }
/* Reported by Christopher Creutzig on 2007-07-10. */
mpfr_set_prec (x, 53);