This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 1/6] float128: Extend the power of ten tables


On Fri, 26 May 2017, Gabriel F. T. Gomes wrote:

> +#define HAVE_EXTENDED_RANGE ((!defined __NO_LONG_DOUBLE_MATH \
> +  && __LDBL_MAX_EXP__ > 1024) || __HAVE_DISTINCT_FLOAT128)

This is not the normal line wrapping approach (where the && would align 
with the corresponding open parenthesis).  Rather, do:

#define HAVE_EXTENDED_RANGE \
  ((!defined __NO_LONG_DOUBLE_MATH && __LDBL_MAX_EXP__ > 1024) \
   || __HAVE_DISTINCT_FLOAT128)

or similar, so that operators are properly aligned after line breaks.

> diff --git a/stdlib/fpioconst.h b/stdlib/fpioconst.h
> index 6fc476b..7e19b0d 100644
> --- a/stdlib/fpioconst.h
> +++ b/stdlib/fpioconst.h
> @@ -40,9 +40,16 @@
>  #define DBL_MAX_10_EXP_LOG	8 /* = floor(log_2(DBL_MAX_10_EXP)) */
>  #define FLT_MAX_10_EXP_LOG	5 /* = floor(log_2(FLT_MAX_10_EXP)) */
>  
> +/* On some machines, _Float128 may be ABI-distinct from long double (e.g
> +   IBM extended precision).  */
> +#include <bits/floatn.h>
> +
>  /* For strtold, we need powers of 10 up to floor (log_2 (LDBL_MANT_DIG
> -   - LDBL_MIN_EXP + 2)).  */
> -#if !defined __NO_LONG_DOUBLE_MATH && __LDBL_MAX_EXP__ > 1024
> +   - LDBL_MIN_EXP + 2)).  When _Float128 is enabled in libm and it is
> +   ABI-distinct from long double (e.g. on powerpc64le), we also need powers
> +   of 10 up to floor (log_2 (FLT128_MANT_DIG - FLT128_MIN_EXP + 2)).  */
> +#if (!defined __NO_LONG_DOUBLE_MATH && __LDBL_MAX_EXP__ > 1024) \
> +    || __HAVE_DISTINCT_FLOAT128

Also, I don't think duplicating the conditional is a good idea.  It would 
be better to rename the macro to FPIOCONST_HAVE_EXTENDED_RANGE and move 
the definition to fpioconst.h.

-- 
Joseph S. Myers
joseph@codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]