From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28202 invoked by alias); 27 Oct 2011 09:27:24 -0000 Received: (qmail 28191 invoked by uid 22791); 27 Oct 2011 09:27:23 -0000 X-SWARE-Spam-Status: No, hits=-2.9 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 27 Oct 2011 09:27:08 +0000 From: "paolo.carlini at oracle dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/50880] __complex_acosh() picks wrong complex branch Date: Thu, 27 Oct 2011 09:27:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: paolo.carlini at oracle dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Keywords CC Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2011-10/txt/msg02775.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50880 Paolo Carlini changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords|wrong-code | CC| |gdr@integrable-solutions.ne | |t --- Comment #2 from Paolo Carlini 2011-10-27 09:24:26 UTC --- Thus, to understand and clarify why this has not been noticed so far, you are on a target which doesn't support in the underlying C library these complex functions, right? Because normally (eg, on Linux) these days we just forward to __builtin_cacosh*, the code you are touching is just a "surrogate", a "fallback", which doesn't get right all the special cases, NaNs, infinity. Anyway, a similar tweak would touch also the C++11 version in std:: Gaby, can you have a look to this, double check the patch? For your convenience the surrounding code is: template std::complex<_Tp> __complex_acosh(const std::complex<_Tp>& __z) { std::complex<_Tp> __t((__z.real() - __z.imag()) * (__z.real() + __z.imag()) - _Tp(1.0), _Tp(2.0) * __z.real() * __z.imag()); __t = std::sqrt(__t); return std::log(__t + __z); }