diff options
author | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2011-03-15 10:01:59 +0000 |
---|---|---|
committer | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2011-03-15 10:01:59 +0000 |
commit | af1087a7a9a4f42f22667597ee77e96716011af6 (patch) | |
tree | 8d343e9159410e9c1f0798eed3412838eb435a9e /tests/terf.c | |
parent | 875c2ccd4c5e3d0f17738db39a666875af755810 (diff) | |
download | mpfr-af1087a7a9a4f42f22667597ee77e96716011af6.tar.gz |
[tests/terf.c] Added a testcase showing a failure due to bad flags
in a reduced exponent range.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@7570 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests/terf.c')
-rw-r--r-- | tests/terf.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/terf.c b/tests/terf.c index 541381db5..ed6056175 100644 --- a/tests/terf.c +++ b/tests/terf.c @@ -559,6 +559,43 @@ test_erfc (void) mpfr_clears (x, y, z, (mpfr_ptr) 0); } +/* Failure in r7569 (2011-03-15) due to incorrect flags. */ +static void +reduced_expo_range (void) +{ + mpfr_exp_t emax; + mpfr_t x, y, ex_y; + int inex, ex_inex; + unsigned int flags, ex_flags; + + emax = mpfr_get_emax (); + mpfr_set_emax (3); + mpfr_init2 (x, 33); + mpfr_inits2 (110, y, ex_y, (mpfr_ptr) 0); + mpfr_set_str_binary (x, "-0.111100110111111111011101010101110E3"); + mpfr_clear_flags (); + inex = mpfr_erfc (y, x, MPFR_RNDZ); + flags = __gmpfr_flags; + mpfr_set_str (ex_y, "1.fffffffffffffffffffffe607440", 16, MPFR_RNDN); + ex_inex = -1; + ex_flags = MPFR_FLAGS_INEXACT; + if (SIGN (inex) != ex_inex || flags != ex_flags || + ! mpfr_equal_p (y, ex_y)) + { + printf ("Error in reduced_expo_range\non x = "); + mpfr_dump (x); + printf ("Expected y = "); + mpfr_out_str (stdout, 16, 0, ex_y, MPFR_RNDN); + printf ("\n inex = %d, flags = %u\n", ex_inex, ex_flags); + printf ("Got y = "); + mpfr_out_str (stdout, 16, 0, y, MPFR_RNDN); + printf ("\n inex = %d, flags = %u\n", SIGN (inex), flags); + exit (1); + } + mpfr_clears (x, y, ex_y, (mpfr_ptr) 0); + mpfr_set_emax (emax); +} + int main (int argc, char *argv[]) { @@ -568,6 +605,7 @@ main (int argc, char *argv[]) special_erfc (); large_arg (); test_erfc (); + reduced_expo_range (); test_generic_erf (2, 100, 15); test_generic_erfc (2, 100, 15); |