From patchwork Thu Dec 13 12:38:38 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 205823 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id DECEC2C0092 for ; Thu, 13 Dec 2012 23:39:07 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1356007148; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Received:Date:From:To:Cc:Subject:Message-ID:Reply-To: MIME-Version:Content-Type:Content-Disposition:User-Agent: Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:Sender:Delivered-To; bh=kxc4U3Fi1TfR6PWVf9TK qQwOX1I=; b=utdxc9JZq9WiyzITQZj59lDwu9pwBMsdUYM5ancB+chMHm8I9DqP CGCpiuBdOyv5t+qZB+tFRAnSZctMHJfqlktKjwqWa7clbUP4pkmP35OWcC/MJrMO eSkobr+AAyujqf21QNwiIBkVoG04OsgWm+ST+I8WKUCjXtEli97UC8o= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Received:Received:Date:From:To:Cc:Subject:Message-ID:Reply-To:MIME-Version:Content-Type:Content-Disposition:User-Agent:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=sN1ot8BHUarYvKBB3RoNrU70ktoOSDbueFhApy9Bm0wP0Y8cR7nU6wncyKWONi YB77MKvNpx+tF9Pr4mq6kxoTplQ1jSHr7DsHmHC6ZWCWklCdzjPYo+hdL+ye4Cod f4BKqL2dJOiPeZ7uHJYzEQ/zbsuJaPFdS/+RnVmD8FCZ4=; Received: (qmail 28489 invoked by alias); 13 Dec 2012 12:38:58 -0000 Received: (qmail 28475 invoked by uid 22791); 13 Dec 2012 12:38:57 -0000 X-SWARE-Spam-Status: No, hits=-6.2 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, SPF_HELO_PASS, TW_IB, TW_XP X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 13 Dec 2012 12:38:42 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id qBDCcfhW025627 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 13 Dec 2012 07:38:41 -0500 Received: from zalov.redhat.com (vpn1-5-170.ams2.redhat.com [10.36.5.170]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id qBDCcd4O009903 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 13 Dec 2012 07:38:41 -0500 Received: from zalov.cz (localhost [127.0.0.1]) by zalov.redhat.com (8.14.5/8.14.5) with ESMTP id qBDCccXv009184; Thu, 13 Dec 2012 13:38:38 +0100 Received: (from jakub@localhost) by zalov.cz (8.14.5/8.14.5/Submit) id qBDCcc69009183; Thu, 13 Dec 2012 13:38:38 +0100 Date: Thu, 13 Dec 2012 13:38:38 +0100 From: Jakub Jelinek To: Tobias Burnus Cc: gcc-patches@gcc.gnu.org Subject: [PATCH] Use *Q instead of *L floating constants in libquadmath Message-ID: <20121213123838.GQ2315@tucnak.redhat.com> Reply-To: Jakub Jelinek MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Hi! I've noticed ../../../libquadmath/math/fmaq.c:83:4: warning: floating constant truncated to zero [-Woverflow] warning and a quick grep revealed a bunch of other bugs, mostly introduced during the recent ports from newer glibc. Built on x86_64-linux, committed to trunk. 2012-12-13 Jakub Jelinek * math/cbrtq.c (cbrtq): Use Q suffixed floating point constants instead of L suffixed ones. * math/fmaq.c (fmaq): Likewise. * math/rintq.c (TWO112): Likewise. Jakub --- libquadmath/math/cbrtq.c.jj 2012-11-02 09:01:48.000000000 +0100 +++ libquadmath/math/cbrtq.c 2012-12-13 13:32:26.310751675 +0100 @@ -88,11 +88,11 @@ cbrtq ( __float128 x) /* Approximate cube root of number between .5 and 1, peak relative error = 1.2e-6 */ - x = ((((1.3584464340920900529734e-1L * x - - 6.3986917220457538402318e-1L) * x - + 1.2875551670318751538055e0L) * x - - 1.4897083391357284957891e0L) * x - + 1.3304961236013647092521e0L) * x + 3.7568280825958912391243e-1L; + x = ((((1.3584464340920900529734e-1Q * x + - 6.3986917220457538402318e-1Q) * x + + 1.2875551670318751538055e0Q) * x + - 1.4897083391357284957891e0Q) * x + + 1.3304961236013647092521e0Q) * x + 3.7568280825958912391243e-1Q; /* exponent divided by 3 */ if (e >= 0) @@ -122,9 +122,9 @@ cbrtq ( __float128 x) x = ldexpq (x, e); /* Newton iteration */ - x -= (x - (z / (x * x))) * 0.3333333333333333333333333333333333333333L; - x -= (x - (z / (x * x))) * 0.3333333333333333333333333333333333333333L; - x -= (x - (z / (x * x))) * 0.3333333333333333333333333333333333333333L; + x -= (x - (z / (x * x))) * 0.3333333333333333333333333333333333333333Q; + x -= (x - (z / (x * x))) * 0.3333333333333333333333333333333333333333Q; + x -= (x - (z / (x * x))) * 0.3333333333333333333333333333333333333333Q; if (sign < 0) x = -x; --- libquadmath/math/fmaq.c.jj 2012-11-16 12:39:17.000000000 +0100 +++ libquadmath/math/fmaq.c 2012-12-13 13:30:17.999491200 +0100 @@ -80,7 +80,7 @@ fmaq (__float128 x, __float128 y, __floa < IEEE854_FLOAT128_BIAS - FLT128_MANT_DIG - 2) { int neg = u.ieee.negative ^ v.ieee.negative; - __float128 tiny = neg ? -0x1p-16494L : 0x1p-16494L; + __float128 tiny = neg ? -0x1p-16494Q : 0x1p-16494Q; if (w.ieee.exponent >= 3) return tiny + z; /* Scaling up, adding TINY and scaling down produces the @@ -88,7 +88,7 @@ fmaq (__float128 x, __float128 y, __floa TINY has no effect and in other modes double rounding is harmless. But it may not produce required underflow exceptions. */ - v.value = z * 0x1p114L + tiny; + v.value = z * 0x1p114Q + tiny; if (TININESS_AFTER_ROUNDING ? v.ieee.exponent < 115 : (w.ieee.exponent == 0 @@ -100,7 +100,7 @@ fmaq (__float128 x, __float128 y, __floa volatile __float128 force_underflow = x * y; (void) force_underflow; } - return v.value * 0x1p-114L; + return v.value * 0x1p-114Q; } if (u.ieee.exponent + v.ieee.exponent >= 0x7fff + IEEE854_FLOAT128_BIAS - FLT128_MANT_DIG) @@ -296,7 +296,7 @@ fmaq (__float128 x, __float128 y, __floa { w.value = a1 + u.value; if (w.ieee.exponent == 227) - return w.value * 0x1p-226L; + return w.value * 0x1p-226Q; } /* v.ieee.mant_low & 2 is LSB bit of the result before rounding, v.ieee.mant_low & 1 is the round bit and j is our sticky @@ -305,8 +305,8 @@ fmaq (__float128 x, __float128 y, __floa w.ieee.mant_low = ((v.ieee.mant_low & 3) << 1) | j; w.ieee.negative = v.ieee.negative; v.ieee.mant_low &= ~3U; - v.value *= 0x1p-226L; - w.value *= 0x1p-2L; + v.value *= 0x1p-226Q; + w.value *= 0x1p-2Q; return v.value + w.value; } v.ieee.mant_low |= j; --- libquadmath/math/rintq.c.jj 2012-11-02 09:01:48.000000000 +0100 +++ libquadmath/math/rintq.c 2012-12-13 13:33:09.621501578 +0100 @@ -27,8 +27,8 @@ static const __float128 TWO112[2]={ - 5.19229685853482762853049632922009600E+33L, /* 0x406F000000000000, 0 */ - -5.19229685853482762853049632922009600E+33L /* 0xC06F000000000000, 0 */ + 5.19229685853482762853049632922009600E+33Q, /* 0x406F000000000000, 0 */ + -5.19229685853482762853049632922009600E+33Q /* 0xC06F000000000000, 0 */ }; __float128