public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug math/18238] New: quality of implementation: fmin and fmax should handle signed zeros
@ 2015-04-10 11:03 nszabolcs at gmail dot com
  2015-04-10 16:32 ` [Bug math/18238] " jsm28 at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: nszabolcs at gmail dot com @ 2015-04-10 11:03 UTC (permalink / raw)
  To: glibc-bugs

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

            Bug ID: 18238
           Summary: quality of implementation: fmin and fmax should handle
                    signed zeros
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: math
          Assignee: unassigned at sourceware dot org
          Reporter: nszabolcs at gmail dot com

ISO C with Annex F seems to allow the result of fmax and fmin to have arbitrary
sign when the arguments are zeros, but ideally the sign should be handled
because these functions are supposed to have exact result.

http://port70.net/~nsz/c/c11/n1570.html#F.10.9.2

the code below outputs:

fmax(0, -0.0) signbit is not 0
fmaxf(0, -0.0f) signbit is not 0
fmaxl(-0.0L, 0) signbit is not 0
fmin(-0.0, 0) signbit is not 1
fminf(-0.0f, 0) signbit is not 1
fminl(0, -0.0L) signbit is not 1


#include <math.h>
#include <stdio.h>

#define T(f,s) if (signbit(f) != s) printf(#f " signbit is not " #s "\n");

int main()
{
T(fmax(0, -0.0), 0)
T(fmaxf(0, -0.0f), 0)
T(fmaxl(-0.0L, 0), 0)
T(fmin(-0.0, 0), 1)
T(fminf(-0.0f, 0), 1)
T(fminl(0, -0.0L), 1)
}

-- 
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/18238] quality of implementation: fmin and fmax should handle signed zeros
  2015-04-10 11:03 [Bug math/18238] New: quality of implementation: fmin and fmax should handle signed zeros nszabolcs at gmail dot com
@ 2015-04-10 16:32 ` 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:32 UTC (permalink / raw)
  To: glibc-bugs

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

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

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

--- Comment #1 from Joseph Myers <jsm28 at gcc dot gnu.org> ---
These functions are only supposed to have results exact to the extent specified
in IEEE 754.  When both IEEE 754 and ISO C explicitly do not specify the sign
of a zero result, I don't think it's appropriate to slow down our
implementations to produce a more fully specified result.

-- 
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:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-10 11:03 [Bug math/18238] New: quality of implementation: fmin and fmax should handle signed zeros nszabolcs at gmail dot com
2015-04-10 16:32 ` [Bug math/18238] " 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).