From patchwork Sat Feb 9 20:56:34 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Fran=C3=A7ois_Dumont?= X-Patchwork-Id: 219448 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 F1AEA2C0077 for ; Sun, 10 Feb 2013 07:57:05 +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=1361048226; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject: References:In-Reply-To:Content-Type:Mailing-List:Precedence: List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=ILNpj23v0927MyZ8W7G4H5m5/Js=; b=tMUywzicWQ/gIkl 3Q+n2fha+8sd4sTHpPQr9/SXb5myKSowW/oEPY8Ioaxy/dNHqn+w0zSZyiGUUw/7 7EpJN4cjEFxEw9io0eACUUpqSpO32baP/ldja/Hlkj5zsgE6/yYtybOhRm9wKUvB HlgA9uskg5raBfLtoX0URtbyuHPE= 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:X-Received:Received:Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject:References:In-Reply-To:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=Hzq2scjn3uH5qSVzOKGUPm6cju0/0TB0ood8W61+SLFMH6NlCcWuU3N5XNTQ/M ZbWCB9vCdKVCf1tYbd7bAoQbPIxQaW7DJplW36f+tT9jd7Ry8ushDpvNCHLExfb1 T+4rH3R1+yJsuyApQLSFEaaGQVf02tIzW0tn2iDl1ongc=; Received: (qmail 21265 invoked by alias); 9 Feb 2013 20:56:47 -0000 Received: (qmail 21243 invoked by uid 22791); 9 Feb 2013 20:56:45 -0000 X-SWARE-Spam-Status: No, hits=-5.3 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, KHOP_RCVD_TRUST, KHOP_THREADED, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE X-Spam-Check-By: sourceware.org Received: from mail-we0-f175.google.com (HELO mail-we0-f175.google.com) (74.125.82.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 09 Feb 2013 20:56:40 +0000 Received: by mail-we0-f175.google.com with SMTP id x8so3946321wey.6 for ; Sat, 09 Feb 2013 12:56:39 -0800 (PST) X-Received: by 10.194.103.163 with SMTP id fx3mr4153463wjb.58.1360443398873; Sat, 09 Feb 2013 12:56:38 -0800 (PST) Received: from localhost.localdomain (arf62-1-82-237-250-248.fbx.proxad.net. [82.237.250.248]) by mx.google.com with ESMTPS id b10sm21358076wix.7.2013.02.09.12.56.36 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 09 Feb 2013 12:56:37 -0800 (PST) Message-ID: <5116B802.8030401@gmail.com> Date: Sat, 09 Feb 2013 21:56:34 +0100 From: =?UTF-8?B?RnJhbsOnb2lzIER1bW9udA==?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120829 Thunderbird/15.0 MIME-Version: 1.0 To: Paolo Carlini CC: libstdc++@gcc.gnu.org, gcc-patches Subject: Re: [PATCH, PR] Crash of Bessel functions at x==0! References: <511320DF.2050400@verizon.net> <511393E1.1090806@oracle.com> <5113BDBD.2000702@verizon.net> <51147A7F.304@verizon.net> <51153F2F.20007@gmail.com> <5115560E.6090405@oracle.com> In-Reply-To: <5115560E.6090405@oracle.com> 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 Attached patch applied then. 2013-02-09 François Dumont * include/tr1/bessel_function.tcc (__cyl_bessel_ij_series): Code simplification. On 02/08/2013 08:46 PM, Paolo Carlini wrote: > On 02/08/2013 07:08 PM, François Dumont wrote: >> Just a small remark, in bessel_function.tcc, the following: >> >> + if (__x == _Tp(0)) >> + { >> + if (__nu == _Tp(0)) >> + return _Tp(1); >> + else if (__nu == _Tp(1)) >> + return _Tp(0); >> + else >> + return _Tp(0); >> + } >> >> could be simplified into >> >> + if (__x == _Tp(0)) >> + return (__nu == _Tp(0)) ? _Tp(1) : _Tp(0); > Thanks Francois. Besides the tiny-winy specific issue, we can all > learn why normally unrelated changes should not be bundled together in > the same patch, even more so when the more substantive one is by far > the smaller. > > Anyway, change pre-approved, whoever cares to commit it. > > Thanks, > Paolo. > Index: include/tr1/bessel_function.tcc =================================================================== --- include/tr1/bessel_function.tcc (revision 195919) +++ include/tr1/bessel_function.tcc (working copy) @@ -409,14 +409,8 @@ unsigned int __max_iter) { if (__x == _Tp(0)) - { - if (__nu == _Tp(0)) - return _Tp(1); - else if (__nu == _Tp(1)) - return _Tp(0); - else - return _Tp(0); - } + return __nu == _Tp(0) ? _Tp(1) : _Tp(0); + const _Tp __x2 = __x / _Tp(2); _Tp __fact = __nu * std::log(__x2); #if _GLIBCXX_USE_C99_MATH_TR1