diff options
author | zimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4> | 2010-10-19 14:22:09 +0000 |
---|---|---|
committer | zimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4> | 2010-10-19 14:22:09 +0000 |
commit | 0d0a1c6f8dd50b77e965c5ce97a514630e34fa36 (patch) | |
tree | aa76a3f47590f4324b11859755ccee90912cc54a /tests/tset_ld.c | |
parent | 4e0b1641fbf058ae3c7801fd5031e66ff8d95a76 (diff) | |
download | mpfr-0d0a1c6f8dd50b77e965c5ce97a514630e34fa36.tar.gz |
[set_ld.c] fixed bug #11300 on bug tracker
[tset_ld.c] added corresponding tests
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@7222 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests/tset_ld.c')
-rw-r--r-- | tests/tset_ld.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/tset_ld.c b/tests/tset_ld.c index 6ed4f9960..43984f61f 100644 --- a/tests/tset_ld.c +++ b/tests/tset_ld.c @@ -147,12 +147,38 @@ static void test_fixed_bugs (void) { mpfr_t x; + long double l, m; /* bug found by Steve Kargl (2009-03-14) */ mpfr_init2 (x, 64); mpfr_set_ui_2exp (x, 1, -16447, MPFR_RNDN); mpfr_get_ld (x, MPFR_RNDN); /* an assertion failed in init2.c:50 */ + /* bug reported by Jakub Jelinek (2010-10-17) + https://gforge.inria.fr/tracker/?func=detail&aid=11300 */ + mpfr_set_prec (x, MPFR_LDBL_MANT_DIG); + l = 0x1.23456789abcdef0123456789abcdp-914L; + mpfr_set_ld (x, l, MPFR_RNDN); + m = mpfr_get_ld (x, MPFR_RNDN); + if (m != l) + { + printf ("Error in get_ld o set_ld for l=%Le\n", l); + printf ("Got m=%Le instead of l\n", m); + exit (1); + } + + /* another similar test which failed with extended double precision and the + generic code for mpfr_set_ld */ + l = 0x1.23456789abcdef0123456789abcdp-968L; + mpfr_set_ld (x, l, MPFR_RNDN); + m = mpfr_get_ld (x, MPFR_RNDN); + if (m != l) + { + printf ("Error in get_ld o set_ld for l=%Le\n", l); + printf ("Got m=%Le instead of l\n", m); + exit (1); + } + mpfr_clear (x); } |