This is the mail archive of the
mailing list for the glibc project.
Re: [PATCH 1/8] Begin refactor of libm-test.inc
- From: Joseph Myers <joseph at codesourcery dot com>
- To: "Paul E. Murphy" <murphyp at linux dot vnet dot ibm dot com>
- Cc: <libc-alpha at sourceware dot org>
- Date: Wed, 18 May 2016 22:14:29 +0000
- Subject: Re: [PATCH 1/8] Begin refactor of libm-test.inc
- Authentication-results: sourceware.org; auth=none
- References: <cover dot 1463599718 dot git dot murphyp at linux dot vnet dot ibm dot com> <d07dfc0973a9a1288b424abfb19633ab0048f1c9 dot 1463599718 dot git dot murphyp at linux dot vnet dot ibm dot com> <alpine dot DEB dot 2 dot 20 dot 1605182141070 dot 7137 at digraph dot polyomino dot org dot uk> <2bcc41c8-9af2-e987-4285-d68a3fcb3472 at linux dot vnet dot ibm dot com>
On Wed, 18 May 2016, Paul E. Murphy wrote:
> On 05/18/2016 04:44 PM, Joseph Myers wrote:
> > On Wed, 18 May 2016, Paul E. Murphy wrote:
> >> [TEST_COND_gt_binary64]: Likewise.
> > I don't like this TEST_COND_gt_binary64.
> > If the condition combines TEST_LDOUBLE with something about mantissa bits
> > or exponents for long double, only the thing about mantissa bits or
> > exponents is actually needed. If it's TEST_LDOUBLE on its own (or
> > combined with conditions on integer types rather than on long double), as
> > in e.g. tests of ceil, then testing for >= 64 mantissa bits is sufficient
> > (the tests may actually only require some number between 53 and 64, but
> > testing for >= 64 seems reasonable). That is, TEST_LDOUBLE on its own can
> > be treated as defined TEST_LDOUBLE && LDBL_MANT_DIG >= 64.
> Admittedly, I scratched my head here try to find a conservative method to
> replace the TEST_LDOUBLE usage. If it is only used as a bandaid for
> testing ldbl formats which are more expressive than dbl, can't it just
> go away without issue? It isn't used in isolation.
The aim is to replace it with a logical condition for what the tests in
If the condition just is "#ifdef TEST_LDOUBLE" (possibly with extra
whitespace after "#"), or just tests defined TEST_LDOUBLE without any
MANT_DIG, MIN_EXP or MAX_EXP tests (but including e.g. the "# if LONG_MAX
> 281474976710656 && defined TEST_LDOUBLE" condition on one test of
lrint), then, in what follows, treat it like "defined TEST_LDOUBLE &&
LDBL_MANT_DIG >= 64".
Given a test of a combination of TEST_LDOUBLE with a test of
LDBL_MANT_DIG, LDBL_MIN_EXP or LDBL_MAX_EXP (possibly more than one of
those, and possibly with other tests such as LONG_MAX as well), you can
then remove the TEST_LDOUBLE condition if you change the LDBL_* tests to
test the macros such as MANT_DIG, MIN_EXP and MAX_EXP (with MANT_DIG and
MIN_EXP having previously been adjusted to remove the "-1").
Perhaps this patch is doing too many things and you need some patches just
about refactoring TEST_LDOUBLE uses.
* Adjust MANT_DIG and MIN_EXP not to use -1.
* Change TEST_LDOUBLE when it appears in conjunction with LDBL_MANT_DIG
etc. tests to just test MANT_DIG etc.
* Change LDBL_MANT_DIG etc. conditionals inside of TEST_LDOUBLE ones
similarly (for cases such as
# if LDBL_MANT_DIG > 100
* Change TEST_LDOUBLE when it appears on its own to test MANT_DIG >= 64.
(Well, all but the first of those could reasonbly go together in one
patch, if separated from the rest of the refactoring.)
Joseph S. Myers