public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug math/369] New: pow problems on x86
@ 2004-09-06 12:24 vargaz at gmail dot com
  2004-12-18 15:37 ` [Bug math/369] " aj at suse dot de
                   ` (9 more replies)
  0 siblings, 10 replies; 15+ messages in thread
From: vargaz at gmail dot com @ 2004-09-06 12:24 UTC (permalink / raw)
  To: glibc-bugs

Consider the following test program:
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
#include <stdio.h>
#include <math.h>

void main() {
        double d;

        d = pow (-2, 1E300);
        printf ("D: %f.\n", d);

        d = pow (-2, -1E300);
        printf ("D: %f.\n", d);
}
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

Under x86 linux, this prints out:

D: nan.
D: nan

I think the answer should be +inf and 0, respectively. Both
solaris,
windows, and the IBM Accurate Portable Mathematical library
returns
these values, so I think this might be a bug in the assembly
language
pow routine in glibc.

-- 
           Summary: pow problems on x86
           Product: glibc
           Version: 2.3.2
            Status: NEW
          Severity: normal
          Priority: P2
         Component: math
        AssignedTo: aj at suse dot de
        ReportedBy: vargaz at gmail dot com
                CC: glibc-bugs at sources dot redhat dot com
  GCC host triplet: i686-pc-linux-gnu


http://sources.redhat.com/bugzilla/show_bug.cgi?id=369

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug math/369] pow problems on x86
  2004-09-06 12:24 [Bug math/369] New: pow problems on x86 vargaz at gmail dot com
@ 2004-12-18 15:37 ` aj at suse dot de
  2006-05-07 14:57 ` steven at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 15+ messages in thread
From: aj at suse dot de @ 2004-12-18 15:37 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From aj at suse dot de  2004-12-18 15:37 -------
The report is confirmed.  On other platforms we get the expected result.

Uli, could you look into this, please?

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|aj at suse dot de           |drepper at redhat dot com
             Status|NEW                         |ASSIGNED


http://sources.redhat.com/bugzilla/show_bug.cgi?id=369

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug math/369] pow problems on x86
  2004-09-06 12:24 [Bug math/369] New: pow problems on x86 vargaz at gmail dot com
  2004-12-18 15:37 ` [Bug math/369] " aj at suse dot de
@ 2006-05-07 14:57 ` steven at gcc dot gnu dot org
  2006-06-15  9:17 ` nikolay dot zhuravlev at auriga dot ru
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 15+ messages in thread
From: steven at gcc dot gnu dot org @ 2006-05-07 14:57 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From steven at gcc dot gnu dot org  2006-05-07 14:57 -------
It seems I've run into this one now, too.  What happened to this bug?


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |steven at gcc dot gnu dot
                   |                            |org


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

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug math/369] pow problems on x86
  2004-09-06 12:24 [Bug math/369] New: pow problems on x86 vargaz at gmail dot com
  2004-12-18 15:37 ` [Bug math/369] " aj at suse dot de
  2006-05-07 14:57 ` steven at gcc dot gnu dot org
@ 2006-06-15  9:17 ` nikolay dot zhuravlev at auriga dot ru
  2006-06-15  9:24 ` nikolay dot zhuravlev at auriga dot ru
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 15+ messages in thread
From: nikolay dot zhuravlev at auriga dot ru @ 2006-06-15  9:17 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From nikolay dot zhuravlev at auriga dot ru  2006-06-15 09:17 -------
I built glibc from CVS on 2006/06/14 and the bug is still there.
I think the culprit is the assembler code in __ieee754_pow.

POSIX wants HUGE_VAL for pow(-2, 1E300).

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|2.3.2                       |2.4


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

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug math/369] pow problems on x86
  2004-09-06 12:24 [Bug math/369] New: pow problems on x86 vargaz at gmail dot com
                   ` (2 preceding siblings ...)
  2006-06-15  9:17 ` nikolay dot zhuravlev at auriga dot ru
@ 2006-06-15  9:24 ` nikolay dot zhuravlev at auriga dot ru
  2006-08-31 22:27 ` eberlein at us dot ibm dot com
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 15+ messages in thread
From: nikolay dot zhuravlev at auriga dot ru @ 2006-06-15  9:24 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From nikolay dot zhuravlev at auriga dot ru  2006-06-15 09:23 -------
Changed version to 'unspecified' since it is in the trunk

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|2.4                         |unspecified


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

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug math/369] pow problems on x86
  2004-09-06 12:24 [Bug math/369] New: pow problems on x86 vargaz at gmail dot com
                   ` (3 preceding siblings ...)
  2006-06-15  9:24 ` nikolay dot zhuravlev at auriga dot ru
@ 2006-08-31 22:27 ` eberlein at us dot ibm dot com
  2006-08-31 22:32 ` eberlein at us dot ibm dot com
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 15+ messages in thread
From: eberlein at us dot ibm dot com @ 2006-08-31 22:27 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From eberlein at us dot ibm dot com  2006-08-31 22:27 -------
Created an attachment (id=1269)
 --> (http://sourceware.org/bugzilla/attachment.cgi?id=1269&action=view)
patch for pow to return inf/0 for (-2,+/-1E300)

I've created a patch to return inf for pow(-2,1E300) and 0 for pow(-2,-1E300). 
This patch modifies the function to use |x| and filter the result if x < 0,
keeping inf or zero, otherwise return NaN.


-- 


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

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug math/369] pow problems on x86
  2004-09-06 12:24 [Bug math/369] New: pow problems on x86 vargaz at gmail dot com
                   ` (4 preceding siblings ...)
  2006-08-31 22:27 ` eberlein at us dot ibm dot com
@ 2006-08-31 22:32 ` eberlein at us dot ibm dot com
  2007-12-15  9:46 ` ismail at pardus dot org dot tr
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 15+ messages in thread
From: eberlein at us dot ibm dot com @ 2006-08-31 22:32 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From eberlein at us dot ibm dot com  2006-08-31 22:32 -------
Created an attachment (id=1270)
 --> (http://sourceware.org/bugzilla/attachment.cgi?id=1270&action=view)
patch for pow to return inf/0 for (-2,+/-1E300)

oops, fixing the diff since it had some control chars accidentally pasted into
the file.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
Attachment #1269 is|0                           |1
           obsolete|                            |


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

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug math/369] pow problems on x86
  2004-09-06 12:24 [Bug math/369] New: pow problems on x86 vargaz at gmail dot com
                   ` (5 preceding siblings ...)
  2006-08-31 22:32 ` eberlein at us dot ibm dot com
@ 2007-12-15  9:46 ` ismail at pardus dot org dot tr
  2008-07-30  9:18 ` mtk dot manpages at gmail dot com
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 15+ messages in thread
From: ismail at pardus dot org dot tr @ 2007-12-15  9:46 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From ismail at pardus dot org dot tr  2007-12-15 09:46 -------
Still affects glibc 2.7

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ismail at pardus dot org dot
                   |                            |tr


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

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug math/369] pow problems on x86
  2004-09-06 12:24 [Bug math/369] New: pow problems on x86 vargaz at gmail dot com
                   ` (7 preceding siblings ...)
  2008-07-30  9:18 ` mtk dot manpages at gmail dot com
@ 2008-07-30  9:18 ` mtk dot manpages at gmail dot com
  2010-09-12  5:44 ` mtk dot manpages at gmail dot com
  9 siblings, 0 replies; 15+ messages in thread
From: mtk dot manpages at gmail dot com @ 2008-07-30  9:18 UTC (permalink / raw)
  To: glibc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mtk dot manpages at gmail
                   |                            |dot com


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

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug math/369] pow problems on x86
  2004-09-06 12:24 [Bug math/369] New: pow problems on x86 vargaz at gmail dot com
                   ` (6 preceding siblings ...)
  2007-12-15  9:46 ` ismail at pardus dot org dot tr
@ 2008-07-30  9:18 ` mtk dot manpages at gmail dot com
  2008-07-30  9:18 ` mtk dot manpages at gmail dot com
  2010-09-12  5:44 ` mtk dot manpages at gmail dot com
  9 siblings, 0 replies; 15+ messages in thread
From: mtk dot manpages at gmail dot com @ 2008-07-30  9:18 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From mtk dot manpages at gmail dot com  2008-07-30 09:17 -------
Still present in glibc 2.8

-- 


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

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug math/369] pow problems on x86
  2004-09-06 12:24 [Bug math/369] New: pow problems on x86 vargaz at gmail dot com
                   ` (8 preceding siblings ...)
  2008-07-30  9:18 ` mtk dot manpages at gmail dot com
@ 2010-09-12  5:44 ` mtk dot manpages at gmail dot com
  9 siblings, 0 replies; 15+ messages in thread
From: mtk dot manpages at gmail dot com @ 2010-09-12  5:44 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From mtk dot manpages at gmail dot com  2010-09-12 05:44 -------
Still present in glibc 2.12.1, where we get:

D: -nan.
D: -nan.

-- 


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

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug math/369] pow problems on x86
       [not found] <bug-369-131@http.sourceware.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2012-03-27 16:28 ` jsm28 at gcc dot gnu.org
@ 2012-03-28 15:03 ` jsm28 at gcc dot gnu.org
  3 siblings, 0 replies; 15+ messages in thread
From: jsm28 at gcc dot gnu.org @ 2012-03-28 15:03 UTC (permalink / raw)
  To: glibc-bugs

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

Joseph Myers <jsm28 at gcc dot gnu.org> changed:

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

--- Comment #13 from Joseph Myers <jsm28 at gcc dot gnu.org> 2012-03-28 15:01:45 UTC ---
Fixed by:

commit d6270972f79fe89a96fa7a3909991dad2e317033
Author: Joseph Myers <joseph@codesourcery.com>
Date:   Wed Mar 28 14:57:58 2012 +0000

    Fix pow of negative numbers to integer exponents (bugs 369, 2678, 3866).

-- 
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] 15+ messages in thread

* [Bug math/369] pow problems on x86
       [not found] <bug-369-131@http.sourceware.org/bugzilla/>
  2012-02-22 21:27 ` jsm28 at gcc dot gnu.org
  2012-03-23 16:54 ` bonzini at gnu dot org
@ 2012-03-27 16:28 ` jsm28 at gcc dot gnu.org
  2012-03-28 15:03 ` jsm28 at gcc dot gnu.org
  3 siblings, 0 replies; 15+ messages in thread
From: jsm28 at gcc dot gnu.org @ 2012-03-27 16:28 UTC (permalink / raw)
  To: glibc-bugs

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

--- Comment #12 from Joseph Myers <jsm28 at gcc dot gnu.org> 2012-03-27 16:02:37 UTC ---
The attached patch is incorrect (it results in NaN for pow (-1, DBL_MAX), which
should be 1; an infinity for pow (-DBL_MAX, 1000.5), which should be NaN; zero
for pow (-DBL_MIN, 1000.5), which should be NaN).  I'm working on a different
patch.

-- 
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] 15+ messages in thread

* [Bug math/369] pow problems on x86
       [not found] <bug-369-131@http.sourceware.org/bugzilla/>
  2012-02-22 21:27 ` jsm28 at gcc dot gnu.org
@ 2012-03-23 16:54 ` bonzini at gnu dot org
  2012-03-27 16:28 ` jsm28 at gcc dot gnu.org
  2012-03-28 15:03 ` jsm28 at gcc dot gnu.org
  3 siblings, 0 replies; 15+ messages in thread
From: bonzini at gnu dot org @ 2012-03-23 16:54 UTC (permalink / raw)
  To: glibc-bugs

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

Paolo Bonzini <bonzini at gnu dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bonzini at gnu dot org

--- Comment #11 from Paolo Bonzini <bonzini at gnu dot org> 2012-03-22 23:21:04 UTC ---
The patch looks good to me from the x86 point of view, but I cannot really say
anything about the math.

-- 
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] 15+ messages in thread

* [Bug math/369] pow problems on x86
       [not found] <bug-369-131@http.sourceware.org/bugzilla/>
@ 2012-02-22 21:27 ` jsm28 at gcc dot gnu.org
  2012-03-23 16:54 ` bonzini at gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 15+ messages in thread
From: jsm28 at gcc dot gnu.org @ 2012-02-22 21:27 UTC (permalink / raw)
  To: glibc-bugs

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

Joseph Myers <jsm28 at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |NEW
         AssignedTo|drepper.fsp at gmail dot    |unassigned at sourceware
                   |com                         |dot org

--- Comment #10 from Joseph Myers <jsm28 at gcc dot gnu.org> 2012-02-22 21:27:13 UTC ---
Still present.  Could one of our x86 experts review Pete Eberlein's patch from
2006?

Testcases are certainly needed for libm-test.inc for a fix to go in - both
tests for the particular cases here, and tests for more normal cases of powers
of negative numbers (negative number to small (+ve and -ve) even powers,
negative number to small (+ve and -ve) odd powers).  Cases involving infinities
and zeros as arguments seem better covered in the testsuite and there are
already tests of negative numbers to fractional powers.

-- 
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] 15+ messages in thread

end of thread, other threads:[~2012-03-28 15:02 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-09-06 12:24 [Bug math/369] New: pow problems on x86 vargaz at gmail dot com
2004-12-18 15:37 ` [Bug math/369] " aj at suse dot de
2006-05-07 14:57 ` steven at gcc dot gnu dot org
2006-06-15  9:17 ` nikolay dot zhuravlev at auriga dot ru
2006-06-15  9:24 ` nikolay dot zhuravlev at auriga dot ru
2006-08-31 22:27 ` eberlein at us dot ibm dot com
2006-08-31 22:32 ` eberlein at us dot ibm dot com
2007-12-15  9:46 ` ismail at pardus dot org dot tr
2008-07-30  9:18 ` mtk dot manpages at gmail dot com
2008-07-30  9:18 ` mtk dot manpages at gmail dot com
2010-09-12  5:44 ` mtk dot manpages at gmail dot com
     [not found] <bug-369-131@http.sourceware.org/bugzilla/>
2012-02-22 21:27 ` jsm28 at gcc dot gnu.org
2012-03-23 16:54 ` bonzini at gnu dot org
2012-03-27 16:28 ` jsm28 at gcc dot gnu.org
2012-03-28 15:03 ` jsm28 at gcc dot gnu.org

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