public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug math/13472] New: PPC64 hypot() is "inf" for very large values that are non-infinite on other architectures
@ 2011-12-05 23:37 dmalcolm at redhat dot com
  2011-12-06 10:46 ` [Bug math/13472] " schwab@linux-m68k.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: dmalcolm at redhat dot com @ 2011-12-05 23:37 UTC (permalink / raw)
  To: glibc-bugs

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.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug math/13472] PPC64 hypot() is "inf" for very large values that are non-infinite on other architectures
  2011-12-05 23:37 [Bug math/13472] New: PPC64 hypot() is "inf" for very large values that are non-infinite on other architectures dmalcolm at redhat dot com
@ 2011-12-06 10:46 ` schwab@linux-m68k.org
  2011-12-06 13:20 ` jakub at redhat dot com
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: schwab@linux-m68k.org @ 2011-12-06 10:46 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=13472

Andreas Schwab <schwab@linux-m68k.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED

--- Comment #1 from Andreas Schwab <schwab@linux-m68k.org> 2011-12-06 10:45:50 UTC ---
Fixed on master.

-- 
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.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug math/13472] PPC64 hypot() is "inf" for very large values that are non-infinite on other architectures
  2011-12-05 23:37 [Bug math/13472] New: PPC64 hypot() is "inf" for very large values that are non-infinite on other architectures dmalcolm at redhat dot com
  2011-12-06 10:46 ` [Bug math/13472] " schwab@linux-m68k.org
@ 2011-12-06 13:20 ` jakub at redhat dot com
  2011-12-06 13:27 ` schwab@linux-m68k.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: jakub at redhat dot com @ 2011-12-06 13:20 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=13472

Jakub Jelinek <jakub at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
                 CC|                            |jakub at redhat dot com
         Resolution|FIXED                       |

--- Comment #2 from Jakub Jelinek <jakub at redhat dot com> 2011-12-06 13:19:52 UTC ---
Can you explain where and how?  I don't see any recent fixes for the buggy
sysdeps/powerpc/fpu/e_hypot.c, all other architectures use a sane
implementation, but this new powerpc implementation doesn't attempt to handle
any corner cases except for the checks if larger one is > two500 or smaller one
< twoM500.

-- 
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.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug math/13472] PPC64 hypot() is "inf" for very large values that are non-infinite on other architectures
  2011-12-05 23:37 [Bug math/13472] New: PPC64 hypot() is "inf" for very large values that are non-infinite on other architectures dmalcolm at redhat dot com
  2011-12-06 10:46 ` [Bug math/13472] " schwab@linux-m68k.org
  2011-12-06 13:20 ` jakub at redhat dot com
@ 2011-12-06 13:27 ` schwab@linux-m68k.org
  2011-12-06 15:11 ` dmalcolm at redhat dot com
  2014-06-27 11:32 ` fweimer at redhat dot com
  4 siblings, 0 replies; 6+ messages in thread
From: schwab@linux-m68k.org @ 2011-12-06 13:27 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=13472

Andreas Schwab <schwab@linux-m68k.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|                            |FIXED

--- Comment #3 from Andreas Schwab <schwab@linux-m68k.org> 2011-12-06 13:26:56 UTC ---
Forgot to push out.

-- 
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.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug math/13472] PPC64 hypot() is "inf" for very large values that are non-infinite on other architectures
  2011-12-05 23:37 [Bug math/13472] New: PPC64 hypot() is "inf" for very large values that are non-infinite on other architectures dmalcolm at redhat dot com
                   ` (2 preceding siblings ...)
  2011-12-06 13:27 ` schwab@linux-m68k.org
@ 2011-12-06 15:11 ` dmalcolm at redhat dot com
  2014-06-27 11:32 ` fweimer at redhat dot com
  4 siblings, 0 replies; 6+ messages in thread
From: dmalcolm at redhat dot com @ 2011-12-06 15:11 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=13472

--- Comment #4 from Dave Malcolm <dmalcolm at redhat dot com> 2011-12-06 15:11:04 UTC ---
Note to self:
  Fix appears to be:
   
http://repo.or.cz/w/glibc.git/commit/850fb039cec802072f70ed9763927881bbbf639c

-- 
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.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug math/13472] PPC64 hypot() is "inf" for very large values that are non-infinite on other architectures
  2011-12-05 23:37 [Bug math/13472] New: PPC64 hypot() is "inf" for very large values that are non-infinite on other architectures dmalcolm at redhat dot com
                   ` (3 preceding siblings ...)
  2011-12-06 15:11 ` dmalcolm at redhat dot com
@ 2014-06-27 11:32 ` fweimer at redhat dot com
  4 siblings, 0 replies; 6+ messages in thread
From: fweimer at redhat dot com @ 2014-06-27 11:32 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=13472

Florian Weimer <fweimer at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
              Flags|                            |security-

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-06-27 11:32 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-05 23:37 [Bug math/13472] New: PPC64 hypot() is "inf" for very large values that are non-infinite on other architectures dmalcolm at redhat dot com
2011-12-06 10:46 ` [Bug math/13472] " schwab@linux-m68k.org
2011-12-06 13:20 ` jakub at redhat dot com
2011-12-06 13:27 ` schwab@linux-m68k.org
2011-12-06 15:11 ` dmalcolm at redhat dot com
2014-06-27 11:32 ` fweimer at redhat dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).