From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2845 invoked by alias); 5 Dec 2011 23:37:23 -0000 Received: (qmail 2634 invoked by uid 22791); 5 Dec 2011 23:37:22 -0000 X-SWARE-Spam-Status: No, hits=-2.8 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO sourceware.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 05 Dec 2011 23:37:10 +0000 From: "dmalcolm at redhat dot com" To: glibc-bugs@sources.redhat.com Subject: [Bug math/13472] New: PPC64 hypot() is "inf" for very large values that are non-infinite on other architectures Date: Mon, 05 Dec 2011 23:37:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: math X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: dmalcolm at redhat dot com X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: aj at suse dot de X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact glibc-bugs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: glibc-bugs-owner@sourceware.org X-SW-Source: 2011-12/txt/msg00004.txt.bz2 http://sourceware.org/bugzilla/show_bug.cgi?id=13472 Bug #: 13472 Summary: PPC64 hypot() is "inf" for very large values that are non-infinite on other architectures Product: glibc Version: 2.14 Status: NEW Severity: normal Priority: P2 Component: math AssignedTo: aj@suse.de ReportedBy: dmalcolm@redhat.com Classification: Unclassified ppc64's glibc appears to have an optimized implementation of "hypot" (in libm): sysdeps/powerpc/fpu/e_hypot.c This seems to have different behavior near infinity when compared to other architectures. This leads to CPython's test suite failing on ppc64 with glibc-2.14.90-19.ppc64 (albeit with Fedora's build of glibc) within the "cmath" module (math on complex numbers): https://bugzilla.redhat.com/show_bug.cgi?id=750811 http://bugs.python.org/issue13534 CPython's "cmath" module internally uses hypot() in various cases of very large numbers in order to avoid overflow. All of the failing test cases turned out to involve (at the C layer) a call to hypot() with a pair of very large finite values, where the result is very large but finite on other architectures, but is "inf" on ppc64, leading to various unexpected values, and an architecture-specific failure of this test. "man hypot" says: > The calculation is performed without undue overflow or underflow during > the intermediate steps of the calculation. Test case: Python's math.hypot() is a thin wrapper around hypot(3); a Python "float" uses a C "double" internally. https://bugzilla.redhat.com/attachment.cgi?id=541097 is a Python script to exercise hypot(3). It calls hypot() for all of the x,y pairs that fail within the Python test case on ppc64. On x86_64, with glibc-2.14-5.x86_64 (and python-2.7.1-7.fc15.x86_64), all results are non-infinite, with exponent e+307 or e+308 (see: https://bugzilla.redhat.com/attachment.cgi?id=541102 for the results on this box). On ppc64, with glibc-2.14.90-19.ppc64 (and python-2.7.2-4.2.fc16.ppc64), all results are "inf". (hopefully the attachments on that other bugzilla instance are readable). -- Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.