mirror of
https://sourceware.org/git/glibc.git
synced 2025-10-18 16:09:06 +03:00
Rework tst-strtod-round handling of inexact results.
This commit is contained in:
14
ChangeLog
14
ChangeLog
@@ -1,3 +1,17 @@
|
|||||||
|
2013-06-13 Joseph Myers <joseph@codesourcery.com>
|
||||||
|
|
||||||
|
* stdlib/gen-tst-strtod-round.c (round_str): Always generate
|
||||||
|
output for whether conversion result is exact. Take argument
|
||||||
|
indicating whether type is IBM long double.
|
||||||
|
(round_for_all): Change need_exact field to ibm_ld.
|
||||||
|
* stdlib/tst-strtod-round.c (struct exactness): New type.
|
||||||
|
(struct test): Change bool ld_ok field to struct exactness exact.
|
||||||
|
(TEST): Update all definitions for change to field.
|
||||||
|
(tests): Regenerate array contents.
|
||||||
|
(test_in_one_mode): Take pointer to new field instead of old ld_ok
|
||||||
|
field value. Check for IBM long double here.
|
||||||
|
(do_test): Update calls to test_in_one_mode.
|
||||||
|
|
||||||
2013-06-13 Siddhesh Poyarekar <siddhesh@redhat.com>
|
2013-06-13 Siddhesh Poyarekar <siddhesh@redhat.com>
|
||||||
|
|
||||||
[BZ #12515]
|
[BZ #12515]
|
||||||
|
@@ -57,7 +57,7 @@ print_fp (mpfr_t f, const char *suffix, const char *suffix2)
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
round_str (const char *s, const char *suffix,
|
round_str (const char *s, const char *suffix,
|
||||||
int prec, int emin, int emax, bool need_exact)
|
int prec, int emin, int emax, bool ibm_ld)
|
||||||
{
|
{
|
||||||
mpfr_t f;
|
mpfr_t f;
|
||||||
mpfr_set_default_prec (prec);
|
mpfr_set_default_prec (prec);
|
||||||
@@ -65,7 +65,7 @@ round_str (const char *s, const char *suffix,
|
|||||||
mpfr_set_emax (emax);
|
mpfr_set_emax (emax);
|
||||||
mpfr_init (f);
|
mpfr_init (f);
|
||||||
int r = string_to_fp (f, s, MPFR_RNDD);
|
int r = string_to_fp (f, s, MPFR_RNDD);
|
||||||
if (need_exact)
|
if (ibm_ld)
|
||||||
{
|
{
|
||||||
assert (prec == 106 && emin == -1073 && emax == 1024);
|
assert (prec == 106 && emin == -1073 && emax == 1024);
|
||||||
/* The maximum value in IBM long double has discontiguous
|
/* The maximum value in IBM long double has discontiguous
|
||||||
@@ -76,9 +76,9 @@ round_str (const char *s, const char *suffix,
|
|||||||
MPFR_RNDN);
|
MPFR_RNDN);
|
||||||
if (mpfr_cmpabs (f, max_value) > 0)
|
if (mpfr_cmpabs (f, max_value) > 0)
|
||||||
r = 1;
|
r = 1;
|
||||||
mpfr_printf ("\t%s,\n", r ? "false" : "true");
|
|
||||||
mpfr_clear (max_value);
|
mpfr_clear (max_value);
|
||||||
}
|
}
|
||||||
|
mpfr_printf ("\t%s,\n", r ? "false" : "true");
|
||||||
print_fp (f, suffix, ",\n");
|
print_fp (f, suffix, ",\n");
|
||||||
string_to_fp (f, s, MPFR_RNDN);
|
string_to_fp (f, s, MPFR_RNDN);
|
||||||
print_fp (f, suffix, ",\n");
|
print_fp (f, suffix, ",\n");
|
||||||
@@ -97,7 +97,7 @@ round_for_all (const char *s)
|
|||||||
int prec;
|
int prec;
|
||||||
int emin;
|
int emin;
|
||||||
int emax;
|
int emax;
|
||||||
bool need_exact;
|
bool ibm_ld;
|
||||||
} formats[7] = {
|
} formats[7] = {
|
||||||
{ "f", 24, -148, 128, false },
|
{ "f", 24, -148, 128, false },
|
||||||
{ "", 53, -1073, 1024, false },
|
{ "", 53, -1073, 1024, false },
|
||||||
@@ -122,7 +122,7 @@ round_for_all (const char *s)
|
|||||||
for (i = 0; i < 7; i++)
|
for (i = 0; i < 7; i++)
|
||||||
{
|
{
|
||||||
round_str (s, formats[i].suffix, formats[i].prec,
|
round_str (s, formats[i].suffix, formats[i].prec,
|
||||||
formats[i].emin, formats[i].emax, formats[i].need_exact);
|
formats[i].emin, formats[i].emax, formats[i].ibm_ld);
|
||||||
if (i < 6)
|
if (i < 6)
|
||||||
mpfr_printf (",\n");
|
mpfr_printf (",\n");
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user