From patchwork Fri Sep 2 16:23:11 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Paul E. Murphy" X-Patchwork-Id: 15214 X-Patchwork-Delegate: joseph@codesourcery.com Received: (qmail 65205 invoked by alias); 2 Sep 2016 16:48:58 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 64985 invoked by uid 89); 2 Sep 2016 16:48:56 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=1.6 required=5.0 tests=AWL, BAYES_50, KAM_LAZY_DOMAIN_SECURITY, KAM_LOTSOFHASH, RCVD_IN_DNSWL_LOW, RCVD_IN_SEMBACKSCATTER autolearn=no version=3.3.2 spammy=divided, newton, tone, Newton X-HELO: mx0a-001b2d01.pphosted.com X-IBM-Helo: d03dlp02.boulder.ibm.com X-IBM-MailFrom: murphyp@linux.vnet.ibm.com From: "Paul E. Murphy" Subject: [PATCHv4] ldbl-128: Use L(x) macro for long double constants To: "libc-alpha@sourceware.org" Cc: Joseph Myers Date: Fri, 2 Sep 2016 11:23:11 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.0 MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16090216-0012-0000-0000-0000108C03E7 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00005698; HX=3.00000240; KW=3.00000007; PH=3.00000004; SC=3.00000184; SDB=6.00752992; UDB=6.00356088; IPR=6.00525833; BA=6.00004687; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00012558; XFM=3.00000011; UTC=2016-09-02 16:47:54 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16090216-0013-0000-0000-0000451C09ED Message-Id: <997588c1-5bcf-6339-4c7f-1339d91e45cf@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2016-09-02_05:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1604210000 definitions=main-1609020223 Sorry for the delay, I had some pressing issues to deal with the last day or so. My hope is that this will apply correctly for patch users (Previous patches assumed 'git am -c' to properly strip the commentary), and my email client doesn't foobar a big patch. The conversion script is attached as well as the small patch to revert some minor blips which aren't easily worked around within the script. ---8<--- This runs the attached sed script against these files using a regex which aggressively matches long double literals when not obviously part of a comment. Likewise, 5 digit or less integral constants are replaced with integral constants. Likewise, -L(x) is transformed into L(-x). Naturally, the script has a few minor hiccups which are more clearly remedied via the attached fixup patch. Such hiccups include, context-sensitive promotion to a real type, and munging constants inside a multi-line comment. A followup patch applies subjective cleanup to tables which have been malformatted by the above. * sysdeps/ieee754/ldbl-128/e_acoshl.c: Wrap long double literals with L() and remove explicit suffix, convert real literals which can be equivalentally substituted with integers, and transform -L(x) to L(-x). * sysdeps/ieee754/ldbl-128/e_acosl.c: Likewise. * sysdeps/ieee754/ldbl-128/e_asinl.c: Likewise. * sysdeps/ieee754/ldbl-128/e_atan2l.c: Likewise. * sysdeps/ieee754/ldbl-128/e_atanhl.c: Likewise. * sysdeps/ieee754/ldbl-128/e_coshl.c: Likewise. * sysdeps/ieee754/ldbl-128/e_exp10l.c: Likewise. * sysdeps/ieee754/ldbl-128/e_expl.c: Likewise. * sysdeps/ieee754/ldbl-128/e_gammal_r.c: Likewise. * sysdeps/ieee754/ldbl-128/e_hypotl.c: Likewise. * sysdeps/ieee754/ldbl-128/e_j0l.c: Likewise. * sysdeps/ieee754/ldbl-128/e_j1l.c: Likewise. * sysdeps/ieee754/ldbl-128/e_jnl.c: Likewise. * sysdeps/ieee754/ldbl-128/e_lgammal_r.c: Likewise. * sysdeps/ieee754/ldbl-128/e_log10l.c: Likewise. * sysdeps/ieee754/ldbl-128/e_log2l.c: Likewise. * sysdeps/ieee754/ldbl-128/e_logl.c: Likewise. * sysdeps/ieee754/ldbl-128/e_powl.c: Likewise. * sysdeps/ieee754/ldbl-128/e_rem_pio2l.c: Likewise. * sysdeps/ieee754/ldbl-128/e_remainderl.c: Likewise. * sysdeps/ieee754/ldbl-128/e_sinhl.c: Likewise. * sysdeps/ieee754/ldbl-128/k_cosl.c: Likewise. * sysdeps/ieee754/ldbl-128/k_sincosl.c: Likewise. * sysdeps/ieee754/ldbl-128/k_sinl.c: Likewise. * sysdeps/ieee754/ldbl-128/k_tanl.c: Likewise. * sysdeps/ieee754/ldbl-128/lgamma_negl.c: Likewise. * sysdeps/ieee754/ldbl-128/s_asinhl.c: Likewise. * sysdeps/ieee754/ldbl-128/s_atanl.c: Likewise. * sysdeps/ieee754/ldbl-128/s_cbrtl.c: Likewise. * sysdeps/ieee754/ldbl-128/s_cosl.c: Likewise. * sysdeps/ieee754/ldbl-128/s_erfl.c: Likewise. * sysdeps/ieee754/ldbl-128/s_expm1l.c: Likewise. * sysdeps/ieee754/ldbl-128/s_fmal.c: Likewise. * sysdeps/ieee754/ldbl-128/s_frexpl.c: Likewise. * sysdeps/ieee754/ldbl-128/s_llrintl.c: Likewise. * sysdeps/ieee754/ldbl-128/s_llroundl.c: Likewise. * sysdeps/ieee754/ldbl-128/s_log1pl.c: Likewise. * sysdeps/ieee754/ldbl-128/s_lrintl.c: Likewise. * sysdeps/ieee754/ldbl-128/s_lroundl.c: Likewise. * sysdeps/ieee754/ldbl-128/s_nearbyintl.c: Likewise. * sysdeps/ieee754/ldbl-128/s_nextafterl.c: Likewise. * sysdeps/ieee754/ldbl-128/s_remquol.c: Likewise. * sysdeps/ieee754/ldbl-128/s_scalblnl.c: Likewise. * sysdeps/ieee754/ldbl-128/s_scalbnl.c: Likewise. * sysdeps/ieee754/ldbl-128/s_sincosl.c: Likewise. * sysdeps/ieee754/ldbl-128/s_sinl.c: Likewise. * sysdeps/ieee754/ldbl-128/s_tanhl.c: Likewise. * sysdeps/ieee754/ldbl-128/s_tanl.c: Likewise. * sysdeps/ieee754/ldbl-128/t_expl.h: Likewise. * sysdeps/ieee754/ldbl-128/t_sincosl.c: Likewise. * sysdeps/ieee754/ldbl-128/x2y2m1l.c: Likewise. --- sysdeps/ieee754/ldbl-128/e_acoshl.c | 8 +- sysdeps/ieee754/ldbl-128/e_acosl.c | 140 +-- sysdeps/ieee754/ldbl-128/e_asinl.c | 92 +- sysdeps/ieee754/ldbl-128/e_atan2l.c | 20 +- sysdeps/ieee754/ldbl-128/e_atanhl.c | 4 +- sysdeps/ieee754/ldbl-128/e_coshl.c | 4 +- sysdeps/ieee754/ldbl-128/e_exp10l.c | 8 +- sysdeps/ieee754/ldbl-128/e_expl.c | 38 +- sysdeps/ieee754/ldbl-128/e_gammal_r.c | 64 +- sysdeps/ieee754/ldbl-128/e_hypotl.c | 2 +- sysdeps/ieee754/ldbl-128/e_j0l.c | 764 ++++++------- sysdeps/ieee754/ldbl-128/e_j1l.c | 762 ++++++------- sysdeps/ieee754/ldbl-128/e_jnl.c | 26 +- sysdeps/ieee754/ldbl-128/e_lgammal_r.c | 834 +++++++------- sysdeps/ieee754/ldbl-128/e_log10l.c | 104 +- sysdeps/ieee754/ldbl-128/e_log2l.c | 98 +- sysdeps/ieee754/ldbl-128/e_logl.c | 228 ++-- sysdeps/ieee754/ldbl-128/e_powl.c | 76 +- sysdeps/ieee754/ldbl-128/e_rem_pio2l.c | 4 +- sysdeps/ieee754/ldbl-128/e_remainderl.c | 4 +- sysdeps/ieee754/ldbl-128/e_sinhl.c | 4 +- sysdeps/ieee754/ldbl-128/k_cosl.c | 38 +- sysdeps/ieee754/ldbl-128/k_sincosl.c | 54 +- sysdeps/ieee754/ldbl-128/k_sinl.c | 38 +- sysdeps/ieee754/ldbl-128/k_tanl.c | 28 +- sysdeps/ieee754/ldbl-128/lgamma_negl.c | 684 ++++++------ sysdeps/ieee754/ldbl-128/s_asinhl.c | 6 +- sysdeps/ieee754/ldbl-128/s_atanl.c | 192 ++-- sysdeps/ieee754/ldbl-128/s_cbrtl.c | 24 +- sysdeps/ieee754/ldbl-128/s_cosl.c | 2 +- sysdeps/ieee754/ldbl-128/s_erfl.c | 738 ++++++------ sysdeps/ieee754/ldbl-128/s_expm1l.c | 46 +- sysdeps/ieee754/ldbl-128/s_fmal.c | 28 +- sysdeps/ieee754/ldbl-128/s_frexpl.c | 2 +- sysdeps/ieee754/ldbl-128/s_llrintl.c | 6 +- sysdeps/ieee754/ldbl-128/s_llroundl.c | 4 +- sysdeps/ieee754/ldbl-128/s_log1pl.c | 108 +- sysdeps/ieee754/ldbl-128/s_lrintl.c | 6 +- sysdeps/ieee754/ldbl-128/s_lroundl.c | 4 +- sysdeps/ieee754/ldbl-128/s_nearbyintl.c | 4 +- sysdeps/ieee754/ldbl-128/s_remquol.c | 6 +- sysdeps/ieee754/ldbl-128/s_scalblnl.c | 8 +- sysdeps/ieee754/ldbl-128/s_scalbnl.c | 8 +- sysdeps/ieee754/ldbl-128/s_sincosl.c | 2 +- sysdeps/ieee754/ldbl-128/s_sinl.c | 2 +- sysdeps/ieee754/ldbl-128/s_tanhl.c | 2 +- sysdeps/ieee754/ldbl-128/s_tanl.c | 2 +- sysdeps/ieee754/ldbl-128/t_expl.h | 1860 +++++++++++++++---------------- sysdeps/ieee754/ldbl-128/t_sincosl.c | 664 +++++------ sysdeps/ieee754/ldbl-128/x2y2m1l.c | 2 +- 50 files changed, 3926 insertions(+), 3926 deletions(-) diff --git a/sysdeps/ieee754/ldbl-128/e_exp10l.c b/sysdeps/ieee754/ldbl-128/e_exp10l.c index 9a2c8b8..9432b18 100644 --- a/sysdeps/ieee754/ldbl-128/e_exp10l.c +++ b/sysdeps/ieee754/ldbl-128/e_exp10l.c @@ -39,7 +39,7 @@ __ieee754_exp10l (_Float128 arg) return 1; u.value = arg; - u.parts64sw &= 0xfe00000000000000LL; + u.parts64.lsw &= 0xfe00000000000000LL; arg_high = u.value; arg_low = arg - arg_high; exp_high = arg_high * log10_high; diff --git a/sysdeps/ieee754/ldbl-128/e_jnl.c b/sysdeps/ieee754/ldbl-128/e_jnl.c index 1f80b00..470631e 100644 --- a/sysdeps/ieee754/ldbl-128/e_jnl.c +++ b/sysdeps/ieee754/ldbl-128/e_jnl.c @@ -328,7 +328,7 @@ __ieee754_ynl (int n, _Float128 x) if (x <= 0) { if (x == 0) - return ((n < 0 && (n & 1) != 0) ? 1 : -1) / 0; + return ((n < 0 && (n & 1) != 0) ? 1 : -1) / L(0.0); if (se & 0x80000000) return zero / (zero * x); } diff --git a/sysdeps/ieee754/ldbl-128/lgamma_negl.c b/sysdeps/ieee754/ldbl-128/lgamma_negl.c index 83542d3..e33eaff 100644 --- a/sysdeps/ieee754/ldbl-128/lgamma_negl.c +++ b/sysdeps/ieee754/ldbl-128/lgamma_negl.c @@ -450,7 +450,7 @@ __lgamma_negl (_Float128 x, int *signgamp) integers and determine the sign of the result. */ int i = __floorl (-2 * x); if ((i & 1) == 0 && i == -2 * x) - return 1 / 0; + return L(1.0) / L(0.0); _Float128 xn = ((i & 1) == 0 ? -i / 2 : (-i - 1) / 2); i -= 4; *signgamp = ((i & 2) == 0 ? -1 : 1); diff --git a/sysdeps/ieee754/ldbl-128/s_fmal.c b/sysdeps/ieee754/ldbl-128/s_fmal.c index c7f90d9..efafa8b 100644 --- a/sysdeps/ieee754/ldbl-128/s_fmal.c +++ b/sysdeps/ieee754/ldbl-128/s_fmal.c @@ -261,10 +261,10 @@ __fmal (_Float128 x, _Float128 y, _Float128 z) if (v.ieee.exponent > 228) return (a1 + u.d) * L(0x1p-228); /* If v.d * 0x1p-228L with round to zero is a subnormal above - or equal to LDBL_MIN / 2, then v.d * L(0x1p-228) shifts mantissa + or equal to LDBL_MIN / 2, then v.d * 0x1p-228L shifts mantissa down just by 1 bit, which means v.ieee.mantissa3 |= j would change the round bit, not sticky or guard bit. - v.d * L(0x1p-228) never normalizes by shifting up, + v.d * 0x1p-228L never normalizes by shifting up, so round bit plus sticky bit should be already enough for proper rounding. */ if (v.ieee.exponent == 228)