From patchwork Mon Oct 1 23:12:22 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Carlini X-Patchwork-Id: 188362 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 E0D0F2C009D for ; Tue, 2 Oct 2012 09:12:37 +1000 (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=1349737958; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Received:Message-ID:Date:From:User-Agent:MIME-Version: To:CC:Subject:Content-Type:Mailing-List:Precedence:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=5m2+WNb4IoEheILyaHF8ymhFGtw=; b=QE3UB0tHqBwdzMV BpfKgR07gzyDEzxVVZdYNoBJ5+9XBmWZgETXymO+oFJ3XE9lyoisbBkBtAT9cKuo rpCyO1NgebU8NvR/qFxNvVh1eAyUCDUnmUyojOhxLmnmhxXe27BoimtjuJQmwGHR b4CsE8X+j9QObrJJHktXo2KEPoEo= 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:Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject:Content-Type:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=Z0nGGQNlrs1lWM0QECxt8F/dToEbOoxE7QhLNNdBZvdgJjB3tMckyaLkCu3VC1 mFa6/E7aIIXGHOhRXNgJkL9TeETb1H944i4XingywTkyHXg9mi+9L45gilYZzVk5 grGWLVWUdoFnmawWYHDn/3a82CSWiITP/uXJWViK1tTCE=; Received: (qmail 5551 invoked by alias); 1 Oct 2012 23:12:34 -0000 Received: (qmail 5535 invoked by uid 22791); 1 Oct 2012 23:12:33 -0000 X-SWARE-Spam-Status: No, hits=-7.9 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, RCVD_IN_DNSWL_HI, RCVD_IN_HOSTKARMA_NO, RCVD_IN_HOSTKARMA_YE, RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from rcsinet15.oracle.com (HELO rcsinet15.oracle.com) (148.87.113.117) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 01 Oct 2012 23:12:27 +0000 Received: from ucsinet22.oracle.com (ucsinet22.oracle.com [156.151.31.94]) by rcsinet15.oracle.com (Sentrion-MTA-4.2.2/Sentrion-MTA-4.2.2) with ESMTP id q91NCP9l009854 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 1 Oct 2012 23:12:26 GMT Received: from acsmt358.oracle.com (acsmt358.oracle.com [141.146.40.158]) by ucsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id q91NCPN3016618 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 1 Oct 2012 23:12:25 GMT Received: from abhmt115.oracle.com (abhmt115.oracle.com [141.146.116.67]) by acsmt358.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id q91NCO3H021165; Mon, 1 Oct 2012 18:12:24 -0500 Received: from [192.168.1.4] (/79.36.196.48) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 01 Oct 2012 16:12:24 -0700 Message-ID: <506A2356.10203@oracle.com> Date: Tue, 02 Oct 2012 01:12:22 +0200 From: Paolo Carlini User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120825 Thunderbird/15.0 MIME-Version: 1.0 To: "gcc-patches@gcc.gnu.org" CC: libstdc++ Subject: [v3] libstdc++/54757 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, sanity checked x86_64-linux (both cases), committed to mainline. Thanks, Paolo. ///////////////////////// 2012-10-01 Paolo Carlini PR libstdc++/54757 * include/ext/random (rice_distribution<>::operator()): Use std::hypot only if _GLIBCXX_USE_C99_MATH_TR1. * include/ext/random.tcc (rice_distribution<>::__generate_impl): Likewise. Index: include/ext/random =================================================================== --- include/ext/random (revision 191942) +++ include/ext/random (working copy) @@ -1042,7 +1042,11 @@ { result_type __x = this->_M_ndx(__urng); result_type __y = this->_M_ndy(__urng); +#if _GLIBCXX_USE_C99_MATH_TR1 return std::hypot(__x, __y); +#else + return std::sqrt(__x * __x + __y * __y); +#endif } template @@ -1054,7 +1058,11 @@ __px(__p.nu(), __p.sigma()), __py(result_type(0), __p.sigma()); result_type __x = this->_M_ndx(__px, __urng); result_type __y = this->_M_ndy(__py, __urng); +#if _GLIBCXX_USE_C99_MATH_TR1 return std::hypot(__x, __y); +#else + return std::sqrt(__x * __x + __y * __y); +#endif } template_M_ndx(__px, __urng); result_type __y = this->_M_ndy(__py, __urng); +#if _GLIBCXX_USE_C99_MATH_TR1 *__f++ = std::hypot(__x, __y); +#else + *__f++ = std::sqrt(__x * __x + __y * __y); +#endif } }