[PATCH 1/8] Begin refactor of libm-test.inc
Joseph Myers
joseph@codesourcery.com
Wed May 18 21:18:00 GMT 2016
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
More information about the Libc-alpha
mailing list