public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug math/18242] New: powf, powl, do not conform to POSIX for (0, -INFINITY) input
@ 2015-04-10 12:04 nszabolcs at gmail dot com
  2015-04-10 16:34 ` [Bug math/18242] " jsm28 at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: nszabolcs at gmail dot com @ 2015-04-10 12:04 UTC (permalink / raw)
  To: glibc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="UTF-8", Size: 4886 bytes --]

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

            Bug ID: 18242
           Summary: powf, powl, do not conform to POSIX for (0, -INFINITY)
                    input
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: math
          Assignee: unassigned at sourceware dot org
          Reporter: nszabolcs at gmail dot com

posix seems to require pow(0, -INFINITY) to raise divbyzero flag.

ISO C Annex F:
pow((+-)0, -(inf)) returns +(inf) and may raise the ''divide-by-zero''
floating-point exception.
http://port70.net/~nsz/c/c11/n1570.html#F.10.4.4

but

POSIX-2008 (2013):
On systems that support the IEC 60559 Floating-Point option, if x is ±0,
a pole error shall occur and pow(), powf(), and powl() shall return
±HUGE_VAL, ±HUGE_VALF, and ±HUGE_VALL, respectively if y is an odd
integer, or HUGE_VAL, HUGE_VALF, and HUGE_VALL, respectively if y is not
an odd integer.
http://pubs.opengroup.org/onlinepubs/9699919799/functions/pow.html


#define _POSIX_C_SOURCE 200809L
#include <fenv.h>
#include <math.h>
#include <stdio.h>


int main()
{
#pragma STDC FENV_ACCESS ON

powf(0, -INFINITY);
if (!fetestexcept(FE_DIVBYZERO))
        printf("powf did not raise div by zero flag.\n");

feclearexcept(FE_ALL_EXCEPT);
// this one works correctly
pow(0, -INFINITY);
if (!fetestexcept(FE_DIVBYZERO))
        printf("pow did not raise div by zero flag.\n");

feclearexcept(FE_ALL_EXCEPT);
powl(0, -INFINITY);
if (!fetestexcept(FE_DIVBYZERO))
        printf("powl did not raise div by zero flag.\n");
}

-- 
You are receiving this mail because:
You are on the CC list for the bug.
>From glibc-bugs-return-27998-listarch-glibc-bugs=sources.redhat.com@sourceware.org Fri Apr 10 12:11:25 2015
Return-Path: <glibc-bugs-return-27998-listarch-glibc-bugs=sources.redhat.com@sourceware.org>
Delivered-To: listarch-glibc-bugs@sources.redhat.com
Received: (qmail 47191 invoked by alias); 10 Apr 2015 12:11:24 -0000
Mailing-List: contact glibc-bugs-help@sourceware.org; run by ezmlm
Precedence: bulk
List-Id: <glibc-bugs.sourceware.org>
List-Subscribe: <mailto:glibc-bugs-subscribe@sourceware.org>
List-Post: <mailto:glibc-bugs@sourceware.org>
List-Help: <mailto:glibc-bugs-help@sourceware.org>, <http://sourceware.org/lists.html#faqs>
Sender: glibc-bugs-owner@sourceware.org
Delivered-To: mailing list glibc-bugs@sourceware.org
Received: (qmail 47145 invoked by uid 48); 10 Apr 2015 12:11:21 -0000
From: "nszabolcs at gmail dot com" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sourceware.org
Subject: [Bug nptl/18243] New: sem_wait, sem_timedwait are cancellation points shm_open is not
Date: Fri, 10 Apr 2015 12:11:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: new
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: glibc
X-Bugzilla-Component: nptl
X-Bugzilla-Version: unspecified
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: nszabolcs at gmail dot com
X-Bugzilla-Status: NEW
X-Bugzilla-Priority: P2
X-Bugzilla-Assigned-To: unassigned at sourceware dot org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter cc attachments.created
Message-ID: <bug-18243-131@http.sourceware.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://sourceware.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2015-04/txt/msg00056.txt.bz2
Content-length: 1171

https://sourceware.org/bugzilla/show_bug.cgi?id\x18243

            Bug ID: 18243
           Summary: sem_wait, sem_timedwait are cancellation points
                    shm_open is not
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: nptl
          Assignee: unassigned at sourceware dot org
          Reporter: nszabolcs at gmail dot com
                CC: drepper.fsp at gmail dot com

Created attachment 8237
  --> https://sourceware.org/bugzilla/attachment.cgi?id‚37&actioníit
pthread cancellation point test

uncontended sem_wait, sem_timedwait fail to act on cancellation.

shm_open can be cancelled, but it shouldn't.

http://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html#tag_15_09_05

the attached code prints:

res == PTHREAD_CANCELED failed (non-blocking sem_wait, canceled thread exit
status)
res == PTHREAD_CANCELED failed (non-blocking sem_timedwait, canceled thread
exit status)
res != PTHREAD_CANCELED failed (shm_open, canceled thread exit status)

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


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

* [Bug math/18242] powf, powl, do not conform to POSIX for (0, -INFINITY) input
  2015-04-10 12:04 [Bug math/18242] New: powf, powl, do not conform to POSIX for (0, -INFINITY) input nszabolcs at gmail dot com
@ 2015-04-10 16:34 ` jsm28 at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: jsm28 at gcc dot gnu.org @ 2015-04-10 16:34 UTC (permalink / raw)
  To: glibc-bugs

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

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

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

--- Comment #1 from Joseph Myers <jsm28 at gcc dot gnu.org> ---
The C99 requirement to raise divide-by-zero in this case was a defect, as it
was contrary to IEEE 754 semantics for that exception.  See N1515.  Thus, it's
a defect in POSIX that it hasn't adopted the C11 correction, and the ideal
result would be *never* raising that exception in this case.

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


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

end of thread, other threads:[~2015-04-10 16:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-10 12:04 [Bug math/18242] New: powf, powl, do not conform to POSIX for (0, -INFINITY) input nszabolcs at gmail dot com
2015-04-10 16:34 ` [Bug math/18242] " 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).