summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2016-09-12 12:00:15 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2016-09-12 12:00:15 +0000
commit9aa65e4e72c1ca3ee7d700e0c23edf67ccb488aa (patch)
tree832f545ffbcbfede6d694e78d74967a08fc56b46
parent08d3a36afa1fa63581dc862bff67854f0899466e (diff)
downloadmpfr-9aa65e4e72c1ca3ee7d700e0c23edf67ccb488aa.tar.gz
[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
-rw-r--r--tests/tset_ld.c25
1 files 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);