public inbox for glibc-bugs@sourceware.org help / color / mirror / Atom feed
From: "rsa at us dot ibm.com" <sourceware-bugzilla@sourceware.org> To: glibc-bugs@sources.redhat.com Subject: [Bug math/887] Math library function "logb" and "nextafter" inconsistent Date: Thu, 23 Feb 2012 19:49:00 -0000 [thread overview] Message-ID: <bug-887-131-9FmKDwCCnl@http.sourceware.org/bugzilla/> (raw) In-Reply-To: <bug-887-131@http.sourceware.org/bugzilla/> http://sourceware.org/bugzilla/show_bug.cgi?id=887 --- Comment #11 from Ryan S. Arnold <rsa at us dot ibm.com> 2012-02-23 19:48:48 UTC --- Here's an actual testcase which demonstrates the behavior in logb that's undesireable: #include <stdio.h> #include <math.h> #include <fenv.h> #include <float.h> #define NUM_INPUTS 6 int main() { double ret; int i = 0; typedef union { long long ll; double d; } input; input inputs[NUM_INPUTS]; inputs[0].ll = 0X3FF0000000000000LL; inputs[1].ll = 0X3FF8000000000000LL; inputs[2].ll = 0X3FF2000000000000LL; inputs[3].ll = 0X3FFFFFFFFFFFFFFFLL; inputs[4].ll = 0X3FF7FFFFFFFFFFFFLL; inputs[5].ll = 0X3FF1FFFFFFFFFFFFLL; for (i=0;i<NUM_INPUTS;i++) { printf ("Input: %f\n",inputs[i].d); fesetround (FE_TONEAREST); ret = logb (inputs[i].d); printf ("%f\n",ret); fesetround (FE_DOWNWARD); ret = logb (inputs[i].d); printf ("%f\n",ret); } return 0; } This doesn't fail on PowerPC64: ~/bugs/GLIBC887/$ vim foo.c ~/bugs/GLIBC887/$ gcc -m64 foo.c -o foo -lm ~/bugs/GLIBC887/$ ./foo Input: 1.000000 0.000000 0.000000 Input: 1.500000 0.000000 0.000000 Input: 1.125000 0.000000 0.000000 Input: 2.000000 0.000000 0.000000 Input: 1.500000 0.000000 0.000000 Input: 1.125000 0.000000 0.000000 gcc version 4.1.2 20070115 (SUSE Linux) But it does fail with 32-bit PowerPC: ~/bugs/GLIBC887/$ gcc -m32 foo.c -o foo -lm ~/bugs/GLIBC887/$ ./foo Input: 1.000000 0.000000 -0.000000 Input: 1.500000 0.000000 -0.000000 Input: 1.125000 0.000000 -0.000000 Input: 2.000000 0.000000 -0.000000 Input: 1.500000 0.000000 -0.000000 Input: 1.125000 0.000000 -0.000000 gcc version 4.1.2 20070115 (SUSE Linux) libc-2.4.so I tried a newer compiler and library: ~/bugs/GLIBC887/$ /opt/at4.0/bin/gcc -m32 foo.c -o foo -lm ~/bugs/GLIBC887/$ ./foo Input: 1.000000 0.000000 0.000000 Input: 1.500000 0.000000 0.000000 Input: 1.125000 0.000000 0.000000 Input: 2.000000 0.000000 0.000000 Input: 1.500000 0.000000 0.000000 Input: 1.125000 0.000000 0.000000 gcc version 4.5.4 20110524 (Advance-Toolchain-4.0-5) [ibm/gcc-4_5-branch revision 179810] (GCC) libc-2.12.1.so -- 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.
next prev parent reply other threads:[~2012-02-23 19:49 UTC|newest] Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top [not found] <bug-887-131@http.sourceware.org/bugzilla/> 2012-02-22 21:44 ` jsm28 at gcc dot gnu.org 2012-02-23 19:49 ` rsa at us dot ibm.com [this message] 2012-02-23 21:29 ` rsa at us dot ibm.com 2012-02-23 21:39 ` joseph at codesourcery dot com 2012-02-23 21:44 ` rsa at us dot ibm.com 2012-02-23 23:18 ` rsa at us dot ibm.com 2012-02-29 16:22 ` rsa at us dot ibm.com 2012-02-29 16:23 ` rsa at us dot ibm.com 2012-03-01 21:26 ` rsa at us dot ibm.com 2012-03-26 19:34 ` rsa at us dot ibm.com 2012-03-26 20:43 ` rsa at us dot ibm.com 2012-03-26 20:51 ` joseph at codesourcery dot com 2012-03-26 20:56 ` rsa at us dot ibm.com 2012-03-26 20:57 ` rsa at us dot ibm.com 2012-03-26 22:23 ` rsa at us dot ibm.com 2012-04-25 22:01 ` rsa at us dot ibm.com 2012-04-26 18:16 ` rsa at us dot ibm.com 2012-04-26 18:53 ` joseph at codesourcery dot com 2012-04-26 19:04 ` rsa at us dot ibm.com 2012-04-27 16:31 ` rsa at us dot ibm.com 2014-01-07 22:43 ` cvs-commit at gcc dot gnu.org 2015-10-01 21:50 ` jsm28 at gcc dot gnu.org 2015-10-01 21:51 ` jsm28 at gcc dot gnu.org 2015-10-05 17:48 ` cvs-commit at gcc dot gnu.org 2015-10-05 17:50 ` cvs-commit at gcc dot gnu.org 2015-10-05 17:51 ` jsm28 at gcc dot gnu.org 2005-04-28 17:50 [Bug math/887] New: " uttamp at us dot ibm dot com 2005-04-29 20:38 ` [Bug math/887] " uttamp at us dot ibm dot com 2005-06-16 19:12 ` uttamp at us dot ibm dot com 2005-07-19 22:16 ` uttamp at us dot ibm dot com 2005-10-25 17:05 ` uttamp at us dot ibm dot com 2005-11-02 1:29 ` uttamp at us dot ibm dot com 2005-11-21 17:57 ` uttamp at us dot ibm dot com 2005-11-21 18:07 ` jakub at redhat dot com 2006-09-30 5:03 ` rsa at us dot ibm dot com 2006-09-30 5:54 ` rsa at us dot ibm dot com
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-887-131-9FmKDwCCnl@http.sourceware.org/bugzilla/ \ --to=sourceware-bugzilla@sourceware.org \ --cc=glibc-bugs@sources.redhat.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).