diff options
Diffstat (limited to 'stdlib')
-rw-r--r-- | stdlib/gen-tst-strtod-round.c | 15 | ||||
-rw-r--r-- | stdlib/tst-strtod-round.c | 4 |
2 files changed, 16 insertions, 3 deletions
diff --git a/stdlib/gen-tst-strtod-round.c b/stdlib/gen-tst-strtod-round.c index f4ad270..56aafab 100644 --- a/stdlib/gen-tst-strtod-round.c +++ b/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"); diff --git a/stdlib/tst-strtod-round.c b/stdlib/tst-strtod-round.c index 1edeff6..c6ad126 100644 --- a/stdlib/tst-strtod-round.c +++ b/stdlib/tst-strtod-round.c @@ -1927,7 +1927,7 @@ static const struct test tests[] = { 0xf.ffffffffffffcp+1020L, 0xf.ffffffffffffcp+1020L, 0xf.ffffffffffffcp+1020L, - true, + false, 0xf.ffffffffffffcp+1020L, 0xf.ffffffffffffcp+1020L, 0xf.ffffffffffffcp+1020L, @@ -2032,7 +2032,7 @@ static const struct test tests[] = { -0xf.ffffffffffffcp+1020L, -0xf.ffffffffffffcp+1020L, -0xf.ffffffffffffcp+1020L, - true, + false, -0xf.ffffffffffffcp+1020L, -0xf.ffffffffffffcp+1020L, -0xf.ffffffffffffcp+1020L, |