From 9aa65e4e72c1ca3ee7d700e0c23edf67ccb488aa Mon Sep 17 00:00:00 2001 From: vlefevre Date: Mon, 12 Sep 2016 12:00:15 +0000 Subject: [tests/tset_ld.c] In bug_20160907, fixed the method to get the smallest subnormal (now, OK with gcc -mpc64 or under NetBSD 6-). (merged changesets r10835-10839 from the trunk) git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/branches/3.1@10855 280ebfd0-de03-0410-8827-d642c229c3f4 --- tests/tset_ld.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/tests/tset_ld.c b/tests/tset_ld.c index 7b878ccb9..37bb1aaa6 100644 --- a/tests/tset_ld.c +++ b/tests/tset_ld.c @@ -199,18 +199,21 @@ static void bug_20160907 (void) { #if HAVE_LDOUBLE_IEEE_EXT_LITTLE - long double dn, ld, t = 1.0; + long double dn, ld; mpfr_t mp; - long e = 1; - - do - { - e--; - dn = t; - t = dn * (long double) 0.5; - } - while (t != 0); - /* dn=2^e is now the smallest subnormal */ + long e; + mpfr_long_double_t x; + + /* the following is the encoding of the smallest subnormal number + for HAVE_LDOUBLE_IEEE_EXT_LITTLE */ + x.s.manl = 1; + x.s.manh = 0; + x.s.expl = 0; + x.s.exph = 0; + x.s.sign= 0; + dn = x.ld; + e = -16445; + /* dn=2^e is now the smallest subnormal. */ mpfr_init2 (mp, 64); mpfr_set_ui_2exp (mp, 1, e - 1, MPFR_RNDN); -- cgit v1.2.1