public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug math/6807] New: y0(), y1(), yn() do not raise exception and give wrong errno for pole error
@ 2008-07-31 12:21 mtk dot manpages at gmail dot com
  2008-07-31 12:23 ` [Bug math/6807] " mtk dot manpages at gmail dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: mtk dot manpages at gmail dot com @ 2008-07-31 12:21 UTC (permalink / raw)
  To: glibc-bugs

The POSIX.1 spec of y0(), y1(), yn() says:

==
Pole Error
    The value of x is zero.

    If the integer expression (math_errhandling & MATH_ERRNO) is non-zero, then
errno shall be set to [ERANGE]. If the integer expression (math_errhandling &
MATH_ERREXCEPT) is non-zero, then the divide-by-zero floating-point exception
shall be raised.
==

For a pole error, GNU's y0(), y1(), yn() set errno to EDOM, and do not raise an
IEEE exception.  This is wrong on both counts.  errno should be set to ERANGE,
and an FE_DIVBYZERO exception should occur.

Note: the POLE ERROR text was only added to POSIX.1-2001 for TC2 (i.e.,
POSIX.1-2004; before that, this case was specified as a RANGE ERROR (which is
mathematically incorrect).

Background: 
On error, many glibc math functions both set errno and raise an exception
(fetestexcept(3)).  For example, the following  function all do this: acos(),
asin(), cosh(), sinh(), acosh(), asinh(), exp(), exp2(), ldexp(), log(),
log10(), log2().  However, there is much inconsistency.  Some functions raise an
exception, but don't set errno.  Some functions set errno for some errors, but
not others.  A few set errno, but don't raise an exception.  This series of bug
reports documents deviations from what I consider the ideal: all functions
should BOTH set errno AND raise an exception for all errors.

All of these reports relate to tests on glibc 2.8 (as provided by SUSE 11.0).

-- 
           Summary: y0(), y1(), yn() do not raise exception and give wrong
                    errno for pole error
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: math
        AssignedTo: aj at suse dot de
        ReportedBy: mtk dot manpages at gmail dot com
                CC: glibc-bugs at sources dot redhat dot com


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

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

* [Bug math/6807] y0(), y1(), yn() do not raise exception and give wrong errno for pole error
  2008-07-31 12:21 [Bug math/6807] New: y0(), y1(), yn() do not raise exception and give wrong errno for pole error mtk dot manpages at gmail dot com
  2008-07-31 12:23 ` [Bug math/6807] " mtk dot manpages at gmail dot com
@ 2008-07-31 12:23 ` mtk dot manpages at gmail dot com
  2008-07-31 12:25 ` mtk dot manpages at gmail dot com
  2008-07-31 12:34 ` mtk dot manpages at gmail dot com
  3 siblings, 0 replies; 10+ messages in thread
From: mtk dot manpages at gmail dot com @ 2008-07-31 12:23 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From mtk dot manpages at gmail dot com  2008-07-31 12:22 -------
Created an attachment (id=2878)
 --> (http://sourceware.org/bugzilla/attachment.cgi?id=2878&action=view)
test program


-- 


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

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

* [Bug math/6807] y0(), y1(), yn() do not raise exception and give wrong errno for pole error
  2008-07-31 12:21 [Bug math/6807] New: y0(), y1(), yn() do not raise exception and give wrong errno for pole error mtk dot manpages at gmail dot com
@ 2008-07-31 12:23 ` mtk dot manpages at gmail dot com
  2008-07-31 12:23 ` mtk dot manpages at gmail dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 10+ messages in thread
From: mtk dot manpages at gmail dot com @ 2008-07-31 12:23 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From mtk dot manpages at gmail dot com  2008-07-31 12:22 -------
Created an attachment (id=2877)
 --> (http://sourceware.org/bugzilla/attachment.cgi?id=2877&action=view)
test program


-- 


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

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

* [Bug math/6807] y0(), y1(), yn() do not raise exception and give wrong errno for pole error
  2008-07-31 12:21 [Bug math/6807] New: y0(), y1(), yn() do not raise exception and give wrong errno for pole error mtk dot manpages at gmail dot com
  2008-07-31 12:23 ` [Bug math/6807] " mtk dot manpages at gmail dot com
  2008-07-31 12:23 ` mtk dot manpages at gmail dot com
@ 2008-07-31 12:25 ` mtk dot manpages at gmail dot com
  2008-07-31 12:34 ` mtk dot manpages at gmail dot com
  3 siblings, 0 replies; 10+ messages in thread
From: mtk dot manpages at gmail dot com @ 2008-07-31 12:25 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From mtk dot manpages at gmail dot com  2008-07-31 12:23 -------
Created an attachment (id=2879)
 --> (http://sourceware.org/bugzilla/attachment.cgi?id=2879&action=view)
test program

Sample runs demonstrating the problem:

$ /tmp/mt_y0 0
errno == EDOM
fetestexcept() says:
y0(0.00000000000000000e+00)=-inf
EDOM 0 -inf

$ /tmp/mt_y1 0
errno == EDOM
fetestexcept() says:
y1(0.00000000000000000e+00)=-inf
EDOM 0 -inf

$ /tmp/mt_yn 1 0
errno == EDOM
fetestexcept() says:
yn(1,0.00000000000000000e+00)=-inf
EDOM 0 -inf

-- 


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

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

* [Bug math/6807] y0(), y1(), yn() do not raise exception and give wrong errno for pole error
  2008-07-31 12:21 [Bug math/6807] New: y0(), y1(), yn() do not raise exception and give wrong errno for pole error mtk dot manpages at gmail dot com
                   ` (2 preceding siblings ...)
  2008-07-31 12:25 ` mtk dot manpages at gmail dot com
@ 2008-07-31 12:34 ` mtk dot manpages at gmail dot com
  3 siblings, 0 replies; 10+ messages in thread
From: mtk dot manpages at gmail dot com @ 2008-07-31 12:34 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From mtk dot manpages at gmail dot com  2008-07-31 12:33 -------
In passing, it is worth noting that these functions do correctly set errno and
raise the right exception at least one other error (domain error).

-- 


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

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

* [Bug math/6807] y0(), y1(), yn() do not raise exception and give wrong errno for pole error
       [not found] <bug-6807-131@http.sourceware.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2014-06-13 11:16 ` fweimer at redhat dot com
@ 2020-05-26 10:26 ` mtk.manpages at gmail dot com
  4 siblings, 0 replies; 10+ messages in thread
From: mtk.manpages at gmail dot com @ 2020-05-26 10:26 UTC (permalink / raw)
  To: glibc-bugs

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

--- Comment #9 from Michael Kerrisk <mtk.manpages at gmail dot com> ---
y0(3) manual page has been patched to note the fix.

diff --git a/man3/y0.3 b/man3/y0.3
index 07e20bd78..460a63ad9 100644
--- a/man3/y0.3
+++ b/man3/y0.3
@@ -187,15 +187,11 @@ Pole error: \fIx\fP is 0.0
 .\" as a range error.
 .I errno
 is set to
-.\" FIXME . y0(0.0) gives EDOM
 .BR ERANGE
-(but see BUGS).
-No
+and an
 .B FE_DIVBYZERO
-exception is returned by
-.BR fetestexcept (3)
-for this case.
-.\" Bug raised: http://sources.redhat.com/bugzilla/show_bug.cgi?id=6808
+exception is raised
+(but see BUGS).
 .TP
 Range error: result underflow
 .\" e.g., y0(1e33) on glibc 2.8/x86-32
@@ -253,15 +249,18 @@ conform to SVr4, 4.3BSD,
 POSIX.1-2001, POSIX.1-2008.
 The others are nonstandard functions that also exist on the BSDs.
 .SH BUGS
-On a pole error, these functions set
+Before glibc 2.19,
+.\" http://sourceware.org/bugzilla/show_bug.cgi?id=6807
+these functions misdiagnosed pole errors:
 .I errno
-to
+was set to
 .BR EDOM ,
 instead of
 .BR ERANGE
+and no
+.B FE_DIVBYZERO
+exception was raised.
 as POSIX.1-2004 requires.
-.\" FIXME .
-.\" Bug raised: http://sourceware.org/bugzilla/show_bug.cgi?id=6807
 .PP
 In glibc version 2.3.2 and earlier,
 .\" FIXME . Actually, 2.3.2 is the earliest test result I have; so yet

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

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

* [Bug math/6807] y0(), y1(), yn() do not raise exception and give wrong errno for pole error
       [not found] <bug-6807-131@http.sourceware.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2013-12-04 14:41 ` jsm28 at gcc dot gnu.org
@ 2014-06-13 11:16 ` fweimer at redhat dot com
  2020-05-26 10:26 ` mtk.manpages at gmail dot com
  4 siblings, 0 replies; 10+ messages in thread
From: fweimer at redhat dot com @ 2014-06-13 11:16 UTC (permalink / raw)
  To: glibc-bugs

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

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

* [Bug math/6807] y0(), y1(), yn() do not raise exception and give wrong errno for pole error
       [not found] <bug-6807-131@http.sourceware.org/bugzilla/>
  2012-03-01 17:57 ` jsm28 at gcc dot gnu.org
  2013-12-04 14:40 ` cvs-commit at gcc dot gnu.org
@ 2013-12-04 14:41 ` jsm28 at gcc dot gnu.org
  2014-06-13 11:16 ` fweimer at redhat dot com
  2020-05-26 10:26 ` mtk.manpages at gmail dot com
  4 siblings, 0 replies; 10+ messages in thread
From: jsm28 at gcc dot gnu.org @ 2013-12-04 14:41 UTC (permalink / raw)
  To: glibc-bugs

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

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

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

--- Comment #7 from Joseph Myers <jsm28 at gcc dot gnu.org> ---
Fixed for 2.19.

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


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

* [Bug math/6807] y0(), y1(), yn() do not raise exception and give wrong errno for pole error
       [not found] <bug-6807-131@http.sourceware.org/bugzilla/>
  2012-03-01 17:57 ` jsm28 at gcc dot gnu.org
@ 2013-12-04 14:40 ` cvs-commit at gcc dot gnu.org
  2013-12-04 14:41 ` jsm28 at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2013-12-04 14:40 UTC (permalink / raw)
  To: glibc-bugs

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

--- Comment #6 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, master has been updated
       via  699ff83712b5796ac50ed332d9dad55d38450e81 (commit)
      from  5b118558f9fb0620508d51c34c2cb5ba4f1f01c2 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=699ff83712b5796ac50ed332d9dad55d38450e81

commit 699ff83712b5796ac50ed332d9dad55d38450e81
Author: Joseph Myers <joseph@codesourcery.com>
Date:   Wed Dec 4 14:39:37 2013 +0000

    Fix Bessel function error handling (bug 6807, bug 15901).

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                           |   28 +++++++++++++++
 NEWS                                |   24 ++++++------
 math/libm-test.inc                  |   66 +++++++++++++++++++++++++++++------
 math/w_j0.c                         |    7 +++-
 math/w_j0f.c                        |    7 +++-
 math/w_j0l.c                        |    7 +++-
 math/w_j1.c                         |    7 +++-
 math/w_j1f.c                        |    7 +++-
 math/w_j1l.c                        |    7 +++-
 math/w_jn.c                         |    7 +++-
 math/w_jnf.c                        |    7 +++-
 sysdeps/i386/fpu/libm-test-ulps     |    3 ++
 sysdeps/ieee754/k_standard.c        |   16 +++++----
 sysdeps/ieee754/ldbl-128/e_jnl.c    |    2 +-
 sysdeps/ieee754/ldbl-128ibm/e_jnl.c |    2 +-
 sysdeps/ieee754/ldbl-96/e_jnl.c     |    3 +-
 sysdeps/x86_64/fpu/libm-test-ulps   |    5 +++
 17 files changed, 156 insertions(+), 49 deletions(-)

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


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

* [Bug math/6807] y0(), y1(), yn() do not raise exception and give wrong errno for pole error
       [not found] <bug-6807-131@http.sourceware.org/bugzilla/>
@ 2012-03-01 17:57 ` jsm28 at gcc dot gnu.org
  2013-12-04 14:40 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 10+ messages in thread
From: jsm28 at gcc dot gnu.org @ 2012-03-01 17:57 UTC (permalink / raw)
  To: glibc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|aj at suse dot de           |unassigned at sourceware
                   |                            |dot org

--- Comment #5 from Joseph Myers <jsm28 at gcc dot gnu.org> 2012-03-01 17:57:04 UTC ---
Confirmed with current sources on both x86 and x86_64.

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

end of thread, other threads:[~2020-05-26 10:26 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-07-31 12:21 [Bug math/6807] New: y0(), y1(), yn() do not raise exception and give wrong errno for pole error mtk dot manpages at gmail dot com
2008-07-31 12:23 ` [Bug math/6807] " mtk dot manpages at gmail dot com
2008-07-31 12:23 ` mtk dot manpages at gmail dot com
2008-07-31 12:25 ` mtk dot manpages at gmail dot com
2008-07-31 12:34 ` mtk dot manpages at gmail dot com
     [not found] <bug-6807-131@http.sourceware.org/bugzilla/>
2012-03-01 17:57 ` jsm28 at gcc dot gnu.org
2013-12-04 14:40 ` cvs-commit at gcc dot gnu.org
2013-12-04 14:41 ` jsm28 at gcc dot gnu.org
2014-06-13 11:16 ` fweimer at redhat dot com
2020-05-26 10:26 ` mtk.manpages at gmail 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).