summaryrefslogtreecommitdiff
path: root/libc/stdlib
diff options
context:
space:
mode:
authorjoseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d>2012-09-25 14:42:18 +0000
committerjoseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d>2012-09-25 14:42:18 +0000
commitaeb5b827c5f7ed858a5b15101d1a3893356cc6ba (patch)
tree5d8e4382197847df3cf875caac4994390b6f1094 /libc/stdlib
parent598804b7d4191eddbaf24784c3b25a6c4d6f33cd (diff)
Merge changes between r20391 and r20863 from /fsf/trunk.
git-svn-id: svn://svn.eglibc.org/trunk@20864 7b3dc134-2b1b-0410-93df-9e9f96275f8d
Diffstat (limited to 'libc/stdlib')
-rw-r--r--libc/stdlib/Makefile5
-rw-r--r--libc/stdlib/gen-tst-strtod-round.c24
-rw-r--r--libc/stdlib/strtod_l.c70
-rwxr-xr-xlibc/stdlib/tst-fmtmsg.sh5
-rw-r--r--libc/stdlib/tst-secure-getenv.c13
-rw-r--r--libc/stdlib/tst-strtod-overflow.c1
-rw-r--r--libc/stdlib/tst-strtod-round.c626
7 files changed, 660 insertions, 84 deletions
diff --git a/libc/stdlib/Makefile b/libc/stdlib/Makefile
index 4479a5f33..a8eb60813 100644
--- a/libc/stdlib/Makefile
+++ b/libc/stdlib/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 1991-2009, 2011, 2012 Free Software Foundation, Inc.
+# Copyright (C) 1991-2012 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# The GNU C Library is free software; you can redistribute it and/or
@@ -149,7 +149,7 @@ $(objpfx)isomac: isomac.c
$(native-compile)
$(objpfx)tst-fmtmsg.out: tst-fmtmsg.sh $(objpfx)tst-fmtmsg
- $(SHELL) -e $< $(common-objpfx) '$(run-program-prefix)' $(common-objpfx)stdlib/
+ $(SHELL) $< $(common-objpfx) '$(run-program-prefix)' $(common-objpfx)stdlib/
$(objpfx)tst-putenv: $(objpfx)tst-putenvmod.so
LDFLAGS-tst-putenv = $(no-as-needed)
@@ -164,3 +164,4 @@ else
link-libm = $(common-objpfx)math/libm.a
endif
$(objpfx)bug-getcontext: $(link-libm)
+$(objpfx)tst-strtod-round: $(link-libm)
diff --git a/libc/stdlib/gen-tst-strtod-round.c b/libc/stdlib/gen-tst-strtod-round.c
index 0a89ff71a..56aafab02 100644
--- a/libc/stdlib/gen-tst-strtod-round.c
+++ b/libc/stdlib/gen-tst-strtod-round.c
@@ -18,6 +18,7 @@
<http://www.gnu.org/licenses/>. */
#define _GNU_SOURCE
+#include <assert.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
@@ -65,7 +66,19 @@ round_str (const char *s, const char *suffix,
mpfr_init (f);
int r = string_to_fp (f, s, MPFR_RNDD);
if (need_exact)
- mpfr_printf ("\t%s,\n", r ? "false" : "true");
+ {
+ assert (prec == 106 && emin == -1073 && emax == 1024);
+ /* The maximum value in IBM long double has discontiguous
+ mantissa bits. */
+ mpfr_t max_value;
+ mpfr_init2 (max_value, 107);
+ mpfr_set_str (max_value, "0x1.fffffffffffff7ffffffffffffcp+1023", 0,
+ MPFR_RNDN);
+ if (mpfr_cmpabs (f, max_value) > 0)
+ r = 1;
+ mpfr_printf ("\t%s,\n", r ? "false" : "true");
+ mpfr_clear (max_value);
+ }
print_fp (f, suffix, ",\n");
string_to_fp (f, s, MPFR_RNDN);
print_fp (f, suffix, ",\n");
@@ -85,11 +98,14 @@ round_for_all (const char *s)
int emin;
int emax;
bool need_exact;
- } formats[6] = {
+ } formats[7] = {
{ "f", 24, -148, 128, false },
{ "", 53, -1073, 1024, false },
{ "L", 53, -1073, 1024, false },
+ /* This is the Intel extended float format. */
{ "L", 64, -16444, 16384, false },
+ /* This is the Motorola extended float format. */
+ { "L", 64, -16445, 16384, false },
{ "L", 106, -1073, 1024, true },
{ "L", 113, -16493, 16384, false },
};
@@ -103,11 +119,11 @@ round_for_all (const char *s)
}
mpfr_printf ("\",\n");
int i;
- for (i = 0; i < 6; i++)
+ for (i = 0; i < 7; i++)
{
round_str (s, formats[i].suffix, formats[i].prec,
formats[i].emin, formats[i].emax, formats[i].need_exact);
- if (i < 5)
+ if (i < 6)
mpfr_printf (",\n");
}
mpfr_printf ("),\n");
diff --git a/libc/stdlib/strtod_l.c b/libc/stdlib/strtod_l.c
index f60091fb6..12bbbc419 100644
--- a/libc/stdlib/strtod_l.c
+++ b/libc/stdlib/strtod_l.c
@@ -62,6 +62,7 @@ extern unsigned long long int ____strtoull_l_internal (const char *, char **,
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
+#include <rounding-mode.h>
/* The gmp headers need some configuration frobs. */
#define HAVE_ALLOCA 1
@@ -127,6 +128,8 @@ extern unsigned long long int ____strtoull_l_internal (const char *, char **,
#define MIN_EXP PASTE(FLT,_MIN_EXP)
#define MAX_10_EXP PASTE(FLT,_MAX_10_EXP)
#define MIN_10_EXP PASTE(FLT,_MIN_10_EXP)
+#define MAX_VALUE PASTE(FLT,_MAX)
+#define MIN_VALUE PASTE(FLT,_MIN)
/* Extra macros required to get FLT expanded before the pasting. */
#define PASTE(a,b) PASTE1(a,b)
@@ -173,6 +176,34 @@ extern const mp_limb_t _tens_in_limb[MAX_DIG_PER_LIMB + 1];
memcpy (dst, src, (dst##size = src##size) * sizeof (mp_limb_t))
+/* Set errno and return an overflowing value with sign specified by
+ NEGATIVE. */
+static FLOAT
+overflow_value (int negative)
+{
+ __set_errno (ERANGE);
+#if FLT_EVAL_METHOD != 0
+ volatile
+#endif
+ FLOAT result = (negative ? -MAX_VALUE : MAX_VALUE) * MAX_VALUE;
+ return result;
+}
+
+
+/* Set errno and return an underflowing value with sign specified by
+ NEGATIVE. */
+static FLOAT
+underflow_value (int negative)
+{
+ __set_errno (ERANGE);
+#if FLT_EVAL_METHOD != 0
+ volatile
+#endif
+ FLOAT result = (negative ? -MIN_VALUE : MIN_VALUE) * MIN_VALUE;
+ return result;
+}
+
+
/* Return a floating point number of the needed type according to the given
multi-precision number after possible rounding. */
static FLOAT
@@ -182,10 +213,7 @@ round_and_return (mp_limb_t *retval, intmax_t exponent, int negative,
if (exponent < MIN_EXP - 1)
{
if (exponent < MIN_EXP - 1 - MANT_DIG)
- {
- __set_errno (ERANGE);
- return negative ? -0.0 : 0.0;
- }
+ return underflow_value (negative);
mp_size_t shift = MIN_EXP - 1 - exponent;
@@ -238,9 +266,14 @@ round_and_return (mp_limb_t *retval, intmax_t exponent, int negative,
if (exponent > MAX_EXP)
goto overflow;
- if ((round_limb & (((mp_limb_t) 1) << round_bit)) != 0
- && (more_bits || (retval[0] & 1) != 0
- || (round_limb & ((((mp_limb_t) 1) << round_bit) - 1)) != 0))
+ int mode = get_rounding_mode ();
+
+ if (round_away (negative,
+ (retval[0] & 1) != 0,
+ (round_limb & (((mp_limb_t) 1) << round_bit)) != 0,
+ (more_bits
+ || (round_limb & ((((mp_limb_t) 1) << round_bit) - 1)) != 0),
+ mode))
{
mp_limb_t cy = __mpn_add_1 (retval, retval, RETURN_LIMB_SIZE, 1);
@@ -264,7 +297,7 @@ round_and_return (mp_limb_t *retval, intmax_t exponent, int negative,
if (exponent > MAX_EXP)
overflow:
- return negative ? -FLOAT_HUGE_VAL : FLOAT_HUGE_VAL;
+ return overflow_value (negative);
return MPN2FLOAT (retval, exponent, negative);
}
@@ -927,9 +960,9 @@ ____STRTOF_INTERNAL (nptr, endptr, group, loc)
else
{
/* Overflow or underflow. */
- __set_errno (ERANGE);
- result = (exp_negative ? (negative ? -0.0 : 0.0) :
- negative ? -FLOAT_HUGE_VAL : FLOAT_HUGE_VAL);
+ result = (exp_negative
+ ? underflow_value (negative)
+ : overflow_value (negative));
}
/* Accept all following digits as part of the exponent. */
@@ -1125,16 +1158,10 @@ ____STRTOF_INTERNAL (nptr, endptr, group, loc)
}
if (__builtin_expect (exponent > MAX_10_EXP + 1 - (intmax_t) int_no, 0))
- {
- __set_errno (ERANGE);
- return negative ? -FLOAT_HUGE_VAL : FLOAT_HUGE_VAL;
- }
+ return overflow_value (negative);
if (__builtin_expect (exponent < MIN_10_EXP - (DIG + 1), 0))
- {
- __set_errno (ERANGE);
- return negative ? -0.0 : 0.0;
- }
+ return underflow_value (negative);
if (int_no > 0)
{
@@ -1195,10 +1222,7 @@ ____STRTOF_INTERNAL (nptr, endptr, group, loc)
/* Now we know the exponent of the number in base two.
Check it against the maximum possible exponent. */
if (__builtin_expect (bits > MAX_EXP, 0))
- {
- __set_errno (ERANGE);
- return negative ? -FLOAT_HUGE_VAL : FLOAT_HUGE_VAL;
- }
+ return overflow_value (negative);
/* We have already the first BITS bits of the result. Together with
the information whether more non-zero bits follow this is enough
diff --git a/libc/stdlib/tst-fmtmsg.sh b/libc/stdlib/tst-fmtmsg.sh
index abde254e0..868292eba 100755
--- a/libc/stdlib/tst-fmtmsg.sh
+++ b/libc/stdlib/tst-fmtmsg.sh
@@ -1,8 +1,7 @@
#! /bin/sh
# Test of fmtmsg function family.
-# Copyright (C) 2000, 2001 Free Software Foundation, Inc.
+# Copyright (C) 2000-2012 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
-#
# The GNU C Library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -18,6 +17,8 @@
# License along with the GNU C Library; if not, see
# <http://www.gnu.org/licenses/>.
+set -e
+
common_objpfx=$1
run_program_prefix=$2
objpfx=$3
diff --git a/libc/stdlib/tst-secure-getenv.c b/libc/stdlib/tst-secure-getenv.c
index 276b0aff7..7a6930b5a 100644
--- a/libc/stdlib/tst-secure-getenv.c
+++ b/libc/stdlib/tst-secure-getenv.c
@@ -18,7 +18,7 @@
/* Test that secure_getenv works by invoking the test as a SGID
program with a group ID from the supplementary group list. This
test can fail spuriously if the user is not a member of a suitable
- supplementary group. */
+ supplementary group. */
#include <errno.h>
#include <fcntl.h>
@@ -36,7 +36,7 @@ static char MAGIC_ARGUMENT[] = "run-actual-test";
static const char *test_dir;
/* Return a GID which is not our current GID, but is present in the
- supplementary group list. */
+ supplementary group list. */
static gid_t
choose_gid (void)
{
@@ -60,7 +60,7 @@ choose_gid (void)
/* Copies the executable into a restricted directory, so that we can
safely make it SGID with the TARGET group ID. Then runs the
- executable. */
+ executable. */
static int
run_executable_sgid (gid_t target)
{
@@ -152,7 +152,7 @@ run_executable_sgid (gid_t target)
}
if (kid == 0)
{
- /* Child process. */
+ /* Child process. */
char *args[] = { execname, MAGIC_ARGUMENT, NULL };
execve (execname, args, environ);
printf ("execve (%s): %m\n", execname);
@@ -228,9 +228,10 @@ alternative_main (int argc, char **argv)
{
if (getgid () == getegid ())
{
- printf ("SGID failed: GID and EGID match (%jd)\n",
+ /* This can happen if the file system is mounted nosuid. */
+ fprintf (stderr, "SGID failed: GID and EGID match (%jd)\n",
(intmax_t) getgid ());
- exit (2);
+ exit (MAGIC_STATUS);
}
if (getenv ("PATH") == NULL)
{
diff --git a/libc/stdlib/tst-strtod-overflow.c b/libc/stdlib/tst-strtod-overflow.c
index 668d55ba1..6c5b28285 100644
--- a/libc/stdlib/tst-strtod-overflow.c
+++ b/libc/stdlib/tst-strtod-overflow.c
@@ -45,4 +45,5 @@ do_test (void)
}
#define TEST_FUNCTION do_test ()
+#define TIMEOUT 5
#include "../test-skeleton.c"
diff --git a/libc/stdlib/tst-strtod-round.c b/libc/stdlib/tst-strtod-round.c
index 07881e33e..76385a94d 100644
--- a/libc/stdlib/tst-strtod-round.c
+++ b/libc/stdlib/tst-strtod-round.c
@@ -17,6 +17,7 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
+#include <fenv.h>
#include <float.h>
#include <math.h>
#include <stdbool.h>
@@ -24,38 +25,90 @@
#include <stdlib.h>
#include <string.h>
-struct test {
- const char *s;
+struct test_results {
float f;
double d;
- bool ld_ok;
long double ld;
};
+struct test {
+ const char *s;
+ bool ld_ok;
+ struct test_results rd, rn, rz, ru;
+};
+
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
-# define TEST(s, fd, fn, fz, fu, dd, dn, dz, du, ld53d, ld53n, ld53z, ld53u, \
- ld64d, ld64n, ld64z, ld64u, ld106exact, \
- ld106d, ld106n, ld106z, ld106u, \
- ld113d, ld113n, ld113z, ld113u) \
- { s, fn, dn, true, ld53n }
-#elif LDBL_MANT_DIG == 64 && LDBL_MAX_EXP == 16384
-# define TEST(s, fd, fn, fz, fu, dd, dn, dz, du, ld53d, ld53n, ld53z, ld53u, \
- ld64d, ld64n, ld64z, ld64u, ld106exact, \
- ld106d, ld106n, ld106z, ld106u, \
- ld113d, ld113n, ld113z, ld113u) \
- { s, fn, dn, true, ld64n }
+# define TEST(s, fd, fn, fz, fu, dd, dn, dz, du, ld53d, ld53n, ld53z, ld53u, \
+ ld64id, ld64in, ld64iz, ld64iu, \
+ ld64md, ld64mn, ld64mz, ld64mu, \
+ ld106exact, ld106d, ld106n, ld106z, ld106u, \
+ ld113d, ld113n, ld113z, ld113u) \
+ { \
+ s, \
+ true, \
+ { fd, dd, ld53d }, \
+ { fn, dn, ld53n }, \
+ { fz, dz, ld53z }, \
+ { fu, du, ld53u } \
+ }
+#elif LDBL_MANT_DIG == 64 && LDBL_MAX_EXP == 16384 && LDBL_MIN_EXP == -16381
+/* This is for the Intel extended float format. */
+# define TEST(s, fd, fn, fz, fu, dd, dn, dz, du, ld53d, ld53n, ld53z, ld53u, \
+ ld64id, ld64in, ld64iz, ld64iu, \
+ ld64md, ld64mn, ld64mz, ld64mu, \
+ ld106exact, ld106d, ld106n, ld106z, ld106u, \
+ ld113d, ld113n, ld113z, ld113u) \
+ { \
+ s, \
+ true, \
+ { fd, dd, ld64id }, \
+ { fn, dn, ld64in }, \
+ { fz, dz, ld64iz }, \
+ { fu, du, ld64iu } \
+ }
+#elif LDBL_MANT_DIG == 64 && LDBL_MAX_EXP == 16384 && LDBL_MIN_EXP == -16382
+/* This is for the Motorola extended float format. */
+# define TEST(s, fd, fn, fz, fu, dd, dn, dz, du, ld53d, ld53n, ld53z, ld53u, \
+ ld64id, ld64in, ld64iz, ld64iu, \
+ ld64md, ld64mn, ld64mz, ld64mu, \
+ ld106exact, ld106d, ld106n, ld106z, ld106u, \
+ ld113d, ld113n, ld113z, ld113u) \
+ { \
+ s, \
+ true, \
+ { fd, dd, ld64md }, \
+ { fn, dn, ld64mn }, \
+ { fz, dz, ld64mz }, \
+ { fu, du, ld64mu } \
+ }
#elif LDBL_MANT_DIG == 106 && LDBL_MAX_EXP == 1024
-# define TEST(s, fd, fn, fz, fu, dd, dn, dz, du, ld53d, ld53n, ld53z, ld53u, \
- ld64d, ld64n, ld64z, ld64u, ld106exact, \
- ld106d, ld106n, ld106z, ld106u, \
- ld113d, ld113n, ld113z, ld113u) \
- { s, fn, dn, ld106exact, ld106n }
+# define TEST(s, fd, fn, fz, fu, dd, dn, dz, du, ld53d, ld53n, ld53z, ld53u, \
+ ld64id, ld64in, ld64iz, ld64iu, \
+ ld64md, ld64mn, ld64mz, ld64mu, \
+ ld106exact, ld106d, ld106n, ld106z, ld106u, \
+ ld113d, ld113n, ld113z, ld113u) \
+ { \
+ s, \
+ ld106exact, \
+ { fd, dd, ld106d }, \
+ { fn, dn, ld106n }, \
+ { fz, dz, ld106z }, \
+ { fu, du, ld106u } \
+ }
#elif LDBL_MANT_DIG == 113 && LDBL_MAX_EXP == 16384
-# define TEST(s, fd, fn, fz, fu, dd, dn, dz, du, ld53d, ld53n, ld53z, ld53u, \
- ld64d, ld64n, ld64z, ld64u, ld106exact, \
- ld106d, ld106n, ld106z, ld106u, \
- ld113d, ld113n, ld113z, ld113u) \
- { s, fn, dn, true, ld113n }
+# define TEST(s, fd, fn, fz, fu, dd, dn, dz, du, ld53d, ld53n, ld53z, ld53u, \
+ ld64id, ld64in, ld64iz, ld64iu, \
+ ld64md, ld64mn, ld64mz, ld64mu, \
+ ld106exact, ld106d, ld106n, ld106z, ld106u, \
+ ld113d, ld113n, ld113z, ld113u) \
+ { \
+ s, \
+ true, \
+ { fd, dd, ld113d }, \
+ { fn, dn, ld113n }, \
+ { fz, dz, ld113z }, \
+ { fu, du, ld113u } \
+ }
#else
# error "unknown long double format"
#endif
@@ -81,6 +134,10 @@ static const struct test tests[] = {
0x2.0000000000003p+44L,
0x2.0000000000003p+44L,
0x2.0000000000003p+44L,
+ 0x2.0000000000003p+44L,
+ 0x2.0000000000003p+44L,
+ 0x2.0000000000003p+44L,
+ 0x2.0000000000003p+44L,
true,
0x2.0000000000003p+44L,
0x2.0000000000003p+44L,
@@ -107,6 +164,10 @@ static const struct test tests[] = {
0x1.0000010000000002p+0L,
0x1.0000010000000002p+0L,
0x1.0000010000000004p+0L,
+ 0x1.0000010000000002p+0L,
+ 0x1.0000010000000002p+0L,
+ 0x1.0000010000000002p+0L,
+ 0x1.0000010000000004p+0L,
false,
0x1.0000010000000002048242f2ffp+0L,
0x1.0000010000000002048242f2ff8p+0L,
@@ -133,6 +194,10 @@ static const struct test tests[] = {
0x1.0000010000000002p+0L,
0x1.0000010000000002p+0L,
0x1.0000010000000004p+0L,
+ 0x1.0000010000000002p+0L,
+ 0x1.0000010000000002p+0L,
+ 0x1.0000010000000002p+0L,
+ 0x1.0000010000000004p+0L,
false,
0x1.0000010000000002048242f2ffp+0L,
0x1.0000010000000002048242f2ff8p+0L,
@@ -159,6 +224,10 @@ static const struct test tests[] = {
0x1.000001000000000cp+0L,
0x1.000001000000000ap+0L,
0x1.000001000000000cp+0L,
+ 0x1.000001000000000ap+0L,
+ 0x1.000001000000000cp+0L,
+ 0x1.000001000000000ap+0L,
+ 0x1.000001000000000cp+0L,
false,
0x1.000001000000000b3db12bdc21p+0L,
0x1.000001000000000b3db12bdc21p+0L,
@@ -185,6 +254,10 @@ static const struct test tests[] = {
0x1.000000fffffffff8p+0L,
0x1.000000fffffffff8p+0L,
0x1.000000fffffffffap+0L,
+ 0x1.000000fffffffff8p+0L,
+ 0x1.000000fffffffff8p+0L,
+ 0x1.000000fffffffff8p+0L,
+ 0x1.000000fffffffffap+0L,
false,
0x1.000000fffffffff8cb535a09dd8p+0L,
0x1.000000fffffffff8cb535a09dd8p+0L,
@@ -211,6 +284,10 @@ static const struct test tests[] = {
0x1.0000010000000056p+0L,
0x1.0000010000000054p+0L,
0x1.0000010000000056p+0L,
+ 0x1.0000010000000054p+0L,
+ 0x1.0000010000000056p+0L,
+ 0x1.0000010000000054p+0L,
+ 0x1.0000010000000056p+0L,
false,
0x1.0000010000000055072873252f8p+0L,
0x1.0000010000000055072873253p+0L,
@@ -237,6 +314,10 @@ static const struct test tests[] = {
0x1.00000100000001c6p+0L,
0x1.00000100000001c4p+0L,
0x1.00000100000001c6p+0L,
+ 0x1.00000100000001c4p+0L,
+ 0x1.00000100000001c6p+0L,
+ 0x1.00000100000001c4p+0L,
+ 0x1.00000100000001c6p+0L,
false,
0x1.00000100000001c5f67cd79279p+0L,
0x1.00000100000001c5f67cd792798p+0L,
@@ -263,6 +344,10 @@ static const struct test tests[] = {
0x1.000001000000103p+0L,
0x1.000001000000102ep+0L,
0x1.000001000000103p+0L,
+ 0x1.000001000000102ep+0L,
+ 0x1.000001000000103p+0L,
+ 0x1.000001000000102ep+0L,
+ 0x1.000001000000103p+0L,
false,
0x1.000001000000102f4fc8c3d757p+0L,
0x1.000001000000102f4fc8c3d7578p+0L,
@@ -289,6 +374,10 @@ static const struct test tests[] = {
0x1.000000fffffea7e6p+0L,
0x1.000000fffffea7e4p+0L,
0x1.000000fffffea7e6p+0L,
+ 0x1.000000fffffea7e4p+0L,
+ 0x1.000000fffffea7e6p+0L,
+ 0x1.000000fffffea7e4p+0L,
+ 0x1.000000fffffea7e6p+0L,
false,
0x1.000000fffffea7e5975eb11da7p+0L,
0x1.000000fffffea7e5975eb11da78p+0L,
@@ -315,6 +404,10 @@ static const struct test tests[] = {
0x1.000000fffff36598p+0L,
0x1.000000fffff36596p+0L,
0x1.000000fffff36598p+0L,
+ 0x1.000000fffff36596p+0L,
+ 0x1.000000fffff36598p+0L,
+ 0x1.000000fffff36596p+0L,
+ 0x1.000000fffff36598p+0L,
false,
0x1.000000fffff36597d40e1b5026p+0L,
0x1.000000fffff36597d40e1b50268p+0L,
@@ -341,6 +434,10 @@ static const struct test tests[] = {
0x1.000001000063fca2p+0L,
0x1.000001000063fcap+0L,
0x1.000001000063fca2p+0L,
+ 0x1.000001000063fcap+0L,
+ 0x1.000001000063fca2p+0L,
+ 0x1.000001000063fcap+0L,
+ 0x1.000001000063fca2p+0L,
false,
0x1.000001000063fca17533f5572f8p+0L,
0x1.000001000063fca17533f5573p+0L,
@@ -367,6 +464,10 @@ static const struct test tests[] = {
0x1.000000fffae49caap+0L,
0x1.000000fffae49ca8p+0L,
0x1.000000fffae49caap+0L,
+ 0x1.000000fffae49ca8p+0L,
+ 0x1.000000fffae49caap+0L,
+ 0x1.000000fffae49ca8p+0L,
+ 0x1.000000fffae49caap+0L,
false,
0x1.000000fffae49ca916dacfff38p+0L,
0x1.000000fffae49ca916dacfff38p+0L,
@@ -393,6 +494,10 @@ static const struct test tests[] = {
0x1.000000fffae49caap+0L,
0x1.000000fffae49ca8p+0L,
0x1.000000fffae49caap+0L,
+ 0x1.000000fffae49ca8p+0L,
+ 0x1.000000fffae49caap+0L,
+ 0x1.000000fffae49ca8p+0L,
+ 0x1.000000fffae49caap+0L,
false,
0x1.000000fffae49ca916dacfff38p+0L,
0x1.000000fffae49ca916dacfff38p+0L,
@@ -419,6 +524,10 @@ static const struct test tests[] = {
0x1.00000101b2b29a46p+0L,
0x1.00000101b2b29a46p+0L,
0x1.00000101b2b29a48p+0L,
+ 0x1.00000101b2b29a46p+0L,
+ 0x1.00000101b2b29a46p+0L,
+ 0x1.00000101b2b29a46p+0L,
+ 0x1.00000101b2b29a48p+0L,
false,
0x1.00000101b2b29a4692b67b7ca3p+0L,
0x1.00000101b2b29a4692b67b7ca3p+0L,
@@ -445,6 +554,10 @@ static const struct test tests[] = {
0x1.00000101b2b29a46p+0L,
0x1.00000101b2b29a46p+0L,
0x1.00000101b2b29a48p+0L,
+ 0x1.00000101b2b29a46p+0L,
+ 0x1.00000101b2b29a46p+0L,
+ 0x1.00000101b2b29a46p+0L,
+ 0x1.00000101b2b29a48p+0L,
false,
0x1.00000101b2b29a4692b67b7ca3p+0L,
0x1.00000101b2b29a4692b67b7ca3p+0L,
@@ -471,6 +584,10 @@ static const struct test tests[] = {
0x1.000001ad7f29abcap+0L,
0x1.000001ad7f29abcap+0L,
0x1.000001ad7f29abccp+0L,
+ 0x1.000001ad7f29abcap+0L,
+ 0x1.000001ad7f29abcap+0L,
+ 0x1.000001ad7f29abcap+0L,
+ 0x1.000001ad7f29abccp+0L,
false,
0x1.000001ad7f29abcaf485787a65p+0L,
0x1.000001ad7f29abcaf485787a65p+0L,
@@ -497,6 +614,10 @@ static const struct test tests[] = {
0x1p+0L,
0x1p+0L,
0x1p+0L,
+ 0x1p+0L,
+ 0x1p+0L,
+ 0x1p+0L,
+ 0x1p+0L,
true,
0x1p+0L,
0x1p+0L,
@@ -523,6 +644,10 @@ static const struct test tests[] = {
0x1.0000000000000802p+0L,
0x1.00000000000008p+0L,
0x1.0000000000000802p+0L,
+ 0x1.00000000000008p+0L,
+ 0x1.0000000000000802p+0L,
+ 0x1.00000000000008p+0L,
+ 0x1.0000000000000802p+0L,
false,
0x1.0000000000000801fc96557232p+0L,
0x1.0000000000000801fc96557232p+0L,
@@ -549,6 +674,10 @@ static const struct test tests[] = {
0x1.00000000000008p+0L,
0x1.00000000000008p+0L,
0x1.0000000000000802p+0L,
+ 0x1.00000000000008p+0L,
+ 0x1.00000000000008p+0L,
+ 0x1.00000000000008p+0L,
+ 0x1.0000000000000802p+0L,
false,
0x1.00000000000008002459c076c48p+0L,
0x1.00000000000008002459c076c5p+0L,
@@ -575,6 +704,10 @@ static const struct test tests[] = {
0x1.00000000000008p+0L,
0x1.00000000000007fep+0L,
0x1.00000000000008p+0L,
+ 0x1.00000000000007fep+0L,
+ 0x1.00000000000008p+0L,
+ 0x1.00000000000007fep+0L,
+ 0x1.00000000000008p+0L,
false,
0x1.00000000000007fff5207e5dap+0L,
0x1.00000000000007fff5207e5da08p+0L,
@@ -601,6 +734,10 @@ static const struct test tests[] = {
0x1.00000000000008p+0L,
0x1.00000000000007fep+0L,
0x1.00000000000008p+0L,
+ 0x1.00000000000007fep+0L,
+ 0x1.00000000000008p+0L,
+ 0x1.00000000000007fep+0L,
+ 0x1.00000000000008p+0L,
false,
0x1.00000000000007ffc5e73c447b8p+0L,
0x1.00000000000007ffc5e73c447cp+0L,
@@ -627,6 +764,10 @@ static const struct test tests[] = {
0x1.0000000000000802p+0L,
0x1.00000000000008p+0L,
0x1.0000000000000802p+0L,
+ 0x1.00000000000008p+0L,
+ 0x1.0000000000000802p+0L,
+ 0x1.00000000000008p+0L,
+ 0x1.0000000000000802p+0L,
false,
0x1.00000000000008016eea8f26c48p+0L,
0x1.00000000000008016eea8f26c48p+0L,
@@ -653,6 +794,10 @@ static const struct test tests[] = {
0x1.00000000000008p+0L,
0x1.00000000000007fep+0L,
0x1.00000000000008p+0L,
+ 0x1.00000000000007fep+0L,
+ 0x1.00000000000008p+0L,
+ 0x1.00000000000007fep+0L,
+ 0x1.00000000000008p+0L,
false,
0x1.00000000000007ff96adfa2b57p+0L,
0x1.00000000000007ff96adfa2b578p+0L,
@@ -679,6 +824,10 @@ static const struct test tests[] = {
0x1.00000000000007eep+0L,
0x1.00000000000007ecp+0L,
0x1.00000000000007eep+0L,
+ 0x1.00000000000007ecp+0L,
+ 0x1.00000000000007eep+0L,
+ 0x1.00000000000007ecp+0L,
+ 0x1.00000000000007eep+0L,
false,
0x1.00000000000007ed24502859138p+0L,
0x1.00000000000007ed24502859138p+0L,
@@ -705,6 +854,10 @@ static const struct test tests[] = {
0x1.0000000000000734p+0L,
0x1.0000000000000734p+0L,
0x1.0000000000000736p+0L,
+ 0x1.0000000000000734p+0L,
+ 0x1.0000000000000734p+0L,
+ 0x1.0000000000000734p+0L,
+ 0x1.0000000000000736p+0L,
false,
0x1.0000000000000734aca5f6226fp+0L,
0x1.0000000000000734aca5f6226fp+0L,
@@ -731,6 +884,10 @@ static const struct test tests[] = {
0x1.b005314e2421e8p-32L,
0x1.b005314e2421e7fep-32L,
0x1.b005314e2421e8p-32L,
+ 0x1.b005314e2421e7fep-32L,
+ 0x1.b005314e2421e8p-32L,
+ 0x1.b005314e2421e7fep-32L,
+ 0x1.b005314e2421e8p-32L,
false,
0x1.b005314e2421e7ffb472840c5ap-32L,
0x1.b005314e2421e7ffb472840c5a8p-32L,
@@ -759,6 +916,10 @@ static const struct test tests[] = {
0xcp-152L,
0xcp-152L,
0xcp-152L,
+ 0xcp-152L,
+ 0xcp-152L,
+ 0xcp-152L,
+ 0xcp-152L,
true,
0xcp-152L,
0xcp-152L,
@@ -785,6 +946,10 @@ static const struct test tests[] = {
0x1.000001p+0L,
0x1.000000fffffffffep+0L,
0x1.000001p+0L,
+ 0x1.000000fffffffffep+0L,
+ 0x1.000001p+0L,
+ 0x1.000000fffffffffep+0L,
+ 0x1.000001p+0L,
false,
0x1.000000fffffffffffffffce7b78p+0L,
0x1.000000fffffffffffffffce7b8p+0L,
@@ -811,6 +976,10 @@ static const struct test tests[] = {
0x1.000001p+0L,
0x1.000001p+0L,
0x1.000001p+0L,
+ 0x1.000001p+0L,
+ 0x1.000001p+0L,
+ 0x1.000001p+0L,
+ 0x1.000001p+0L,
true,
0x1.000001p+0L,
0x1.000001p+0L,
@@ -837,6 +1006,10 @@ static const struct test tests[] = {
0x1.000001p+0L,
0x1.000001p+0L,
0x1.0000010000000002p+0L,
+ 0x1.000001p+0L,
+ 0x1.000001p+0L,
+ 0x1.000001p+0L,
+ 0x1.0000010000000002p+0L,
false,
0x1.00000100000000000000031848p+0L,
0x1.00000100000000000000031848p+0L,
@@ -863,6 +1036,10 @@ static const struct test tests[] = {
0x1.000002p+0L,
0x1.000002p+0L,
0x1.000002p+0L,
+ 0x1.000002p+0L,
+ 0x1.000002p+0L,
+ 0x1.000002p+0L,
+ 0x1.000002p+0L,
true,
0x1.000002p+0L,
0x1.000002p+0L,
@@ -889,6 +1066,10 @@ static const struct test tests[] = {
0x1.000003p+0L,
0x1.000002fffffffffep+0L,
0x1.000003p+0L,
+ 0x1.000002fffffffffep+0L,
+ 0x1.000003p+0L,
+ 0x1.000002fffffffffep+0L,
+ 0x1.000003p+0L,
false,
0x1.000002fffffffffffffffce7b78p+0L,
0x1.000002fffffffffffffffce7b8p+0L,
@@ -915,6 +1096,10 @@ static const struct test tests[] = {
0x1.000003p+0L,
0x1.000003p+0L,
0x1.000003p+0L,
+ 0x1.000003p+0L,
+ 0x1.000003p+0L,
+ 0x1.000003p+0L,
+ 0x1.000003p+0L,
true,
0x1.000003p+0L,
0x1.000003p+0L,
@@ -941,6 +1126,10 @@ static const struct test tests[] = {
0x1.000003p+0L,
0x1.000003p+0L,
0x1.0000030000000002p+0L,
+ 0x1.000003p+0L,
+ 0x1.000003p+0L,
+ 0x1.000003p+0L,
+ 0x1.0000030000000002p+0L,
false,
0x1.00000300000000000000031848p+0L,
0x1.00000300000000000000031848p+0L,
@@ -967,6 +1156,10 @@ static const struct test tests[] = {
0x1.000004p+0L,
0x1.000004p+0L,
0x1.000004p+0L,
+ 0x1.000004p+0L,
+ 0x1.000004p+0L,
+ 0x1.000004p+0L,
+ 0x1.000004p+0L,
true,
0x1.000004p+0L,
0x1.000004p+0L,
@@ -993,6 +1186,10 @@ static const struct test tests[] = {
0x2p-64L,
0x2p-64L,
0x2p-64L,
+ 0x2p-64L,
+ 0x2p-64L,
+ 0x2p-64L,
+ 0x2p-64L,
true,
0x2p-64L,
0x2p-64L,
@@ -1020,6 +1217,10 @@ static const struct test tests[] = {
0x2.000002p-64L,
0x2.000001fffffffffcp-64L,
0x2.000002p-64L,
+ 0x2.000001fffffffffcp-64L,
+ 0x2.000002p-64L,
+ 0x2.000001fffffffffcp-64L,
+ 0x2.000002p-64L,
false,
0x2.000001ffffffffffffffffffffp-64L,
0x2.000002p-64L,
@@ -1047,6 +1248,10 @@ static const struct test tests[] = {
0x2.000002p-64L,
0x2.000002p-64L,
0x2.000002p-64L,
+ 0x2.000002p-64L,
+ 0x2.000002p-64L,
+ 0x2.000002p-64L,
+ 0x2.000002p-64L,
true,
0x2.000002p-64L,
0x2.000002p-64L,
@@ -1074,6 +1279,10 @@ static const struct test tests[] = {
0x2.000002p-64L,
0x2.000002p-64L,
0x2.0000020000000004p-64L,
+ 0x2.000002p-64L,
+ 0x2.000002p-64L,
+ 0x2.000002p-64L,
+ 0x2.0000020000000004p-64L,
false,
0x2.000002p-64L,
0x2.000002p-64L,
@@ -1101,6 +1310,10 @@ static const struct test tests[] = {
0x2.000004p-64L,
0x2.000004p-64L,
0x2.000004p-64L,
+ 0x2.000004p-64L,
+ 0x2.000004p-64L,
+ 0x2.000004p-64L,
+ 0x2.000004p-64L,
true,
0x2.000004p-64L,
0x2.000004p-64L,
@@ -1128,6 +1341,10 @@ static const struct test tests[] = {
0x2.000006p-64L,
0x2.000005fffffffffcp-64L,
0x2.000006p-64L,
+ 0x2.000005fffffffffcp-64L,
+ 0x2.000006p-64L,
+ 0x2.000005fffffffffcp-64L,
+ 0x2.000006p-64L,
false,
0x2.000005ffffffffffffffffffffp-64L,
0x2.000006p-64L,
@@ -1155,6 +1372,10 @@ static const struct test tests[] = {
0x2.000006p-64L,
0x2.000006p-64L,
0x2.000006p-64L,
+ 0x2.000006p-64L,
+ 0x2.000006p-64L,
+ 0x2.000006p-64L,
+ 0x2.000006p-64L,
true,
0x2.000006p-64L,
0x2.000006p-64L,
@@ -1182,6 +1403,10 @@ static const struct test tests[] = {
0x2.000006p-64L,
0x2.000006p-64L,
0x2.0000060000000004p-64L,
+ 0x2.000006p-64L,
+ 0x2.000006p-64L,
+ 0x2.000006p-64L,
+ 0x2.0000060000000004p-64L,
false,
0x2.000006p-64L,
0x2.000006p-64L,
@@ -1209,6 +1434,10 @@ static const struct test tests[] = {
0x2.000008p-64L,
0x2.000008p-64L,
0x2.000008p-64L,
+ 0x2.000008p-64L,
+ 0x2.000008p-64L,
+ 0x2.000008p-64L,
+ 0x2.000008p-64L,
true,
0x2.000008p-64L,
0x2.000008p-64L,
@@ -1236,6 +1465,10 @@ static const struct test tests[] = {
0x1p-120L,
0x1p-120L,
0x1p-120L,
+ 0x1p-120L,
+ 0x1p-120L,
+ 0x1p-120L,
+ 0x1p-120L,
true,
0x1p-120L,
0x1p-120L,
@@ -1263,6 +1496,10 @@ static const struct test tests[] = {
0x1.000001p-120L,
0x1.000000fffffffffep-120L,
0x1.000001p-120L,
+ 0x1.000000fffffffffep-120L,
+ 0x1.000001p-120L,
+ 0x1.000000fffffffffep-120L,
+ 0x1.000001p-120L,
false,
0x1.000000ffffffffffffffffffff8p-120L,
0x1.000001p-120L,
@@ -1290,6 +1527,10 @@ static const struct test tests[] = {
0x1.000001p-120L,
0x1.000001p-120L,
0x1.000001p-120L,
+ 0x1.000001p-120L,
+ 0x1.000001p-120L,
+ 0x1.000001p-120L,
+ 0x1.000001p-120L,
true,
0x1.000001p-120L,
0x1.000001p-120L,
@@ -1317,6 +1558,10 @@ static const struct test tests[] = {
0x1.000001p-120L,
0x1.000001p-120L,
0x1.0000010000000002p-120L,
+ 0x1.000001p-120L,
+ 0x1.000001p-120L,
+ 0x1.000001p-120L,
+ 0x1.0000010000000002p-120L,
false,
0x1.000001p-120L,
0x1.000001p-120L,
@@ -1344,6 +1589,10 @@ static const struct test tests[] = {
0x1.000002p-120L,
0x1.000002p-120L,
0x1.000002p-120L,
+ 0x1.000002p-120L,
+ 0x1.000002p-120L,
+ 0x1.000002p-120L,
+ 0x1.000002p-120L,
true,
0x1.000002p-120L,
0x1.000002p-120L,
@@ -1371,6 +1620,10 @@ static const struct test tests[] = {
0x1.000003p-120L,
0x1.000002fffffffffep-120L,
0x1.000003p-120L,
+ 0x1.000002fffffffffep-120L,
+ 0x1.000003p-120L,
+ 0x1.000002fffffffffep-120L,
+ 0x1.000003p-120L,
false,
0x1.000002ffffffffffffffffffff8p-120L,
0x1.000003p-120L,
@@ -1398,6 +1651,10 @@ static const struct test tests[] = {
0x1.000003p-120L,
0x1.000003p-120L,
0x1.000003p-120L,
+ 0x1.000003p-120L,
+ 0x1.000003p-120L,
+ 0x1.000003p-120L,
+ 0x1.000003p-120L,
true,
0x1.000003p-120L,
0x1.000003p-120L,
@@ -1425,6 +1682,10 @@ static const struct test tests[] = {
0x1.000003p-120L,
0x1.000003p-120L,
0x1.0000030000000002p-120L,
+ 0x1.000003p-120L,
+ 0x1.000003p-120L,
+ 0x1.000003p-120L,
+ 0x1.0000030000000002p-120L,
false,
0x1.000003p-120L,
0x1.000003p-120L,
@@ -1452,6 +1713,10 @@ static const struct test tests[] = {
0x1.000004p-120L,
0x1.000004p-120L,
0x1.000004p-120L,
+ 0x1.000004p-120L,
+ 0x1.000004p-120L,
+ 0x1.000004p-120L,
+ 0x1.000004p-120L,
true,
0x1.000004p-120L,
0x1.000004p-120L,
@@ -1478,6 +1743,10 @@ static const struct test tests[] = {
0xf.fffff8p+124L,
0xf.fffff7fffffffffp+124L,
0xf.fffff8p+124L,
+ 0xf.fffff7fffffffffp+124L,
+ 0xf.fffff8p+124L,
+ 0xf.fffff7fffffffffp+124L,
+ 0xf.fffff8p+124L,
false,
0xf.fffff7fffffffffffffffffffcp+124L,
0xf.fffff8p+124L,
@@ -1504,6 +1773,10 @@ static const struct test tests[] = {
0xf.fffff8p+124L,
0xf.fffff8p+124L,
0xf.fffff8p+124L,
+ 0xf.fffff8p+124L,
+ 0xf.fffff8p+124L,
+ 0xf.fffff8p+124L,
+ 0xf.fffff8p+124L,
true,
0xf.fffff8p+124L,
0xf.fffff8p+124L,
@@ -1530,6 +1803,10 @@ static const struct test tests[] = {
0xf.fffff8p+124L,
0xf.fffff8p+124L,
0xf.fffff8000000001p+124L,
+ 0xf.fffff8p+124L,
+ 0xf.fffff8p+124L,
+ 0xf.fffff8p+124L,
+ 0xf.fffff8000000001p+124L,
false,
0xf.fffff8p+124L,
0xf.fffff8p+124L,
@@ -1556,6 +1833,10 @@ static const struct test tests[] = {
-0xf.fffff8p+124L,
-0xf.fffff7fffffffffp+124L,
-0xf.fffff7fffffffffp+124L,
+ -0xf.fffff8p+124L,
+ -0xf.fffff8p+124L,
+ -0xf.fffff7fffffffffp+124L,
+ -0xf.fffff7fffffffffp+124L,
false,
-0xf.fffff8p+124L,
-0xf.fffff8p+124L,
@@ -1582,6 +1863,10 @@ static const struct test tests[] = {
-0xf.fffff8p+124L,
-0xf.fffff8p+124L,
-0xf.fffff8p+124L,
+ -0xf.fffff8p+124L,
+ -0xf.fffff8p+124L,
+ -0xf.fffff8p+124L,
+ -0xf.fffff8p+124L,
true,
-0xf.fffff8p+124L,
-0xf.fffff8p+124L,
@@ -1608,6 +1893,10 @@ static const struct test tests[] = {
-0xf.fffff8p+124L,
-0xf.fffff8p+124L,
-0xf.fffff8p+124L,
+ -0xf.fffff8000000001p+124L,
+ -0xf.fffff8p+124L,
+ -0xf.fffff8p+124L,
+ -0xf.fffff8p+124L,
false,
-0xf.fffff800000000000000000004p+124L,
-0xf.fffff8p+124L,
@@ -1639,6 +1928,10 @@ static const struct test tests[] = {
0xf.ffffffffffffcp+1020L,
0xf.ffffffffffffbffp+1020L,
0xf.ffffffffffffcp+1020L,
+ 0xf.ffffffffffffbffp+1020L,
+ 0xf.ffffffffffffcp+1020L,
+ 0xf.ffffffffffffbffp+1020L,
+ 0xf.ffffffffffffcp+1020L,
false,
0xf.ffffffffffffbffffffffffffcp+1020L,
0xf.ffffffffffffcp+1020L,
@@ -1670,7 +1963,11 @@ static const struct test tests[] = {
0xf.ffffffffffffcp+1020L,
0xf.ffffffffffffcp+1020L,
0xf.ffffffffffffcp+1020L,
- true,
+ 0xf.ffffffffffffcp+1020L,
+ 0xf.ffffffffffffcp+1020L,
+ 0xf.ffffffffffffcp+1020L,
+ 0xf.ffffffffffffcp+1020L,
+ false,
0xf.ffffffffffffcp+1020L,
0xf.ffffffffffffcp+1020L,
0xf.ffffffffffffcp+1020L,
@@ -1701,6 +1998,10 @@ static const struct test tests[] = {
0xf.ffffffffffffcp+1020L,
0xf.ffffffffffffcp+1020L,
0xf.ffffffffffffc01p+1020L,
+ 0xf.ffffffffffffcp+1020L,
+ 0xf.ffffffffffffcp+1020L,
+ 0xf.ffffffffffffcp+1020L,
+ 0xf.ffffffffffffc01p+1020L,
false,
0xf.ffffffffffffcp+1020L,
0xf.ffffffffffffcp+1020L,
@@ -1732,6 +2033,10 @@ static const struct test tests[] = {
-0xf.ffffffffffffcp+1020L,
-0xf.ffffffffffffbffp+1020L,
-0xf.ffffffffffffbffp+1020L,
+ -0xf.ffffffffffffcp+1020L,
+ -0xf.ffffffffffffcp+1020L,
+ -0xf.ffffffffffffbffp+1020L,
+ -0xf.ffffffffffffbffp+1020L,
false,
-0xf.ffffffffffffcp+1020L,
-0xf.ffffffffffffcp+1020L,
@@ -1763,7 +2068,11 @@ static const struct test tests[] = {
-0xf.ffffffffffffcp+1020L,
-0xf.ffffffffffffcp+1020L,
-0xf.ffffffffffffcp+1020L,
- true,
+ -0xf.ffffffffffffcp+1020L,
+ -0xf.ffffffffffffcp+1020L,
+ -0xf.ffffffffffffcp+1020L,
+ -0xf.ffffffffffffcp+1020L,
+ false,
-0xf.ffffffffffffcp+1020L,
-0xf.ffffffffffffcp+1020L,
-0xf.ffffffffffffcp+1020L,
@@ -1794,6 +2103,10 @@ static const struct test tests[] = {
-0xf.ffffffffffffcp+1020L,
-0xf.ffffffffffffcp+1020L,
-0xf.ffffffffffffcp+1020L,
+ -0xf.ffffffffffffc01p+1020L,
+ -0xf.ffffffffffffcp+1020L,
+ -0xf.ffffffffffffcp+1020L,
+ -0xf.ffffffffffffcp+1020L,
false,
-0xf.ffffffffffffc0000000000004p+1020L,
-0xf.ffffffffffffcp+1020L,
@@ -1902,6 +2215,10 @@ static const struct test tests[] = {
0xf.fffffffffffffffp+16380L,
0xf.fffffffffffffffp+16380L,
INFINITY,
+ 0xf.fffffffffffffffp+16380L,
+ 0xf.fffffffffffffffp+16380L,
+ 0xf.fffffffffffffffp+16380L,
+ INFINITY,
false,
0xf.fffffffffffffffffffffffffcp+1020L,
INFINITY,
@@ -2010,6 +2327,10 @@ static const struct test tests[] = {
INFINITY,
0xf.fffffffffffffffp+16380L,
INFINITY,
+ 0xf.fffffffffffffffp+16380L,
+ INFINITY,
+ 0xf.fffffffffffffffp+16380L,
+ INFINITY,
false,
0xf.fffffffffffffffffffffffffcp+1020L,
INFINITY,
@@ -2118,6 +2439,10 @@ static const struct test tests[] = {
INFINITY,
0xf.fffffffffffffffp+16380L,
INFINITY,
+ 0xf.fffffffffffffffp+16380L,
+ INFINITY,
+ 0xf.fffffffffffffffp+16380L,
+ INFINITY,
false,
0xf.fffffffffffffffffffffffffcp+1020L,
INFINITY,
@@ -2226,6 +2551,10 @@ static const struct test tests[] = {
-0xf.fffffffffffffffp+16380L,
-0xf.fffffffffffffffp+16380L,
-0xf.fffffffffffffffp+16380L,
+ -INFINITY,
+ -0xf.fffffffffffffffp+16380L,
+ -0xf.fffffffffffffffp+16380L,
+ -0xf.fffffffffffffffp+16380L,
false,
-INFINITY,
-INFINITY,
@@ -2334,6 +2663,10 @@ static const struct test tests[] = {
-INFINITY,
-0xf.fffffffffffffffp+16380L,
-0xf.fffffffffffffffp+16380L,
+ -INFINITY,
+ -INFINITY,
+ -0xf.fffffffffffffffp+16380L,
+ -0xf.fffffffffffffffp+16380L,
false,
-INFINITY,
-INFINITY,
@@ -2442,6 +2775,10 @@ static const struct test tests[] = {
-INFINITY,
-0xf.fffffffffffffffp+16380L,
-0xf.fffffffffffffffp+16380L,
+ -INFINITY,
+ -INFINITY,
+ -0xf.fffffffffffffffp+16380L,
+ -0xf.fffffffffffffffp+16380L,
false,
-INFINITY,
-INFINITY,
@@ -2550,6 +2887,10 @@ static const struct test tests[] = {
INFINITY,
0xf.fffffffffffffffp+16380L,
INFINITY,
+ 0xf.fffffffffffffffp+16380L,
+ INFINITY,
+ 0xf.fffffffffffffffp+16380L,
+ INFINITY,
false,
0xf.fffffffffffffffffffffffffcp+1020L,
INFINITY,
@@ -2658,6 +2999,10 @@ static const struct test tests[] = {
INFINITY,
0xf.fffffffffffffffp+16380L,
INFINITY,
+ 0xf.fffffffffffffffp+16380L,
+ INFINITY,
+ 0xf.fffffffffffffffp+16380L,
+ INFINITY,
false,
0xf.fffffffffffffffffffffffffcp+1020L,
INFINITY,
@@ -2766,6 +3111,10 @@ static const struct test tests[] = {
INFINITY,
0xf.fffffffffffffffp+16380L,
INFINITY,
+ 0xf.fffffffffffffffp+16380L,
+ INFINITY,
+ 0xf.fffffffffffffffp+16380L,
+ INFINITY,
false,
0xf.fffffffffffffffffffffffffcp+1020L,
INFINITY,
@@ -2874,6 +3223,10 @@ static const struct test tests[] = {
-INFINITY,
-0xf.fffffffffffffffp+16380L,
-0xf.fffffffffffffffp+16380L,
+ -INFINITY,
+ -INFINITY,
+ -0xf.fffffffffffffffp+16380L,
+ -0xf.fffffffffffffffp+16380L,
false,
-INFINITY,
-INFINITY,
@@ -2982,6 +3335,10 @@ static const struct test tests[] = {
-INFINITY,
-0xf.fffffffffffffffp+16380L,
-0xf.fffffffffffffffp+16380L,
+ -INFINITY,
+ -INFINITY,
+ -0xf.fffffffffffffffp+16380L,
+ -0xf.fffffffffffffffp+16380L,
false,
-INFINITY,
-INFINITY,
@@ -3090,6 +3447,10 @@ static const struct test tests[] = {
-INFINITY,
-0xf.fffffffffffffffp+16380L,
-0xf.fffffffffffffffp+16380L,
+ -INFINITY,
+ -INFINITY,
+ -0xf.fffffffffffffffp+16380L,
+ -0xf.fffffffffffffffp+16380L,
false,
-INFINITY,
-INFINITY,
@@ -3117,6 +3478,10 @@ static const struct test tests[] = {
0xcp-152L,
0xb.fffffffffffffffp-152L,
0xcp-152L,
+ 0xb.fffffffffffffffp-152L,
+ 0xcp-152L,
+ 0xb.fffffffffffffffp-152L,
+ 0xcp-152L,
false,
0xb.fffffffffffffffffffffffffcp-152L,
0xcp-152L,
@@ -3144,6 +3509,10 @@ static const struct test tests[] = {
0xcp-152L,
0xcp-152L,
0xcp-152L,
+ 0xcp-152L,
+ 0xcp-152L,
+ 0xcp-152L,
+ 0xcp-152L,
true,
0xcp-152L,
0xcp-152L,
@@ -3171,6 +3540,10 @@ static const struct test tests[] = {
0xcp-152L,
0xcp-152L,
0xc.000000000000001p-152L,
+ 0xcp-152L,
+ 0xcp-152L,
+ 0xcp-152L,
+ 0xc.000000000000001p-152L,
false,
0xcp-152L,
0xcp-152L,
@@ -3198,6 +3571,10 @@ static const struct test tests[] = {
-0xcp-152L,
-0xb.fffffffffffffffp-152L,
-0xb.fffffffffffffffp-152L,
+ -0xcp-152L,
+ -0xcp-152L,
+ -0xb.fffffffffffffffp-152L,
+ -0xb.fffffffffffffffp-152L,
false,
-0xcp-152L,
-0xcp-152L,
@@ -3225,6 +3602,10 @@ static const struct test tests[] = {
-0xcp-152L,
-0xcp-152L,
-0xcp-152L,
+ -0xcp-152L,
+ -0xcp-152L,
+ -0xcp-152L,
+ -0xcp-152L,
true,
-0xcp-152L,
-0xcp-152L,
@@ -3252,6 +3633,10 @@ static const struct test tests[] = {
-0xcp-152L,
-0xcp-152L,
-0xcp-152L,
+ -0xc.000000000000001p-152L,
+ -0xcp-152L,
+ -0xcp-152L,
+ -0xcp-152L,
false,
-0xc.00000000000000000000000004p-152L,
-0xcp-152L,
@@ -3279,6 +3664,10 @@ static const struct test tests[] = {
0x1.4p-148L,
0x1.3ffffffffffffffep-148L,
0x1.4p-148L,
+ 0x1.3ffffffffffffffep-148L,
+ 0x1.4p-148L,
+ 0x1.3ffffffffffffffep-148L,
+ 0x1.4p-148L,
false,
0x1.3fffffffffffffffffffffffff8p-148L,
0x1.4p-148L,
@@ -3306,6 +3695,10 @@ static const struct test tests[] = {
0x1.4p-148L,
0x1.4p-148L,
0x1.4p-148L,
+ 0x1.4p-148L,
+ 0x1.4p-148L,
+ 0x1.4p-148L,
+ 0x1.4p-148L,
true,
0x1.4p-148L,
0x1.4p-148L,
@@ -3333,6 +3726,10 @@ static const struct test tests[] = {
0x1.4p-148L,
0x1.4p-148L,
0x1.4000000000000002p-148L,
+ 0x1.4p-148L,
+ 0x1.4p-148L,
+ 0x1.4p-148L,
+ 0x1.4000000000000002p-148L,
false,
0x1.4p-148L,
0x1.4p-148L,
@@ -3360,6 +3757,10 @@ static const struct test tests[] = {
-0x1.4p-148L,
-0x1.3ffffffffffffffep-148L,
-0x1.3ffffffffffffffep-148L,
+ -0x1.4p-148L,
+ -0x1.4p-148L,
+ -0x1.3ffffffffffffffep-148L,
+ -0x1.3ffffffffffffffep-148L,
false,
-0x1.4p-148L,
-0x1.4p-148L,
@@ -3387,6 +3788,10 @@ static const struct test tests[] = {
-0x1.4p-148L,
-0x1.4p-148L,
-0x1.4p-148L,
+ -0x1.4p-148L,
+ -0x1.4p-148L,
+ -0x1.4p-148L,
+ -0x1.4p-148L,
true,
-0x1.4p-148L,
-0x1.4p-148L,
@@ -3414,6 +3819,10 @@ static const struct test tests[] = {
-0x1.4p-148L,
-0x1.4p-148L,
-0x1.4p-148L,
+ -0x1.4000000000000002p-148L,
+ -0x1.4p-148L,
+ -0x1.4p-148L,
+ -0x1.4p-148L,
false,
-0x1.400000000000000000000000008p-148L,
-0x1.4p-148L,
@@ -3452,6 +3861,10 @@ static const struct test tests[] = {
0x6p-1076L,
0x5.fffffffffffffff8p-1076L,
0x6p-1076L,
+ 0x5.fffffffffffffff8p-1076L,
+ 0x6p-1076L,
+ 0x5.fffffffffffffff8p-1076L,
+ 0x6p-1076L,
false,
0x4p-1076L,
0x4p-1076L,
@@ -3490,6 +3903,10 @@ static const struct test tests[] = {
0x6p-1076L,
0x6p-1076L,
0x6p-1076L,
+ 0x6p-1076L,
+ 0x6p-1076L,
+ 0x6p-1076L,
+ 0x6p-1076L,
true,
0x4p-1076L,
0x8p-1076L,
@@ -3528,6 +3945,10 @@ static const struct test tests[] = {
0x6p-1076L,
0x6p-1076L,
0x6.0000000000000008p-1076L,
+ 0x6p-1076L,
+ 0x6p-1076L,
+ 0x6p-1076L,
+ 0x6.0000000000000008p-1076L,
false,
0x4p-1076L,
0x8p-1076L,
@@ -3566,6 +3987,10 @@ static const struct test tests[] = {
-0x6p-1076L,
-0x5.fffffffffffffff8p-1076L,
-0x5.fffffffffffffff8p-1076L,
+ -0x6p-1076L,
+ -0x6p-1076L,
+ -0x5.fffffffffffffff8p-1076L,
+ -0x5.fffffffffffffff8p-1076L,
false,
-0x8p-1076L,
-0x4p-1076L,
@@ -3604,6 +4029,10 @@ static const struct test tests[] = {
-0x6p-1076L,
-0x6p-1076L,
-0x6p-1076L,
+ -0x6p-1076L,
+ -0x6p-1076L,
+ -0x6p-1076L,
+ -0x6p-1076L,
true,
-0x8p-1076L,
-0x8p-1076L,
@@ -3642,6 +4071,10 @@ static const struct test tests[] = {
-0x6p-1076L,
-0x6p-1076L,
-0x6p-1076L,
+ -0x6.0000000000000008p-1076L,
+ -0x6p-1076L,
+ -0x6p-1076L,
+ -0x6p-1076L,
false,
-0x8p-1076L,
-0x8p-1076L,
@@ -3859,6 +4292,10 @@ static const struct test tests[] = {
0x8p-16448L,
0x8p-16448L,
0x1p-16444L,
+ 0x8p-16448L,
+ 0xcp-16448L,
+ 0x8p-16448L,
+ 0xcp-16448L,
false,
0x0p+0L,
0x0p+0L,
@@ -4076,6 +4513,10 @@ static const struct test tests[] = {
0x1p-16444L,
0x8p-16448L,
0x1p-16444L,
+ 0xcp-16448L,
+ 0xcp-16448L,
+ 0xcp-16448L,
+ 0xcp-16448L,
false,
0x0p+0L,
0x0p+0L,
@@ -4293,6 +4734,10 @@ static const struct test tests[] = {
0x1p-16444L,
0x8p-16448L,
0x1p-16444L,
+ 0xcp-16448L,
+ 0xcp-16448L,
+ 0xcp-16448L,
+ 0x1p-16444L,
false,
0x0p+0L,
0x0p+0L,
@@ -4510,6 +4955,10 @@ static const struct test tests[] = {
-0x8p-16448L,
-0x8p-16448L,
-0x8p-16448L,
+ -0xcp-16448L,
+ -0xcp-16448L,
+ -0x8p-16448L,
+ -0x8p-16448L,
false,
-0x4p-1076L,
-0x0p+0L,
@@ -4727,6 +5176,10 @@ static const struct test tests[] = {
-0x1p-16444L,
-0x8p-16448L,
-0x8p-16448L,
+ -0xcp-16448L,
+ -0xcp-16448L,
+ -0xcp-16448L,
+ -0xcp-16448L,
false,
-0x4p-1076L,
-0x0p+0L,
@@ -4944,6 +5397,10 @@ static const struct test tests[] = {
-0x1p-16444L,
-0x8p-16448L,
-0x8p-16448L,
+ -0x1p-16444L,
+ -0xcp-16448L,
+ -0xcp-16448L,
+ -0xcp-16448L,
false,
-0x4p-1076L,
-0x0p+0L,
@@ -5161,6 +5618,10 @@ static const struct test tests[] = {
0x8p-16448L,
0x8p-16448L,
0x1p-16444L,
+ 0x8p-16448L,
+ 0xcp-16448L,
+ 0x8p-16448L,
+ 0xcp-16448L,
false,
0x0p+0L,
0x0p+0L,
@@ -5378,6 +5839,10 @@ static const struct test tests[] = {
0x1p-16444L,
0x8p-16448L,
0x1p-16444L,
+ 0xcp-16448L,
+ 0xcp-16448L,
+ 0xcp-16448L,
+ 0xcp-16448L,
false,
0x0p+0L,
0x0p+0L,
@@ -5595,6 +6060,10 @@ static const struct test tests[] = {
0x1p-16444L,
0x8p-16448L,
0x1p-16444L,
+ 0xcp-16448L,
+ 0xcp-16448L,
+ 0xcp-16448L,
+ 0x1p-16444L,
false,
0x0p+0L,
0x0p+0L,
@@ -5812,6 +6281,10 @@ static const struct test tests[] = {
-0x8p-16448L,
-0x8p-16448L,
-0x8p-16448L,
+ -0xcp-16448L,
+ -0xcp-16448L,
+ -0x8p-16448L,
+ -0x8p-16448L,
false,
-0x4p-1076L,
-0x0p+0L,
@@ -6029,6 +6502,10 @@ static const struct test tests[] = {
-0x1p-16444L,
-0x8p-16448L,
-0x8p-16448L,
+ -0xcp-16448L,
+ -0xcp-16448L,
+ -0xcp-16448L,
+ -0xcp-16448L,
false,
-0x4p-1076L,
-0x0p+0L,
@@ -6246,6 +6723,10 @@ static const struct test tests[] = {
-0x1p-16444L,
-0x8p-16448L,
-0x8p-16448L,
+ -0x1p-16444L,
+ -0xcp-16448L,
+ -0xcp-16448L,
+ -0xcp-16448L,
false,
-0x4p-1076L,
-0x0p+0L,
@@ -6272,6 +6753,10 @@ static const struct test tests[] = {
-0x3.8p-152L,
-0x3.8p-152L,
-0x3.8p-152L,
+ -0x3.8p-152L,
+ -0x3.8p-152L,
+ -0x3.8p-152L,
+ -0x3.8p-152L,
true,
-0x3.8p-152L,
-0x3.8p-152L,
@@ -6298,6 +6783,10 @@ static const struct test tests[] = {
-0x1.cp-1076L,
-0x1.cp-1076L,
-0x1.cp-1076L,
+ -0x1.cp-1076L,
+ -0x1.cp-1076L,
+ -0x1.cp-1076L,
+ -0x1.cp-1076L,
false,
-0x4p-1076L,
-0x0p+0L,
@@ -6324,6 +6813,10 @@ static const struct test tests[] = {
-0x0p+0L,
-0x0p+0L,
-0x0p+0L,
+ -0x4p-16448L,
+ -0x4p-16448L,
+ -0x0p+0L,
+ -0x0p+0L,
false,
-0x4p-1076L,
-0x0p+0L,
@@ -6350,6 +6843,10 @@ static const struct test tests[] = {
-0x0p+0L,
-0x0p+0L,
-0x0p+0L,
+ -0x4p-16448L,
+ -0x0p+0L,
+ -0x0p+0L,
+ -0x0p+0L,
false,
-0x4p-1076L,
-0x0p+0L,
@@ -6362,38 +6859,73 @@ static const struct test tests[] = {
};
static int
+test_in_one_mode (const char *s, const struct test_results *expected,
+ bool ld_ok, const char *mode_name)
+{
+ int result = 0;
+ float f = strtof (s, NULL);
+ double d = strtod (s, NULL);
+ long double ld = strtold (s, NULL);
+ if (f != expected->f
+ || copysignf (1.0f, f) != copysignf (1.0f, expected->f))
+ {
+ printf ("strtof (%s) returned %a not %a (%s)\n", s, f,
+ expected->f, mode_name);
+ result = 1;
+ }
+ if (d != expected->d
+ || copysign (1.0, d) != copysign (1.0, expected->d))
+ {
+ printf ("strtod (%s) returned %a not %a (%s)\n", s, d,
+ expected->d, mode_name);
+ result = 1;
+ }
+ if (ld != expected->ld
+ || copysignl (1.0L, ld) != copysignl (1.0L, expected->ld))
+ {
+ printf ("strtold (%s) returned %La not %La (%s)\n", s, ld,
+ expected->ld, mode_name);
+ if (ld_ok)
+ result = 1;
+ else
+ printf ("ignoring this inexact long double result\n");
+ }
+ return result;
+}
+
+static int
do_test (void)
{
+ int save_round_mode = fegetround ();
int result = 0;
for (size_t i = 0; i < sizeof (tests) / sizeof (tests[0]); i++)
{
- float f = strtof (tests[i].s, NULL);
- double d = strtod (tests[i].s, NULL);
- long double ld = strtold (tests[i].s, NULL);
- if (f != tests[i].f
- || copysignf (1.0f, f) != copysignf (1.0f, tests[i].f))
+ result |= test_in_one_mode (tests[i].s, &tests[i].rn, tests[i].ld_ok,
+ "default rounding mode");
+#ifdef FE_DOWNWARD
+ if (!fesetround (FE_DOWNWARD))
{
- printf ("strtof (%s) returned %a not %a\n", tests[i].s, f,
- tests[i].f);
- result = 1;
+ result |= test_in_one_mode (tests[i].s, &tests[i].rd, tests[i].ld_ok,
+ "FE_DOWNWARD");
+ fesetround (save_round_mode);
}
- if (d != tests[i].d
- || copysign (1.0, d) != copysign (1.0, tests[i].d))
+#endif
+#ifdef FE_TOWARDZERO
+ if (!fesetround (FE_TOWARDZERO))
{
- printf ("strtod (%s) returned %a not %a\n", tests[i].s, d,
- tests[i].d);
- result = 1;
+ result |= test_in_one_mode (tests[i].s, &tests[i].rz, tests[i].ld_ok,
+ "FE_TOWARDZERO");
+ fesetround (save_round_mode);
}
- if (ld != tests[i].ld
- || copysignl (1.0L, ld) != copysignl (1.0L, tests[i].ld))
+#endif
+#ifdef FE_UPWARD
+ if (!fesetround (FE_UPWARD))
{
- printf ("strtold (%s) returned %La not %La\n", tests[i].s, ld,
- tests[i].ld);
- if (tests[i].ld_ok)
- result = 1;
- else
- printf ("ignoring this inexact long double result\n");
+ result |= test_in_one_mode (tests[i].s, &tests[i].ru, tests[i].ld_ok,
+ "FE_UPWARD");
+ fesetround (save_round_mode);
}
+#endif
}
return result;
}