This is the mail archive of the
libc-alpha@sourceware.org
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 21:16:45 +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>
On Wed, 18 May 2016, Paul E. Murphy wrote:
> +#define MANT_DIG (TYPE_MANT_DIG - 1)
> +#define MIN_EXP (TYPE_MIN_EXP - 1)
> +#define MAX_EXP (TYPE_MAX_EXP - 1)
No. All these "- 1" are gratuitous obfuscation (difference from the
standard C macros) in the existing code; having similar macros with
different values is particularly confusing. The correct approach is a
preliminary patch to change the definition and uses of MANT_DIG and
MIN_EXP, rather than extending the use of - 1 to MAX_EXP.
And then you don't need the TYPE_ prefixes at all; just use MAX_EXP etc.
as at present (I agree that moving away from CHOOSE makes sense). Only
TYPE_DECIMAL_DIG (and TYPE_HEX_DIG for consistency) needs such a prefix,
because of the incompatible meaning of DECIMAL_DIG in <float.h>.
> +#define TYPE_DECIMAL_DIG DBL_DECIMAL_DIG
> +#define TYPE_MIN DBL_MIN
> +#define TYPE_TRUE_MIN DBL_TRUE_MIN
> +#define TYPE_MAX DBL_MAX
> +#define TYPE_MIN_EXP DBL_MIN_EXP
> +#define TYPE_MAX_EXP DBL_MAX_EXP
> +#define TYPE_MANT_DIG DBL_MANT_DIG
Apart from removing the TYPE_ prefix in most cases, I think it would be
better for this header just to define something to the DBL prefix, and for
libm-test.inc to deal with concatenating that with _DECIMAL_DIG, _MIN,
etc.
--
Joseph S. Myers
joseph@codesourcery.com