diff options
author | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2012-08-29 12:27:47 +0000 |
---|---|---|
committer | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2012-08-29 12:27:47 +0000 |
commit | 532458deea67dc169a0163760c420702bb6bc1af (patch) | |
tree | 6bccf48a1f43086fe2fa402d4ce67529f1c00fd7 /tests/tstrtofr.c | |
parent | c9b73e77c2a6fb2b2c88b09f042c0953efd90ccf (diff) | |
download | mpfr-532458deea67dc169a0163760c420702bb6bc1af.tar.gz |
[tests/tstrtofr.c] Added 2 testcases:
* One triggering an assertion failure in strtofr.c r8389
on 32-bit machines (fixed in r8390).
* One still triggering an assertion failure in strtofr.c (r8391)
on 64-bit machines.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@8392 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests/tstrtofr.c')
-rw-r--r-- | tests/tstrtofr.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/tests/tstrtofr.c b/tests/tstrtofr.c index 1ebc74a26..e576e776a 100644 --- a/tests/tstrtofr.c +++ b/tests/tstrtofr.c @@ -1138,6 +1138,51 @@ bug20120814 (void) mpfr_clear (y); } +static void +bug20120829 (void) +{ + mpfr_t x, y, e; + int inex; + + mpfr_init2 (e, 128); + mpfr_inits2 (4, x, y, (mpfr_ptr *) 0); + + inex = mpfr_set_si (e, -100000000, MPFR_RNDN); + MPFR_ASSERTN (inex == 0); + mpfr_exp10 (x, e, MPFR_RNDN); + inex = mpfr_strtofr (y, "1e-100000000", NULL, 0, MPFR_RNDN); + /* On 32-bit machines, r8389 does a: + strtofr.c:678: MPFR assertion failed: err < (32 - 0) + Fixed in r8390. */ + if (! mpfr_equal_p (x, y) || inex >= 0) + { + printf ("Error 1 in bug20120829\n"); + printf ("Expected inex < 0, y = "); + mpfr_dump (x); + printf ("Got inex = %d, y = ", inex); + mpfr_dump (y); + exit (1); + } + + inex = mpfr_mul_ui (e, e, 100000000, MPFR_RNDN); + MPFR_ASSERTN (inex == 0); + mpfr_exp10 (x, e, MPFR_RNDN); + /* On 64-bit machines, r8391 does a: + strtofr.c:680: MPFR assertion failed: h < ysize */ + inex = mpfr_strtofr (y, "1e-10000000000000000", NULL, 0, MPFR_RNDN); + if (! mpfr_equal_p (x, y) || inex >= 0) + { + printf ("Error 2 in bug20120829\n"); + printf ("Expected inex < 0, y = "); + mpfr_dump (x); + printf ("Got inex = %d, y = ", inex); + mpfr_dump (y); + exit (1); + } + + mpfr_clears (e, x, y, (mpfr_ptr *) 0); +} + int main (int argc, char *argv[]) { @@ -1151,6 +1196,7 @@ main (int argc, char *argv[]) bug20081028 (); test20100310 (); bug20120814 (); + bug20120829 (); tests_end_mpfr (); return 0; |