diff options
author | pelissip <pelissip@280ebfd0-de03-0410-8827-d642c229c3f4> | 2004-05-06 12:37:21 +0000 |
---|---|---|
committer | pelissip <pelissip@280ebfd0-de03-0410-8827-d642c229c3f4> | 2004-05-06 12:37:21 +0000 |
commit | 192543932ca7ce494da0f1956475996bdd09e107 (patch) | |
tree | f18814d29b14a45058def73e1f97a2dcba103d9f /tests/texp2.c | |
parent | 4a3ec96bc477f258f2fab8bac31a7ec5059b09ce (diff) | |
download | mpfr-192543932ca7ce494da0f1956475996bdd09e107.tar.gz |
Fix overflow and add corresponding tests.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@2908 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests/texp2.c')
-rw-r--r-- | tests/texp2.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/texp2.c b/tests/texp2.c index f705b5f48..e304f85d6 100644 --- a/tests/texp2.c +++ b/tests/texp2.c @@ -28,6 +28,32 @@ MA 02111-1307, USA. */ #define TEST_FUNCTION mpfr_exp2 #include "tgeneric.c" +static void +special_overflow (void) +{ + mpfr_t x, y; + + mpfr_set_emin (-125); + mpfr_set_emax (128); + + mpfr_init2 (x, 24); + mpfr_init2 (y, 24); + + mpfr_set_str_binary (x, "0.101100100000000000110100E15"); + mpfr_exp2 (y, x, GMP_RNDN); + if (!mpfr_inf_p(y)) + { + printf("Overflow error.\n"); + mpfr_dump (y); + exit (1); + } + + mpfr_clear (y); + mpfr_clear (x); + mpfr_set_emin (MPFR_EMIN_MIN); + mpfr_set_emax (MPFR_EMAX_MAX); +} + int main (int argc, char *argv[]) { @@ -36,6 +62,8 @@ main (int argc, char *argv[]) tests_start_mpfr (); + special_overflow (); + mpfr_init (x); mpfr_init (y); |