public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug math/3866] New: pow(double, double) does not fulfil several of C99's requirements
@ 2007-01-12 23:31 kreckel at ginac dot de
  2008-07-30 10:20 ` [Bug math/3866] " mtk dot manpages at gmail dot com
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: kreckel at ginac dot de @ 2007-01-12 23:31 UTC (permalink / raw)
  To: glibc-bugs

Here is a list of bugs in GlibCs pow implementation.


1) pow(-1, 1e100):

Returns NaN and raises the "invalid" floating-point exception.

It should return 1 and raise no exception. (This is because all large
floating-point numbers are even integers if the radix is even. This
motivates pow(-1, inf) = +1, which is treated correctly by GlibC).


2) pow(-1, -1e100):

Same as above.


3) pow(-3.141592, 1e100):

Returns NaN and raises the "invalid" floating-point exception.

It should return +inf and raise the "overflow" floating-point exception flag.


4) pow(-3.141592, -1e100):

Returns NaN and raises the "invalid" floating-point exception.

It should return +0 and raise the "underflow" floating-point exception flag.



4) pow(-0, -1e100):

Raises the "invalid" floating point exception.

It shouldn't do that: this is just a case of exact division by
zero. Division by zero is correctly flagged and +inf is returned, but
the "invalid" flag is wrong.



5) pow(-inf, -1e100):

Raises the "invalid" floating point exception.

It shouldn't do that. After all, it correctly returns 0.


6) pow(-inf, 1e100):

Raises the "invalid" floating point exception.

It shouldn't do that. After all, it correctly returns +inf.


7) pow(-0, -9.0071991544401990e+15)

This returns +inf.

It should return -inf, since the double precision exponent is an odd number
(fabs(fmod(-9.0071991544401990e+15,2.0))==1.0 exactly).

-- 
           Summary: pow(double, double) does not fulfil several of C99's
                    requirements
           Product: glibc
           Version: 2.4
            Status: NEW
          Severity: normal
          Priority: P2
         Component: math
        AssignedTo: aj at suse dot de
        ReportedBy: kreckel at ginac dot de
                CC: glibc-bugs at sources dot redhat dot com
  GCC host triplet: i386-linux-gnu


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

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

* [Bug math/3866] pow(double, double) does not fulfil several of C99's requirements
  2007-01-12 23:31 [Bug math/3866] New: pow(double, double) does not fulfil several of C99's requirements kreckel at ginac dot de
@ 2008-07-30 10:20 ` mtk dot manpages at gmail dot com
  2008-08-05 14:07 ` mtk dot manpages at gmail dot com
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: mtk dot manpages at gmail dot com @ 2008-07-30 10:20 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=3866

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

* [Bug math/3866] pow(double, double) does not fulfil several of C99's requirements
  2007-01-12 23:31 [Bug math/3866] New: pow(double, double) does not fulfil several of C99's requirements kreckel at ginac dot de
  2008-07-30 10:20 ` [Bug math/3866] " mtk dot manpages at gmail dot com
@ 2008-08-05 14:07 ` mtk dot manpages at gmail dot com
  2008-08-05 14:20 ` mtk dot manpages at gmail dot com
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: mtk dot manpages at gmail dot com @ 2008-08-05 14:07 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From mtk dot manpages at gmail dot com  2008-08-05 14:05 -------
Created an attachment (id=2892)
 --> (http://sourceware.org/bugzilla/attachment.cgi?id=2892&action=view)
test program

Just to add a little detail here regarding these four points:

1) pow(-1, 1e100):
2) pow(-1, -1e100):
3) pow(-3.141592, 1e100):
4) pow(-3.141592, -1e100):

If x is less than -0, then (on x86, glibc 2.8) pow() fails with EDOM/FE_INVALID
for any y whose absolute value is greater than about 9.223373e18. 
(EDOM/FE_INVALID == pole error, which is the error that occurs if x == 0, and y
is negative)

-- 


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

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

* [Bug math/3866] pow(double, double) does not fulfil several of C99's requirements
  2007-01-12 23:31 [Bug math/3866] New: pow(double, double) does not fulfil several of C99's requirements kreckel at ginac dot de
  2008-07-30 10:20 ` [Bug math/3866] " mtk dot manpages at gmail dot com
  2008-08-05 14:07 ` mtk dot manpages at gmail dot com
@ 2008-08-05 14:20 ` mtk dot manpages at gmail dot com
  2008-08-05 14:22 ` mtk dot manpages at gmail dot com
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: mtk dot manpages at gmail dot com @ 2008-08-05 14:20 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From mtk dot manpages at gmail dot com  2008-08-05 14:19 -------
Regarding:
4) pow(-0, -1e100)

this problem seems to be absent on glibc 2.8.  There, pow(-0, -1e100) does the
right thing, returning -Inf and giving EDOM/FE_DIVBYZERO.

-- 


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

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

* [Bug math/3866] pow(double, double) does not fulfil several of C99's requirements
  2007-01-12 23:31 [Bug math/3866] New: pow(double, double) does not fulfil several of C99's requirements kreckel at ginac dot de
                   ` (2 preceding siblings ...)
  2008-08-05 14:20 ` mtk dot manpages at gmail dot com
@ 2008-08-05 14:22 ` mtk dot manpages at gmail dot com
  2008-08-05 22:06 ` kreckel at ginac dot de
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: mtk dot manpages at gmail dot com @ 2008-08-05 14:22 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From mtk dot manpages at gmail dot com  2008-08-05 14:21 -------
Regarding:
5) pow(-inf, -1e100):
6) pow(-inf, 1e100):

The problem persists in glibc 2.8, and again the cut-off y value that
demonstrates this behavior is |y| greater than about  9.223373e18.


-- 


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

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

* [Bug math/3866] pow(double, double) does not fulfil several of C99's requirements
  2007-01-12 23:31 [Bug math/3866] New: pow(double, double) does not fulfil several of C99's requirements kreckel at ginac dot de
                   ` (3 preceding siblings ...)
  2008-08-05 14:22 ` mtk dot manpages at gmail dot com
@ 2008-08-05 22:06 ` kreckel at ginac dot de
  2008-08-08  5:49 ` mtk dot manpages at gmail dot com
  2009-09-24  8:14 ` vincent+libc at vinc17 dot org
  6 siblings, 0 replies; 8+ messages in thread
From: kreckel at ginac dot de @ 2008-08-05 22:06 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From kreckel at ginac dot de  2008-08-05 22:04 -------
(In reply to comment #2)
> 4) pow(-0, -1e100)
> 
> this problem seems to be absent on glibc 2.8.  There, pow(-0, -1e100) does the
> right thing, returning -Inf and giving EDOM/FE_DIVBYZERO.

But the right thing to do would return +Inf and giving EDOM/FE_DIVBYZERO, as
-1e100 is < 0 and not an odd integer (specified in. F.9.4.4, second dash.)

-- 


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

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

* [Bug math/3866] pow(double, double) does not fulfil several of C99's requirements
  2007-01-12 23:31 [Bug math/3866] New: pow(double, double) does not fulfil several of C99's requirements kreckel at ginac dot de
                   ` (4 preceding siblings ...)
  2008-08-05 22:06 ` kreckel at ginac dot de
@ 2008-08-08  5:49 ` mtk dot manpages at gmail dot com
  2009-09-24  8:14 ` vincent+libc at vinc17 dot org
  6 siblings, 0 replies; 8+ messages in thread
From: mtk dot manpages at gmail dot com @ 2008-08-08  5:49 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From mtk dot manpages at gmail dot com  2008-08-08 05:48 -------
(In reply to comment #4)
> (In reply to comment #2)
> > 4) pow(-0, -1e100)
> > 
> > this problem seems to be absent on glibc 2.8.  There, pow(-0, -1e100) does 
the
> > right thing, returning -Inf and giving EDOM/FE_DIVBYZERO.
> But the right thing to do would return +Inf and giving EDOM/FE_DIVBYZERO, as
> -1e100 is < 0 and not an odd integer (specified in. F.9.4.4, second dash.)

Oops.  Yes, of course you are right.  And glibc 2.8 is doing the right thing, 
I just wrote the wrong thing. pow(-0, -1e100) gives +Inf with 
EDOM/FE_DIVBYZERO.

-- 


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

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

* [Bug math/3866] pow(double, double) does not fulfil several of C99's requirements
  2007-01-12 23:31 [Bug math/3866] New: pow(double, double) does not fulfil several of C99's requirements kreckel at ginac dot de
                   ` (5 preceding siblings ...)
  2008-08-08  5:49 ` mtk dot manpages at gmail dot com
@ 2009-09-24  8:14 ` vincent+libc at vinc17 dot org
  6 siblings, 0 replies; 8+ messages in thread
From: vincent+libc at vinc17 dot org @ 2009-09-24  8:14 UTC (permalink / raw)
  To: glibc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |vincent+libc at vinc17 dot
                   |                            |org


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

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

end of thread, other threads:[~2009-09-24  8:14 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-01-12 23:31 [Bug math/3866] New: pow(double, double) does not fulfil several of C99's requirements kreckel at ginac dot de
2008-07-30 10:20 ` [Bug math/3866] " mtk dot manpages at gmail dot com
2008-08-05 14:07 ` mtk dot manpages at gmail dot com
2008-08-05 14:20 ` mtk dot manpages at gmail dot com
2008-08-05 14:22 ` mtk dot manpages at gmail dot com
2008-08-05 22:06 ` kreckel at ginac dot de
2008-08-08  5:49 ` mtk dot manpages at gmail dot com
2009-09-24  8:14 ` vincent+libc at vinc17 dot 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).