From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 116879 invoked by alias); 26 May 2017 12:57:03 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Received: (qmail 116826 invoked by uid 89); 26 May 2017 12:57:02 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.7 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 spammy=powers, 1698, 6800, ten X-HELO: mx0a-001b2d01.pphosted.com From: "Gabriel F. T. Gomes" To: libc-alpha@sourceware.org Subject: [PATCH 1/6] float128: Extend the power of ten tables Date: Fri, 26 May 2017 12:57:00 -0000 In-Reply-To: <1495803396-14558-1-git-send-email-gftg@linux.vnet.ibm.com> References: <1495803396-14558-1-git-send-email-gftg@linux.vnet.ibm.com> X-TM-AS-MML: disable x-cbid: 17052612-1523-0000-0000-000002A34DC3 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17052612-1524-0000-0000-00002A39D278 Message-Id: <1495803396-14558-2-git-send-email-gftg@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-05-26_08:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1703280000 definitions=main-1705260236 X-SW-Source: 2017-05/txt/msg00797.txt.bz2 From: "Paul E. Murphy" Update the power of ten tables used by the common implementation when long double is not the most expressive real type. 2016-11-04 Paul E. Murphy * stdlib/fpioconst.c (HAVE_EXTENDED_RANGE): New macro for testing how big the power of ten table should be. [TENS_P11_IDX]: Include if above is true. [TENS_P12_IDX]: Include if above is true. [TENS_P13_IDX]: Include if above is true. [TENS_P14_IDX]: Include if above is true. * stdlib/fpioconst.h (FPIOCONST_POW10_ARRAY_SIZE): Use larger table if _Float128 is supported. --- stdlib/fpioconst.c | 11 +++++++---- stdlib/fpioconst.h | 11 +++++++++-- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/stdlib/fpioconst.c b/stdlib/fpioconst.c index 7db7fa4..ba91108 100644 --- a/stdlib/fpioconst.c +++ b/stdlib/fpioconst.c @@ -27,6 +27,9 @@ with gen-fpioconst.c. */ +#define HAVE_EXTENDED_RANGE ((!defined __NO_LONG_DOUBLE_MATH \ + && __LDBL_MAX_EXP__ > 1024) || __HAVE_DISTINCT_FLOAT128) + #if BITS_PER_MP_LIMB == 32 /* Table with constants of 10^(2^i), i=0..12 for 32-bit limbs. */ @@ -112,7 +115,7 @@ const mp_limb_t __tens[] = 0xd2db49ef, 0x926c3f5b, 0xae6209d4, 0x2d433949, 0x34f4a3c6, 0xd4305d94, 0xd9d61a05, 0x00000325, -#if !defined __NO_LONG_DOUBLE_MATH && __LDBL_MAX_EXP__ > 1024 +#if HAVE_EXTENDED_RANGE # define TENS_P11_IDX (TENS_P10_IDX + TENS_P10_SIZE) # define TENS_P11_SIZE 215 [TENS_P11_IDX] = 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, @@ -659,7 +662,7 @@ const mp_limb_t __tens[] = 0x6d6c0267, 0x06f9c25b, 0xbd6078e0, 0xb5fcdc81, 0xd742fa41, 0xcccc2399, 0xc691adc0, 0x215ad82c, 0xea73b0c3, 0xa511e5b0, 0xf499e0a6, 0x53e27ab0, 0xd94440a2, 0x47752521, 0x9a6e3644, 0xab113708, 0x8f8b301d, 0x058a42a3, -#endif /* !__NO_LONG_DOUBLE_MATH */ +#endif /* HAVE_EXTENDED_RANGE */ }; #elif BITS_PER_MP_LIMB == 64 @@ -748,7 +751,7 @@ const mp_limb_t __tens[] = 0xd2db49ef47187094ull, 0xae6209d4926c3f5bull, 0x34f4a3c62d433949ull, 0xd9d61a05d4305d94ull, 0x0000000000000325ull, -#if !defined __NO_LONG_DOUBLE_MATH && __LDBL_MAX_EXP__ > 1024 +#if HAVE_EXTENDED_RANGE # define TENS_P11_IDX (TENS_P10_IDX + TENS_P10_SIZE) # define TENS_P11_SIZE 108 [TENS_P11_IDX] = 0x0000000000000000ull, 0x0000000000000000ull, @@ -1320,7 +1323,7 @@ const struct mp_power _fpioconst_pow10[FPIOCONST_POW10_ARRAY_SIZE] = { TENS_P8_IDX, TENS_P8_SIZE, 851, 848 }, { TENS_P9_IDX, TENS_P9_SIZE, 1701, 1698 }, { TENS_P10_IDX, TENS_P10_SIZE, 3402, 3399 }, -#if !defined __NO_LONG_DOUBLE_MATH && __LDBL_MAX_EXP__ > 1024 +#if HAVE_EXTENDED_RANGE { TENS_P11_IDX, TENS_P11_SIZE, 6804, 6800 }, { TENS_P12_IDX, TENS_P12_SIZE, 13607, 13604 }, { TENS_P13_IDX, TENS_P13_SIZE, 27214, 27210 }, 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 + /* 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 # define FPIOCONST_POW10_ARRAY_SIZE 15 #else # define FPIOCONST_POW10_ARRAY_SIZE 11 -- 2.4.11