From dc21e9d74caa78b6f4b0123fd76e53793521392b Mon Sep 17 00:00:00 2001 From: vlefevre Date: Tue, 19 Aug 2008 23:23:10 +0000 Subject: tests/tpow_all.c: added overflow tests for x^(-1). -> Failure. git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@5536 280ebfd0-de03-0410-8827-d642c229c3f4 --- tests/tpow_all.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'tests/tpow_all.c') diff --git a/tests/tpow_all.c b/tests/tpow_all.c index 3c2568c15..6ebc37b60 100644 --- a/tests/tpow_all.c +++ b/tests/tpow_all.c @@ -555,6 +555,39 @@ underflow_up (int ext) underflow_up2 (ext); } +static void +overflow_inv (int ext) +{ + mpfr_t x, y, z; + int s, t; + int inex; + int rnd; + + mpfr_init2 (x, 55); + mpfr_init2 (y, 2); + mpfr_init2 (z, 53); + + mpfr_set_si (y, -1, GMP_RNDN); + for (s = -1; s <= 1; s += 2) + { + inex = mpfr_set_si_2exp (x, s, - mpfr_get_emax (), GMP_RNDN); + MPFR_ASSERTN (inex == 0); + for (t = 0; t <= 8; t++) + { + RND_LOOP (rnd) + { + mpfr_clear_flags (); + inex = mpfr_pow (z, x, y, (mp_rnd_t) rnd); + test_others (NULL, "-1", (mp_rnd_t) rnd, x, y, z, + inex, __gmpfr_flags); + } + mpfr_nexttoinf (x); + } + } + + mpfr_clears (x, y, z, (mpfr_ptr) 0); +} + static void alltst (void) { @@ -562,6 +595,7 @@ alltst (void) tst (0); underflow_up (0); + overflow_inv (0); emin = mpfr_get_emin (); emax = mpfr_get_emax (); @@ -571,6 +605,7 @@ alltst (void) { tst (1); underflow_up (1); + overflow_inv (1); set_emin (emin); set_emax (emax); } -- cgit v1.2.1