diff options
author | zimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4> | 2004-04-07 14:19:44 +0000 |
---|---|---|
committer | zimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4> | 2004-04-07 14:19:44 +0000 |
commit | c44bde008cebc99a76205f1329ac86fef8cf65c3 (patch) | |
tree | 86ed9bfe64d93338368f8b9e9f7c735cfec520c9 /tests | |
parent | a7ed08d70837deee7ccb01c30e43efbba292f9f3 (diff) | |
download | mpfr-c44bde008cebc99a76205f1329ac86fef8cf65c3.tar.gz |
fixed problem when overflow in destination exponent happens
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@2862 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests')
-rw-r--r-- | tests/tset_str.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/tests/tset_str.c b/tests/tset_str.c index f90db1f34..5e486d022 100644 --- a/tests/tset_str.c +++ b/tests/tset_str.c @@ -33,12 +33,12 @@ static void check_underflow (void) { mpfr_t a; - mp_exp_t emin; + mp_exp_t emin, emax; int res; mpfr_init (a); - /* Check undeflow */ + /* Check underflow */ emin = mpfr_get_emin (); mpfr_set_emin (-20); res = mpfr_set_str (a, "0.00000000001", 10, GMP_RNDZ); @@ -52,6 +52,17 @@ check_underflow (void) } mpfr_set_emin (emin); + /* check overflow */ + emax = mpfr_get_emax (); + mpfr_set_emax (1073741823); /* 2^30-1 */ + mpfr_set_str (a, "2E1000000000", 10, GMP_RNDN); + if (!mpfr_inf_p (a) || mpfr_sgn (a) < 0) + { + printf("ERROR for mpfr_set_str (a, \"2E1000000000\", 10, GMP_RNDN);\n"); + exit (1); + } + mpfr_set_emax (emax); + mpfr_clear (a); } |