This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug math/18238] New: quality of implementation: fmin and fmax should handle signed zeros
- From: "nszabolcs at gmail dot com" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sourceware dot org
- Date: Fri, 10 Apr 2015 11:03:51 +0000
- Subject: [Bug math/18238] New: quality of implementation: fmin and fmax should handle signed zeros
- Auto-submitted: auto-generated
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.