From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20189 invoked by alias); 26 Apr 2012 18:16:57 -0000 Received: (qmail 20130 invoked by uid 22791); 26 Apr 2012 18:16:56 -0000 X-SWARE-Spam-Status: No, hits=-3.6 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,KHOP_THREADED X-Spam-Check-By: sourceware.org Received: from localhost (HELO sourceware.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 26 Apr 2012 18:16:44 +0000 From: "rsa at us dot ibm.com" To: glibc-bugs@sources.redhat.com Subject: [Bug math/887] Math library function "logb" and "nextafter" inconsistent Date: Thu, 26 Apr 2012 18:16:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: math X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: rsa at us dot ibm.com X-Bugzilla-Status: RESOLVED X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: rsa at us dot ibm.com X-Bugzilla-Target-Milestone: 2.16 X-Bugzilla-Changed-Fields: Status Resolution Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact glibc-bugs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: glibc-bugs-owner@sourceware.org X-SW-Source: 2012-04/txt/msg00349.txt.bz2 http://sourceware.org/bugzilla/show_bug.cgi?id=887 Ryan S. Arnold changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |RESOLVED Resolution| |FIXED --- Comment #26 from Ryan S. Arnold 2012-04-26 18:15:43 UTC --- The aforementioned GCC fix allows the usage of the fcfid instruction in 32-bit mode for power4 which can be used in place the fsub which exhibits the undesirable trait of a negative sign in downward rounding mode. The following patch will simply detect and flag this issue in the GLIBC libm testsuite in the future if GCC insn selection regresses for any reason. 2012-04-26 Ryan S. Arnold [BZ #887] * math/libm-test.inc (logb_test_downward): New test to expose erroneous negative sign on -0.0 result of logb[l](1) in FE_DOWNWARD rounding mode. diff --git a/math/libm-test.inc b/math/libm-test.inc index e0ac613..81de85b 100644 --- a/math/libm-test.inc +++ b/math/libm-test.inc @@ -5101,6 +5101,40 @@ logb_test (void) END (logb); } +static void +logb_test_downward (void) +{ + int save_round_mode; + errno = 0; + + FUNC(logb) (0); + if (errno == ENOSYS) + /* Function not implemented. */ + return; + + START (logb_downward); + + save_round_mode = fegetround (); + + if (!fesetround (FE_DOWNWARD)) + { + + /* IEEE 754-2008 says (section 5.3.3) that "logB(1) is +0.". Libm + * should not return -0 from logb in any rounding mode. PowerPC32 has + * failed with this test for power4 logb (and logbl on all PowerPC + * platforms) in the past due to instruction selection. GCC PR 52775 + * provides the availability of the fcfid insn in 32-bit mode which + * eliminates the use of fsub in this instance and prevents the negative + * signed 0.0. */ + + /* BZ #887 .*/ + TEST_f_f (logb, 1.000e+0, plus_zero); + } + + fesetround (save_round_mode); + + END (logb_downward); +} static void lround_test (void) @@ -8210,6 +8244,7 @@ main (int argc, char **argv) log1p_test (); log2_test (); logb_test (); + logb_test_downward (); modf_test (); ilogb_test (); scalb_test (); Tested and verified fixed with gcc version 4.6.4 20120423 (prerelease) [ibm/gcc-4_6-branch revision 186704] (GCC). -- 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.